V1 trouble with gcc 3.2.3 SOLUTION!!!

Dave Ashley linuxbios at xdr.com
Thu Nov 20 17:33:00 CET 2003


Aside from the = vs == bug which probably wasn't too damaging,
the problem was caused because the newer compiler doesn't use
as many registers in its code, specifically the EBX register.
So at the start of the do_vgabios() function it doesn't bother
to push EBX on the stack to preserve it. However code higher
up that calls this function had stored something in EBX, which
the call to the vgabios happily trashes.

The fix is to push ebx within the real_mode_switch_call_vga function:
	/* save the stack */
 "push %ebx\n"
	"mov %esp, __stack\n"

...

       "    mov  %ax, %ss          \n"
       "    mov  __stack, %esp\n"
 "pop %ebx\n"
       );

It won't hurt to push other registers like %esi for example. In fact
why not push all the registers just to be safe...

This is a pretty subtle bug, people should understand what was
wrong and how the fix works.

-Dave



More information about the coreboot mailing list