From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heinrich Schuchardt Date: Tue, 11 May 2021 21:03:16 +0200 Subject: [PATCH 1/1] sandbox: ensure that state->ram_buf is in low memory Message-ID: <20210511190316.29710-1-xypron.glpk@gmx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- arch/sandbox/cpu/start.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index e87365e800..1388dba895 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -439,6 +439,14 @@ int main(int argc, char *argv[]) int size; int ret; + /* + * 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. @@ -453,10 +461,6 @@ int main(int argc, char *argv[]) gd = &data; gd->arch.text_base = os_find_text_base(); - ret = state_init(); - if (ret) - goto err; - state = state_get_current(); if (os_parse_args(state, argc, argv)) return 1; -- 2.30.2