The main motivation: to use the movntdqa assembler command to avoid stack pollution. This command only works with write combining memory (also called WS and USWC)
+1
A:
Pass PAGE_WRITECOMBINE to VirtualAllocEx(). Sequential writes to that page will be write-combined by the MMU. Reads or nonsequential writes will induce a severe performance penalty.
Crashworks
2009-05-20 02:07:13
i tried it:char *ans=(char * ) VirtualAllocEx (hProcess, 0,1024*1024*64, MEM_COMMIT, PAGE_READWRITE| PAGE_WRITECOMBINE); it always returns 0 with GetLastError=87when replaceing PAGE_WRITECOMBINE with PAGE_NOCACHE, it does work and indeed memory access is very slow. but i need write combining so that movntdqa works as advertised.
yigal
2009-05-20 20:50:13
Hmm. Try creating the page and then changing its permissions after the fact with VirtualProtectEx() ?
Crashworks
2009-05-20 21:50:11
does not work either, the code below still returns 87unsigned long old;err=VirtualProtectEx(hProcess,ans,size,PAGE_READWRITE|PAGE_WRITECOMBINE,
yigal
2009-05-21 00:08:55
Gosh, I'm stumped. It seems like your version of the Windows kernel isn't aware of write combined memory and rejects the parameter (that error code is "invalid parameter").
Crashworks
2009-05-21 08:05:52
i tested using XP Professional with SP3, and vista home edition.
yigal
2009-05-21 18:03:09
tested using vista 64 bits, sp1, and it works! thanks!
yigal
2009-05-27 19:55:15