On 09.09.2008 03:49, Kevin O'Connor wrote:
On Tue, Sep 09, 2008 at 03:22:38AM +0200, Carl-Daniel Hailfinger wrote:
On 09.09.2008 02:46, Kevin O'Connor wrote:
I've attached a code snippet below - it's only to illustrate the general idea.
Yes, and it won't work because there can't be global variables in stage1 because there's no place to store them.
We can't access memory after initram completes? Global variables are just memory addresses. One clearly can not access them before memory is available - but why can't we access them after memory is up?
For that we have stage2 global variables.
The stack switching is a processor dependent operation because it has to be coupled with disabling CAR.
Okay - can you elaborate on what those dependencies are? Is there a phase where we can access CAR but not main memory?
Well, switching off CAR is processor specific. After switching off CAR, your old stack will be invalid, so you must switch stacks before that. However, you can't switch the stack in the middle of a function and you must avoid cache eviction of the old stack before you have the new stack running. That pretty much forces you to have stack switch and CAR disabling as one giant block of asm.
Regards, Carl-Daniel