We are woefully unaware about how much stack v3 really uses.

This is a complete rewrite of my earlier stack checker proposal.
It works for CAR and RAM, has better abstraction and actually gives us
nice results.
The stack checker is default off due to its rather measurable impact on
boot speed.
Diagnostic messages are printed on first initialization, directly after
RAM init and directly before passing control to the payload. Sample qemu
log is attached. Extract from that log follows:

coreboot-3.0.986 Fri Nov  7 04:04:37 CET 2008 starting...
(console_loglevel=8)
Initial lowest stack is 0x0008fe98
Choosing fallback boot.
[...]
Done RAM init code
After RAM init, lowest stack is 0x0008fe30
Done printk() buffer move
[...]
LAR: load_file_segments: Failed for normal/payload
Before handoff to payload, lowest stack is 0x0008bf50
FATAL: No usable payload found.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@1012 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Carl-Daniel Hailfinger 2008-11-13 01:28:32 +00:00
commit cb9db3b6d0
5 changed files with 56 additions and 0 deletions

View file

@ -265,6 +265,7 @@ void * bottom_of_stack(void);
EXPORT_SYMBOL(bottom_of_stack);
struct global_vars * global_vars(void);
EXPORT_SYMBOL(global_vars);
void check_stack(void);
#define CAR_STACK_BASE (CONFIG_CARBASE + CONFIG_CARSIZE - 4)
#define RAM_STACK_BASE 0x88ffc
@ -278,6 +279,8 @@ EXPORT_SYMBOL(global_vars);
#else
#define CAR_STACK_SIZE (CONFIG_CARSIZE - 4)
#endif
/* To be honest, this limit is arbitrary and only used for stack checking. */
#define RAM_STACK_SIZE (65536 - 4)
/* resource maps. These started out as special for the K8 but now have more general usage */
/* it's not totally clear that the type and union are a great idea, but see the v2 code:

View file

@ -63,6 +63,10 @@ struct global_vars {
struct sys_info sys_info;
/* has the spd hardware been set up? */
int spd_inited;
int ram_available;
#ifdef CONFIG_CHECK_STACK_USAGE
void *loweststack;
#endif
};
#endif /* GLOBALVARS_H */