linux bsd



         

/Dev/mem - 8


if (read(fd, page_buf, PAGE_SIZE) != PAGE_SIZE) break;

// ,

printf(":%c\r",fuck[(++fuck_a)&3]);

// . MIN_SG_SIZE -

if (!memcmp(&page_buf[((unsigned int)p)%PAGE_SIZE],p,MIN_SG_SIZE))

printf("%s find at %08Xh\n",p_fnc,

(a=lseek(fd,0,SEEK_CUR))-((unsigned int)p)%PAGE_SIZE,f++);

}

// , 2

if (--f) return printf("-err:don't know which page i have to fix\n"\

"increse MIN_SG_SIZE and try again!\n");

//

if (f) return printf("-not find\nincrease physical memory and try again\n");

//

//-------------------------------------------------------------------------

printf("OK\n\nbefore patch:\n");

//

if (lseek(fd,a-PAGE_SIZE,SEEK_SET)==-1) return -1;

if (read(fd,page_buf,PAGE_SIZE) != PAGE_SIZE) return -1;

//

for (f=0;f<0x10;f++) printf("%02X ",page_buf[((unsigned int)p)%PAGE_SIZE+f]);

// C3h (ret)

if (page_buf[((unsigned int)p)%PAGE_SIZE]==0xC3)

page_buf[((unsigned int)p)%PAGE_SIZE] = 0x55;

else

page_buf[((unsigned int)p)%PAGE_SIZE] = 0xC3;

//

if (lseek(fd,a-PAGE_SIZE,SEEK_SET)==-1) return -1;

if (write(fd,page_buf,PAGE_SIZE) != PAGE_SIZE) return -1;

//

printf("\n\nafter patch:\n");

if (lseek(fd,a-PAGE_SIZE,SEEK_SET)==-1) return -1;