summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-05-11 21:03:16 +0200
committerSimon Glass <sjg@chromium.org>2021-07-06 10:38:03 -0600
commit3beba4ad34649e053b97c5a61cd7de55bc718866 (patch)
tree73b52805b973ffe34fde19d63204b6a89426a12d /arch
parentb953ec2bca1ebe059366e870eb4bec5e7af9c36b (diff)
sandbox: ensure that state->ram_buf is in low memory
Addresses in state->ram_buf must be in the low 4 GiB of the address space. Otherwise we cannot correctly fill SMBIOS tables. This shows up in warnings like: WARNING: SMBIOS table_address overflow 7f752735e020 Ensure that state->ram_buf is initialized by the first invocation of os_malloc(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/cpu/start.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 63b086dff8..ad17e17c59 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -454,6 +454,14 @@ int main(int argc, char *argv[])
text_base = os_find_text_base();
/*
+ * This must be the first invocation of os_malloc() to have
+ * state->ram_buf in the low 4 GiB.
+ */
+ ret = state_init();
+ if (ret)
+ goto err;
+
+ /*
* Copy argv[] so that we can pass the arguments in the original
* sequence when resetting the sandbox.
*/
@@ -467,10 +475,6 @@ int main(int argc, char *argv[])
gd = &data;
gd->arch.text_base = text_base;
- ret = state_init();
- if (ret)
- goto err;
-
state = state_get_current();
if (os_parse_args(state, argc, argv))
return 1;