[so] [Tema5] WriteRead
Dragan Stefan
ph0enix1810 at gmail.com
Tue Dec 26 20:35:49 EET 2006
In testul pentru scriere si apoi citire vad se asteapta 2 page fault-uri la
scriere. Nu inteleg de ce? Eu am facut ca la citire sa setez PAGE_READONLY
si la scriere PAGE_READWRITE intr-un singur PF si a mers bine pana am rulat
testul :P.
static void WriteRead (DWORD pageId, int expected, DWORD pageOffset)
{
DWORD memoryValue;
int expectedHandlerVar;
/* write - two faults */
gpfHandlerVar = 0;
expectedHandlerVar = (expected == PAGE_FAULT) ? 2 : 0;
memoryValue = pageId << 16 | pageOffset;
* (PDWORD) ((PBYTE) baseAddress + pageId * pageSize + pageOffset) =
memoryValue;
if (expected != NO_CHECK)
test ("Access_", gpfHandlerVar == expectedHandlerVar);
/* read - no faults */
gpfHandlerVar = 0;
expectedHandlerVar = 0;
memoryValue = * (PDWORD) ((PBYTE) baseAddress + pageId * pageSize +
pageOffset);
if (expected != NO_CHECK)
test ("Access", gpfHandlerVar == expectedHandlerVar);
}
Dragan Stefan
0723060629
http://ph0enix1810.lx.ro <http://ph0enix1810.lx.ro/>
Desteapta-te romane!
Salveaza capra vecinului!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20061226/579d9c72/attachment.htm
More information about the so
mailing list