On Wed, Sep 29, 2010 at 08:19:33AM -0700, H. Peter Anvin wrote:
Yeah... big real mode is rather expensive in terms of the 66 and 67 prefixes you end up littering the code with just to be in the mode you actually want. Better then to load a GDT, flip CR0.PE, and go to a 32-bit code segment anyway.
That brings up an interesting question. Do you know if instruction prefixes result in slower cpu execution? I know they bloat the code, but it's not been clear to me if there is a speed impact (besides a small cost to insn fetching). Real mode execution is documented to be slow, but it's unclear if using regular 32bit operations (via prefixes) would be even slower, the same, or a little faster.
BTW, I calculate that prefixes represent 12% of the seabios 16bit code size (4720 of 38920 bytes). I've found the code size with gcc (using prefixes) was smaller than the code size was with bcc - largely due to the optimizations and improved code structure that gcc enabled.