[coreboot] suspend/resume in v3
Kevin O'Connor
kevin at koconnor.net
Tue Sep 9 02:46:13 CEST 2008
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.
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.
That said, I think having disable_car() jump to the next stage is
probably faster and more flexible.
-Kevin
Index: arch/x86/stage1.c
===================================================================
--- arch/x86/stage1.c (revision 861)
+++ arch/x86/stage1.c (working copy)
@@ -139,6 +139,8 @@
}
#endif /* CONFIG_PAYLOAD_ELF_LOADER */
+static struct mem_file GlobalArchive;
+
/**
* This function is called from assembler code with its argument on the
* stack. Force the compiler to generate always correct code for this case.
@@ -232,6 +234,20 @@
printk(BIOS_DEBUG, "Done RAM init code\n");
+ // Memory running - copy variables in CAR area that are needed
+ // to a permanent area.
+ GlobalArchive = archive;
+
+ // Jump to second part of stage1 with a permanent stack.
+ asm volatile (
+ "movl 0x200000, %esp\n"
+ "jmp stage1_main_post_initram\n");
+}
+
+void stage1_main_post_initram()
+{
+ struct mem_file archive = GlobalArchive;
+
/* Turn off Cache-As-Ram */
disable_car();
More information about the coreboot
mailing list