]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: ensure that state->ram_buf is in low memory
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 11 May 2021 19:03:16 +0000 (21:03 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 6 Jul 2021 16:38:03 +0000 (10:38 -0600)
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>
arch/sandbox/cpu/start.c

index 63b086dff801c7bafb7c37db8f2b2121a617905c..ad17e17c59ec5774d8fc49bfd1d1476d1b472747 100644 (file)
@@ -453,6 +453,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;