mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 11:24:42 +00:00
sandbox: Set up global_data earlier
It is possible for U-Boot functions such as printf() to be called within state_init(). This can end up checking gd->flags (e.g. in putc()) before global_data is set up. Move the setup earlier to avoid this. This fixes the suppression of some debug output in memory allocation (when enabled). Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5b33660c54
commit
16b9c64caf
1 changed files with 3 additions and 2 deletions
|
@ -483,6 +483,9 @@ int sandbox_main(int argc, char *argv[])
|
|||
|
||||
text_base = os_find_text_base();
|
||||
|
||||
memset(&data, '\0', sizeof(data));
|
||||
gd = &data;
|
||||
|
||||
/*
|
||||
* This must be the first invocation of os_malloc() to have
|
||||
* state->ram_buf in the low 4 GiB.
|
||||
|
@ -501,8 +504,6 @@ int sandbox_main(int argc, char *argv[])
|
|||
os_exit(1);
|
||||
memcpy(os_argv, argv, size);
|
||||
|
||||
memset(&data, '\0', sizeof(data));
|
||||
gd = &data;
|
||||
gd->arch.text_base = text_base;
|
||||
|
||||
state = state_get_current();
|
||||
|
|
Loading…
Add table
Reference in a new issue