[SeaBIOS] [PATCH 1/2] Don't pass return address to transition(32, 16, 16big) on stack.

H. Peter Anvin hpa at zytor.com
Wed Dec 8 03:51:07 CET 2010


On 12/07/2010 06:46 PM, Kevin O'Connor wrote:
>> In Syslinux I have this formalized so that the sequence:
>>
>> 	pushl	$func32
>> 	callw	_pm_call
> 
> This is similar to what SeaBIOS used to do - it had: "pushl $func32;
> jmp transition32" and "pushl $func16; jmp transition16".
> 
> The problem with this is that I can't use "popl" to get the
> destination address in transition16 because a popl in 16bit mode only
> looks at %sp and not %esp.  So, if %esp==0x90000 and I do "pushl
> $func16; transition16", then when transition16 does a "retl" (or
> "popl") then it ends up pulling the address at 0x0000 instead of
> 0x90000.

Right, the code needs to compute the 32-bit flat version and look at it.
 You don't want to use popl at all.  In my code I just use the stored
reference on the stack as the target address of the call once we're well
within the 32-bit code, at the very end it is dropped by a simple "ret 4".

Anyway, sounds like there might be a fuller version and I'm only seeing
part of it.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.




More information about the SeaBIOS mailing list