Still looks like insanity to me. I see what you're doing but I don't know why!
Hehehe... Look like it is insane, isn't it?
The thing is, what is writen on the sections in an object file isn't "proteced mode"
per se. Just a buch of bytes. When you use
bits 32 in nasm the only thing you are telling to the compiler is: Don't put 0x66 or 0x67 prefix before the instructions using E?? registers. When you use
bits 16 it's the other way around (E?? registers in instructions will generate 0x66 or 0x67 prefix).
bits 64 is the same as
bit 32, but allows the REX prefix.
NASM doesn't know if you are dealing with protected mode or not, nor the bytes writen on ELF object files.
In fact, Linux source uses this to build the master boot sector in
arch/x86/boot/* source tree, but using GAS, instead of NASM.
I actually replied to this post to see if Elawig was "for real" or not.
A prudent test, given the huge amount of spam in recent weeks...
[]s
Fred