📄 memstore.direct.c
字号:
/* ---------------------------------------------------------------------------
*
* MEASUREMENT OF THE MEMORY INITIALIZATION SPEED IN BOTH DIRECTIONS
* ===========================================================
*
* Build 0x001 26.08.2002
--------------------------------------------------------------------------- */
#include <DoCPU.h>
#define _PAGE_SIZE (4*K) // size of one memory page
#define BLOCK_SIZE (4*M) // processed block size
/* ---------------------------------------------------------------------------
INITIALIZATION /---->
--------------------------------------------------------------------------- */
l_to_r(char *p)
{
memset(p,0x66,BLOCK_SIZE); // initializing memory
A_READ(p,BLOCK_SIZE); // imitating block processing
}
/* ---------------------------------------------------------------------------
INITIALIZATION <-------/
--------------------------------------------------------------------------- */
r_to_l(char *p)
{
char *p2;
p2 = p;
__asm{ // implement reverse copying in assembler
STD // setting the flag of reverse direction
MOV EDI,[p2] // load the pointer to the block to be initialized into EDI
MOV ECX,BLOCK_SIZE/4 // load the number of double words to be written into ECX
REP STOSD // initialize the memory by arbitrary value that happens to be contained in EAX
MOV [p2],EDI // 钺眍怆
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -