Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Testing beyond 512MB mapped physical memory

1 view
Skip to first unread message

Johan

unread,
Nov 5, 2009, 1:47:01 AM11/5/09
to
Hi All,

I read from several articles expecially from Sue Loh, that we are able to
extend the physical memory of WinCE 6.0 beyond 512MB using VirtualAllocEx and
VitualCopyEx. This is what i have done to replicate it.

My Setup:
-WinCE 6.0 using CEPC with 1GB RAM

My Steps:
- Modify the sample stream driver where VirtualAllocEx and VirtualCopyEx is
called
- From an application, i will pass to the driver the application's processID
which VirtualAllocEx will use for reserving 512MB of space. VirtualCopyEx is
also called as shown.

In driver:
//processid is received from application
destprocess=OpenProcess(0,FALSE,processid);
sourceprocess=GetCurrentProcess();

p=(LPBYTE)VirtualAllocEx(destprocess, NULL, 0x20000000, MEM_RESERVE,
PAGE_READWRITE);
ret=VirtualCopyEx(destprocess, p, sourceprocess, (void*)0x20000000,
(512*1024*1024), PAGE_READWRITE|PAGE_PHYSICAL}PAGE_NOCACHE);

- With the returned base address of p, i am able to write and read data into
it in my application. (Which i assume that i have successfully mapped the
remaining 512MB of RAM left)
- However in my test to verify this, i purposely set the allocated space to
512MB+1 byte. This should fail because i have only 1GB RAM. The first half is
taken by OS while only 512MB is left for mapping. However, what i notice is
that i am able to allocated the 512MB + 1 byte space and am still able to
read and write to the last byte.

1) Why is this so? I though i only have up to 512MB of physical memory left,
why is that i am able to map more than 512MB and even access the 512MB + 1
byte ? (In the code, i am assuming that the remaining physical memory i can
map is from 0x20000000 to 0x3FFFFFFF)

2) Secondly, in my driver, i also include ability to free this mapping via
this codes

In driver:
//processid is received from application
destprocess=OpenProcess(0,FALSE,processid);
virtualFreeEx(destprocess,p,0,MEM_RESERVE);

When this code is executed, the whole CEPC restarts itselfs. Can i know what
i happening? Is there some kind of memory corruption that caused this to
happen?

Thanks for the help:)

0 new messages