memlayout: Add symbols for stage bounds
Stages are inconsistent with other memlayout regions in that they don't have _<name> and _e<name> symbols defined. We have _program and _eprogram, but that always only refers to the current stage and _eprogram marks the actual end of the executable's memory footprint, not the end of the area allocated in memlayout. Both of these are sometimes useful to know, so let's add another set of symbols that allow the stage areas to be treated more similarly to other regions. Change-Id: I9e8cff46bb15b51c71a87bd11affb37610aa7df9 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/13737 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
f7c01aa774
commit
862c385f9a
|
@ -103,38 +103,38 @@
|
||||||
/* Careful: 'INCLUDE <filename>' must always be at the end of the output line */
|
/* Careful: 'INCLUDE <filename>' must always be at the end of the output line */
|
||||||
#if ENV_BOOTBLOCK
|
#if ENV_BOOTBLOCK
|
||||||
#define BOOTBLOCK(addr, sz) \
|
#define BOOTBLOCK(addr, sz) \
|
||||||
SET_COUNTER(bootblock, addr) \
|
SYMBOL(bootblock, addr) \
|
||||||
|
_ebootblock = _bootblock + sz; \
|
||||||
_ = ASSERT(_eprogram - _program <= sz, \
|
_ = ASSERT(_eprogram - _program <= sz, \
|
||||||
STR(Bootblock exceeded its allotted size! (sz))); \
|
STR(Bootblock exceeded its allotted size! (sz))); \
|
||||||
INCLUDE "bootblock/lib/program.ld"
|
INCLUDE "bootblock/lib/program.ld"
|
||||||
#else
|
#else
|
||||||
#define BOOTBLOCK(addr, sz) \
|
#define BOOTBLOCK(addr, sz) \
|
||||||
SET_COUNTER(bootblock, addr) \
|
REGION(bootblock, addr, sz, 1)
|
||||||
. += sz;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENV_ROMSTAGE
|
#if ENV_ROMSTAGE
|
||||||
#define ROMSTAGE(addr, sz) \
|
#define ROMSTAGE(addr, sz) \
|
||||||
SET_COUNTER(romstage, addr) \
|
SYMBOL(romstage, addr) \
|
||||||
|
_eromstage = _romstage + sz; \
|
||||||
_ = ASSERT(_eprogram - _program <= sz, \
|
_ = ASSERT(_eprogram - _program <= sz, \
|
||||||
STR(Romstage exceeded its allotted size! (sz))); \
|
STR(Romstage exceeded its allotted size! (sz))); \
|
||||||
INCLUDE "romstage/lib/program.ld"
|
INCLUDE "romstage/lib/program.ld"
|
||||||
#else
|
#else
|
||||||
#define ROMSTAGE(addr, sz) \
|
#define ROMSTAGE(addr, sz) \
|
||||||
SET_COUNTER(romstage, addr) \
|
REGION(romstage, addr, sz, 1)
|
||||||
. += sz;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENV_RAMSTAGE
|
#if ENV_RAMSTAGE
|
||||||
#define RAMSTAGE(addr, sz) \
|
#define RAMSTAGE(addr, sz) \
|
||||||
SET_COUNTER(ramstage, addr) \
|
SYMBOL(ramstage, addr) \
|
||||||
|
_eramstage = _ramstage + sz; \
|
||||||
_ = ASSERT(_eprogram - _program <= sz, \
|
_ = ASSERT(_eprogram - _program <= sz, \
|
||||||
STR(Ramstage exceeded its allotted size! (sz))); \
|
STR(Ramstage exceeded its allotted size! (sz))); \
|
||||||
INCLUDE "ramstage/lib/program.ld"
|
INCLUDE "ramstage/lib/program.ld"
|
||||||
#else
|
#else
|
||||||
#define RAMSTAGE(addr, sz) \
|
#define RAMSTAGE(addr, sz) \
|
||||||
SET_COUNTER(ramstage, addr) \
|
REGION(ramstage, addr, sz, 1)
|
||||||
. += sz;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Careful: required work buffer size depends on RW properties such as key size
|
/* Careful: required work buffer size depends on RW properties such as key size
|
||||||
|
@ -146,7 +146,8 @@
|
||||||
|
|
||||||
#if ENV_VERSTAGE
|
#if ENV_VERSTAGE
|
||||||
#define VERSTAGE(addr, sz) \
|
#define VERSTAGE(addr, sz) \
|
||||||
SET_COUNTER(verstage, addr) \
|
SYMBOL(verstage, addr) \
|
||||||
|
_everstage = _verstage + sz; \
|
||||||
_ = ASSERT(_eprogram - _program <= sz, \
|
_ = ASSERT(_eprogram - _program <= sz, \
|
||||||
STR(Verstage exceeded its allotted size! (sz))); \
|
STR(Verstage exceeded its allotted size! (sz))); \
|
||||||
INCLUDE "verstage/lib/program.ld"
|
INCLUDE "verstage/lib/program.ld"
|
||||||
|
@ -154,8 +155,7 @@
|
||||||
#define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) VERSTAGE(addr, size)
|
#define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) VERSTAGE(addr, size)
|
||||||
#else
|
#else
|
||||||
#define VERSTAGE(addr, sz) \
|
#define VERSTAGE(addr, sz) \
|
||||||
SET_COUNTER(verstage, addr) \
|
REGION(verstage, addr, sz, 1)
|
||||||
. += sz;
|
|
||||||
|
|
||||||
#define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) ROMSTAGE(addr, size)
|
#define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) ROMSTAGE(addr, size)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,6 +62,24 @@ extern u8 _program[];
|
||||||
extern u8 _eprogram[];
|
extern u8 _eprogram[];
|
||||||
#define _program_size (_eprogram - _program)
|
#define _program_size (_eprogram - _program)
|
||||||
|
|
||||||
|
/* _<stage>_size is always the maximum amount allocated in memlayout, whereas
|
||||||
|
* _program_size gives the actual memory footprint *used* by current stage. */
|
||||||
|
extern u8 _bootblock[];
|
||||||
|
extern u8 _ebootblock[];
|
||||||
|
#define _bootblock_size (_ebootblock - _bootblock)
|
||||||
|
|
||||||
|
extern u8 _romstage[];
|
||||||
|
extern u8 _eromstage[];
|
||||||
|
#define _romstage_size (_eromstage - _romstage)
|
||||||
|
|
||||||
|
extern u8 _ramstage[];
|
||||||
|
extern u8 _eramstage[];
|
||||||
|
#define _ramstage_size (_eramstage - _ramstage)
|
||||||
|
|
||||||
|
extern u8 _verstage[];
|
||||||
|
extern u8 _everstage[];
|
||||||
|
#define _verstage_size (_everstage - _verstage)
|
||||||
|
|
||||||
/* Arch-specific, move to <arch/symbols.h> if they become too many. */
|
/* Arch-specific, move to <arch/symbols.h> if they become too many. */
|
||||||
|
|
||||||
extern u8 _ttb[];
|
extern u8 _ttb[];
|
||||||
|
|
Loading…
Reference in New Issue