3 ms·
No, he's using -m16 -march=i386 which creates 32 bit code that boots in 16 bit mode using the 32 bit size prefix on most instructions, and that will only work o
by rwmj 7y ago
No, he's using -m16 -march=i386 which creates 32 bit code that boots in 16 bit mode using the 32 bit size prefix on most instructions, and that will only work on 80386 and above.
- jacobush 7y agoThis is so insane, I had no idea such a thing was possible: 16 vs 32 bit It is possible to use 32-bit instructions in the real-address mode, they just need to be marked with address-size and operand-size prefixes. The -m16 option for clang/gcc, and .code16 directive in GNU assembler, do exactly that. The resulting code is 32-bit, only marked everywhere with those prefixes. It's not compatible with actual 16-bit CPUs. "Unfortunately the 32-bit addresses still cannot exceed the boundary of the segment (65535), otherwise they'll trigger an exception. QEMU doesn't emulate this behaviour, so it's useful to occasionally test with Bochs."
- deleted 7y ago[deleted]