From: Alex Ionescu
Ge van Geldorp wrote:
Is this routine so time-critical that we want to
resort to
self-modifying code?
Yup, and there are many more cases where NT does this:
- Syscall vs INT2e
- Cmpxch8 vs cmpxchg x2 + spinlock
- XMMI Page Zeroing vs regular Page Zeroing
- Prefetching
And I'm probably missing more. There are critical APIs that
would be very slow should the check be done each time they are called.
I'm not arguing that we should ban self-modifying code in every case (and I
certainly don't intend to start a vote on it ;-)), the SYSCALL v. INT2E case
is a prime example of where it is useful. However, I was talking about "THIS
routine". Frankly, I don't buy that a routine that is not even called right
now (it was UNIMPLEMENTED()) is so time-critical that we need this. It kills
ROMability of the code, effectively shutting us out of the embedded market
that some people had rather high hopes for. The fact that NT does this is of
little concern, we only need to be compatible, not identical.
GvG