[coreboot] [RFC] v3: Stack switching abstraction for C7 and later Intel processors

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Tue Oct 14 23:16:37 CEST 2008

On 14.10.2008 22:21, ron minnich wrote:
> On Tue, Oct 14, 2008 at 9:31 AM, Marc Jones <Marc.Jones at amd.com> wrote:
>> Why not ret and do a call (or ljmp) from stage0_main to main(). It would
>> make the code easier to follow and it would be easy to add code if anything
>> were required between disable car and the jmp.
> OK Marc is right again. Marc, you have to stop this ;-)
> So the operation is something like this:
> disable_car()
> disable_car copies stacks. The top of stack has a valid ROM address --
> this code runs from ROM.
> Disable_car returns to stage1. stage1 calls the next function. My only
> worry is that happens to %ebp but ... this might be workable.

Calling anything after disable_car() returns can only be done reliably
if the stack has not moved. You see, gcc is free to reorder stuff as it
sees fit and it could insert almost anything between disable_car() and
the call to stage1.



More information about the coreboot mailing list