Code: Select all
40141: 66 data16
40142: 0f 22 c0 mov %eax,%cr0
Which means the disassembly you've listed is wrong, as it's out of sync with the actual code
Code: Select all
40141: 66 data16
40142: 0f 22 c0 mov %eax,%cr0
.. because I'm not so bsd-savvy ??fronty wrote:Why are you looking at some disassembly when you could just check source code?
Actually, my osloader is of course a 32-bit ELF file and it does expect to be started from real mode. The ELF entry point is that 16-bit code. It just sets up a protected mode environment and jumps some C code. There's also a multiboot header which utilizes the a.out kludge to specify a different entry point for multiboot-compliant loaders. This entry point just copies the loader to low memory where it expects to be, then sets up the same protected mode environment and then jumps to the same C code. For the purposes of this contest I just #ifdef out the real-mode code and change the entry point in the linker script for the protected mode version of the loader. I don't expect anyone to write a bootsector that can run both the real mode and protected mode versions except perhaps with different compile-time options.a427 wrote:@quok:
concerning the real/protected mode bootstrap mode ambiguity, perhaps it would have been wise to
expect the boot loader to start the OSLOADER in realmode *by default* (as it is the case for a legacy x86 cpu at power up), except
if this particular OSLOADER file is *multiboot* compliant ?
http://www.gnu.org/software/grub/manual ... iboot.html
=> in this case, we should boot it in 32 bit protected mode..
This way, such a designed bootloader would be :
-able to boot either of them with recompiling or run time options
-able to boot the (16 bit bootstrap) openbsd 'boot' (as advertised)
-even cooler
just my .02