From 08f7cd86884070445082063dbca89cac9a02ba5c Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Thu, 28 Aug 2008 02:55:14 +0000 Subject: [PATCH] stage1_main() calling conventions changed to use two parameters instead of one. This resulted in a stack underflow for i586 and GeodeLX because the stack was set up for only one parameter in their stage0 asm code. Untested. Note that this didn't trigger on K8 because the stack setup there has excessive room, something that should be fixed as well. This is a band-aid and we should do it right instead. Discussion follows: Carl-Daniel Hailfinger wrote: > Can't we determine init_detected from C code and avoid working with it > in asm? > The Fam10h BKDG states in section 2.3.1: > "determine the type of this reset. One method is to use [The Link > Initialization Control Register] F0x6C[InitDet] bit." > The same register is suggested by the Athlon64/Operon BKDG and the > Fam0fh BKDG. > > That should work from C and make our lives easier. To be honest, I > have no idea why we use bit 11 of MTRRdefType_MSR for the > init_detected purpose. Ron Minnich wrote: > I plan to change that in future. For now, I want to change as little > as I can, since this code is so mysterious anyway. I would say let's > leave it in with a warning of some sort. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/coreboot-v3@838 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- arch/x86/geodelx/stage0.S | 3 +++ arch/x86/stage0_i586.S | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/geodelx/stage0.S b/arch/x86/geodelx/stage0.S index 56551154b9..37812f8eaa 100644 --- a/arch/x86/geodelx/stage0.S +++ b/arch/x86/geodelx/stage0.S @@ -365,6 +365,9 @@ lout: movl $0, %eax pushl %eax + /* Store zero for the unused init_detected parameter. */ + pushl %eax + /* Restore the BIST result. */ movl %ebp, %eax diff --git a/arch/x86/stage0_i586.S b/arch/x86/stage0_i586.S index 10a650edba..869f49cab4 100644 --- a/arch/x86/stage0_i586.S +++ b/arch/x86/stage0_i586.S @@ -439,6 +439,9 @@ lout: movl $0, %eax pushl %eax + /* Store zero for the unused init_detected parameter. */ + pushl %eax + /* Restore the BIST result */ movl %ebp, %eax /* We need to set ebp ? No need */