The terminal solution to unchecked buffers

The terminal solution to unchecked buffers

Post by wolfgang k » Sat, 16 Aug 2003 03:40:19

Ed Beroset answered Michael Tippach:

[about JMP ESP]
As this is a 'absolute address's within the code-segment,
and the stack usually grows downward ...

Why not split the address-range like
Code-seg limited to lower part and
stack-seg limited to upper part of the same segment base.

Then a JMP ESP and any equal code will end up in an exception.

[about LAHF/SAHF]

| News to me! A quick scan of all of the assembly language source code I
| have on my hard drive shows up exactly zero uses. Of course, most of
| that's written by me, so maybe I need to look at a wider sample. Have
| you a use in mind? The only thing I recall that it was useful for was
| emulating 8085 style CP/M code!

My PM32 Os-kernel and modules use this instruction pairs several times
(whenever a FLAG-status needs to be saved/restored).
It's quite faster than PUSHF/POPF and avoids any change of other than
Zero-, Sign- and Carry-flags (POPF/POPFD mask out several bits).