Hi,

I was looking over the WinXP Service Pack 2 "Changes to functionality"
document, which you can get here:-

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechn
ol/winxppro/maintain/winxpsp2.asp (download available in Word format)

One change is that for all capable 32-bit processors (only a couple so far,
but it'll probably get more common), and for all 64-bit ones, there will now
be "Execution Protection", or NX.  Taken from the doc:-

"Execution protection (also known as NX, or no execute) prevents code
execution from data pages such as the default heap, various stacks, and
memory pools. Protection can be applied in both user and kernel-mode.It also
forces developers to avoid executing code out of data pages without
explicitly marking the pages as executable."

JIT was my first thought on reading this, and indeed it gets a specific
mention in the document.  Turns out you need to use a bit of the Windows API
(VirtualAlloc) and pass it flags to say execution of data in that page of
memory is OK.

I'm not sure how the memory used for JIT'ing is allocated right now - I
think there are wrapper functions we call to do it - in which case they can
do stuff on a platform specific basis.  Or maybe JIT can have it's own
memory allocation functions to ensure only pages used for that get marked as
executable?  Marking every page we allocate as executable would be a Bad
Thing I guess.

Anyways, figured it may be worth a mention now, so there isn't an
out-of-the-blue "JIT doesn't work on XP SP2" bug report somewhere down the
line.

Jonathan


Reply via email to