[ros-bugs] [Bug 1264] Use of pentium-class instructions

ReactOS.Bugzilla at reactos.org ReactOS.Bugzilla at reactos.org
Tue Jan 10 08:06:19 CET 2006


http://www.reactos.org/bugzilla/show_bug.cgi?id=1264





------- Additional Comments From alex.ionescu at reactos.com  2006-01-10 08:06 CET -------
Full hotpatching is dirty and is what NT seems to do... I suggest we use
function pointers instead and then simply hotpatch a jmp. So we would have:

ExfFooBar:

jmp ExfFooBar486

code here + cmpxchg

ExfFooBar486:

code here

If the kernel detects 586+ support, the jmp would be overwritten by 6 nops. On
486 the jmp would probably slow down the routine, but we don't really care: 486
will have to use a spinlock anyway. On 586, this would add 6 NOPs. I think these
should have almost no effect on the speed of the routine.

The other solution is to go the MS way and over-write the entire code in the
routine with a compatible alternative. Another idea, which might be better is:

ExfFooBar:

code here + cmpxchg

ExfFooBar486:

code here

When the kernel detects that a 586 is NOT present, codehere becomes overwritten
with a jmp. The advantage is that on 586+ we have absolutely no performance
loss. We also do less work on a 586+ and boot faster (because the default code
is the 586 case, and the 586 case shoudl theoreticalyl be more common). The
disadvantage is that this method is "ugly" because you're overwriting code
instead of having a pre-existing jmp/nop buffer. But I would go with this method
myself.

-- 
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are the QA contact for the bug, or are watching the QA contact.


More information about the Ros-bugs mailing list