On 09.09.2008 02:46, Kevin O'Connor wrote:
On Mon, Sep 08, 2008 at 05:38:59PM +0200, Carl-Daniel Hailfinger wrote:
On 08.09.2008 17:23, Stefan Reinauer wrote:
No. There is no RAM at that position.
That means we either
- have to tell gcc that the stack moved in the middle of a function or
- redesign v3 stage1 completely.
I don't think that is true.
Well, if the stack location during CAR is in a place that will have no RAM after CAR, we must move the stack or use virtual memory addresses (fun!).
As before, I think _moving_ the stack is a bad idea. However, I don't see any reason not to start using a new stack and discard the old. Doing so is both simple and reliable.
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 already had code to do that jump a few hundred revisions ago and we killed it because it was extremely difficult to follow. The stack switching is a processor dependent operation because it has to be coupled with disabling CAR. That means you have to follow calls a few levels deep just to see how the end of stage1 is executed.
That said, I think having disable_car() jump to the next stage is probably faster and more flexible.
It is a world of pain and I'm still determined to find a way to avoid it, possibly by mapping some RAM into the CAR area through the use of virtual memory.
Regards, Carl-Daniel