Hi,
On Sun, Sep 07, 2008 at 10:59:13PM +0200, Carl-Daniel Hailfinger wrote: [...]
CAR will write to memory locations below 1M. There are three ways to cope with that:
[...]
- Write excessively clever and fragile code which performs a double
stack switch during resume.
[...]
- Will NOT work for Geode, may not work for Intel and VIA. The existing
CAR enabling/disabling code will seem trivial in comparison.
Why can't the code use a new stack after CAR is disabled?
To be clear, I think moving the stack would be a bad idea. However, I don't see why the code can't just start using a new stack.
Right now, the only stack variable that is shared between CAR and post-CAR is 'archive' (in stage1_main() ). I would think one could manually copy it from the CAR stack to a post-CAR global variable. (Or just rebuild it from scratch.)
I'm thinking - one could implement a small assembler trampoline function that took two parameters - the new stack location and the function to jump to. The assembler would only need to set %esp and jump to the new function.
This would still require memory under 1MB for car, but at least stage2 could run with a full stack and globals that run in reserved memory.
Have I missed something?
-Kevin