On Sat, Nov 08, 2008 at 09:50:34PM +0100, Stefan Reinauer wrote:
(gdb) disas 0xfffc0 0xfffd4 Dump of assembler code from 0xfffc0 to 0xfffd4: 0x000fffc0: mov $0x3f8,%dx 0x000fffc4: mov $0x44,%al 0x000fffc6: out %al,(%dx) 0x000fffc7: call 0x1e2617
Okay - you're running into linker madness resulting from mixing 32bit and 16bit code. The romlayout.S code thinks it is running at offset 0x0000 (which is correct for 16bit code because CS adds in 0xf0000). You've asked it to do a relative call to 0xf2617, but when you're actually running in 32bit mode the code is running at offset 0xf0000, and the relative call to 0xf2617 looks like a jump to 0xf0000+0xf2617=0x1e2617.
A simple fix is to write the call as:
calll (_code32__init - BUILD_BIOS_ADDR)
BTW, I think you're going to need to setup SeaBIOS' gdt/idt - see the code at "post32" in romlayout.S.
I keep these commands handy for diagnosing these things:
objdump -m i386 -M suffix -ld out/rom.o | less # 32bit disassemble
objdump -m i386 -M i8086 -M suffix -ld out/rom.o | less # 16bit
-Kevin