Paranoid NOP padding?
Bernd Jendrissek
berndj@prism.co.za
Thu Jul 14 07:20:00 GMT 2005
Looking for some 80386 timings (32-bit div in real mode), I came across
this:
http://www.microsoft.com/msj/0698/hood0698.aspx
It seems gas fills gaps created by .align N with NOP instructions, such
that if the CPU reaches the beginning (!) of the gap, it skips over it
without any state change other than for %eip.
Sometimes, though, the CPU should *never* execute code in a "gap".
Think gaps between functions, for example.
Could it be cool to teach gas (or is ld the better place?) to insert
0xcc (debugger traps) instead, or even one of the guaranteed-invalid
opcodes (if there are any that are 1 byte long)?
I suppose I'm supposed to show the patch now... :)
--
I've generally found that the fastest way to get the right answer on the net
is to confidently assert the answer you believe to be right; those who know
will immediately correct you, while if you just ask, often no answers arrive.
All it requires is a willingness to look bad on occasion.
- Joe Buck on gcc@gcc.gnu.org
More information about the Binutils
mailing list