2008/7/14, Kevin O'Connor kevin@koconnor.net:
[...] Right - seabios needs to be using its stack in order to call 16bit functions. You probably need to save and restore the stack. Completely untested, but something like:
movl %esp, %esi movl $BUILD_STACK_ADDR, %esp ljmp 0x10, $1f
1: calll post_coreboot
movl %esi, %esp retl
I used this: "movl %esp, %esi\n" "movl $" __stringify(BUILD_STACK_ADDR) ", %esp\n" "ljmp $0x10, $post_coreboot\n"
and added this at the end of post_coreboot() function: asm( "movl %esi, %esp\n" "retl" );
Then it can return to coreboot correctly. Till the payload(I used no payload here)
But pci_dev_init() is executed more than one time so vga is initialized more than one time in SeaBIOS. A flag variable would be used to run SeaBIOS only once.
However, note that the above wont save/restore the idt/gdt. And again, I'm not sure if coreboot puts its stack/idt/gdt somewhere where seabios may overwrite it.
I am supprised that it just run correctly when return address is set. I supposed to restore the gdt. Maybe the gdt of SeaBIOS and coreboot are the same.
And I want to know where will SeaBIOS write in the memory. Such as the range of bda and ebda?
I think it is time to int SCSI controller, and set the int 13 for it.
Best regards. Zhang Rui