A big Problem with VirtualAlloc and PocketPC 2003!

I'm curently Fighting With PocketPC 2003 and VirtualAlloc/protect.
I use them within the Dynamic Recompiler for FpseCE (upcomming Playstation Emulator).
First i Allocate a 2MB Buffer. This buffer is use to Store Recompiled Block.
I Declare this buffer with VirtualAlloc, then when i need to write a new block, i unprotect it with VirtualProtect, and at the end of this writing block i protect it.
On PocketPC 2002 that work very well, on PocketPC 2003, to make it working i need to add the NOCACHE flag when i protect it :( a Big slowdown is resulting....
Here are my routine:
UINT8 *win_code_alloc(int size)
{
LPCVOID lpAddress=VirtualAlloc(NULL,size,MEM_RESERVE,PAGE_EXECUTE_READWRITE);
return (UINT8 *)VirtualAlloc(lpAddress,size,MEM_COMMIT,PAGE_EXECUTE_READWRITE);
}
void win_code_free(UINT8 *buf)
{
VirtualFree(buf,0,MEM_RELEASE);
}
void win_code_protect(UINT8 * lpPage,int dwSize){
DWORD dwOldProtect;
VirtualProtect (lpPage,dwSize,PAGE_EXECUTE_READ,&dwOldProtect);
}
void win_code_unprotect(UINT8 * lpPage,int dwSize){
DWORD dwOldProtect;
VirtualProtect (lpPage,dwSize,PAGE_EXECUTE_READWRITE,&dwOldProtect);
}
For now with my News PocketPC (ASUS A620 PPC2003), i can only use the Dynamic Interpreter , it's extremely Fast!! all game are already very playable, Ridge Racer run at 30 fps, Quake2 17-20 fps, Wipeout 30fps, Destruction Derby 30-40 fps etc.... I can't Imagine when my recompiler will run on PPC2003!! that will let me the possibility to add sound :) :) :)
thanks your any help!!
schtruck.
I use them within the Dynamic Recompiler for FpseCE (upcomming Playstation Emulator).
First i Allocate a 2MB Buffer. This buffer is use to Store Recompiled Block.
I Declare this buffer with VirtualAlloc, then when i need to write a new block, i unprotect it with VirtualProtect, and at the end of this writing block i protect it.
On PocketPC 2002 that work very well, on PocketPC 2003, to make it working i need to add the NOCACHE flag when i protect it :( a Big slowdown is resulting....
Here are my routine:
UINT8 *win_code_alloc(int size)
{
LPCVOID lpAddress=VirtualAlloc(NULL,size,MEM_RESERVE,PAGE_EXECUTE_READWRITE);
return (UINT8 *)VirtualAlloc(lpAddress,size,MEM_COMMIT,PAGE_EXECUTE_READWRITE);
}
void win_code_free(UINT8 *buf)
{
VirtualFree(buf,0,MEM_RELEASE);
}
void win_code_protect(UINT8 * lpPage,int dwSize){
DWORD dwOldProtect;
VirtualProtect (lpPage,dwSize,PAGE_EXECUTE_READ,&dwOldProtect);
}
void win_code_unprotect(UINT8 * lpPage,int dwSize){
DWORD dwOldProtect;
VirtualProtect (lpPage,dwSize,PAGE_EXECUTE_READWRITE,&dwOldProtect);
}
For now with my News PocketPC (ASUS A620 PPC2003), i can only use the Dynamic Interpreter , it's extremely Fast!! all game are already very playable, Ridge Racer run at 30 fps, Quake2 17-20 fps, Wipeout 30fps, Destruction Derby 30-40 fps etc.... I can't Imagine when my recompiler will run on PPC2003!! that will let me the possibility to add sound :) :) :)
thanks your any help!!
schtruck.