Add and consistently use wrapper macro for romstage static variables
x86 systems run their romstage as execute-in-place from flash, which prevents them from having writable data segments. In several code pieces that get linked into both romstage and ramstage, this has been worked around by using a local variable and having the 'static' storage class guarded by #ifndef __PRE_RAM__. However, x86 is the only architecture using execute-in-place (for now), so it does not make sense to impose the restriction globally. Rather than fixing the #ifdef at every occurrence, this should really be wrapped in a way that makes it easier to modify in a single place. The chromeos/cros_vpd.c file already had a nice approach for a wrapper macro, but unfortunately restricted it to one file... this patch moves it to stddef.h and employs it consistently throughout coreboot. BRANCH=nyan BUG=None TEST=Measured boot time on Nyan_Big before and after, confirmed that it gained 6ms from caching the FMAP in vboot_loader.c. Change-Id: Ia53b94ab9c6a303b979db7ff20b79e14bc51f9f8 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203033 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
This commit is contained in:
parent
e0863a7ffc
commit
c8127e4ac9
5 changed files with 16 additions and 32 deletions
|
|
@ -38,4 +38,11 @@ typedef unsigned int wint_t;
|
|||
#define ROMSTAGE_CONST
|
||||
#endif
|
||||
|
||||
/* Work around non-writable data segment in execute-in-place romstage on x86. */
|
||||
#if defined(__PRE_RAM__) && CONFIG_ARCH_X86
|
||||
#define MAYBE_STATIC
|
||||
#else
|
||||
#define MAYBE_STATIC static
|
||||
#endif
|
||||
|
||||
#endif /* STDDEF_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue