On Mon, Jul 14, 2008 at 12:05:18AM +0800, Zhang Rui wrote: > 2008/7/13, Kevin O'Connor <[EMAIL PROTECTED]>: > > > In LegacyBIOS(SeaBIOS), I inserted some code in post.c > > [...] > > > "movl $" __stringify(BUILD_STACK_ADDR) ", %esp\n" > > [...] > > > > > I think the return address in the stack is wrong. I am trying to figure > > > it out. > > > > You moved the stack (by assigning a new value to %esp). So, the > > return address is not on the stack - it's on the previous stack. > > > > But I tried without "movl $" __stringify(BUILD_STACK_ADDR) ", %esp\n", > post_coreboot in LegacyBIOS(SeaBIOS) can not run correctly. > I think I should manually set the return address?
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 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. -Kevin -- coreboot mailing list [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

