Commit fb92308b983d54f6275ae0ced0e6930dfcc5bdec
Committed by
Bin Meng
1 parent
4acff45247
Exists in
smarc_8mq_lf_v2020.04
and in
22 other branches
x86: board_r: Set the global data pointer after relocation
Since 'gd' is just a normal variable on 64-bit x86, it is relocated by the time we get to board_init_r(). The old 'gd' variable is passed in as parameter to board_init_r(), presumably for this situation. Assign it on 64-bit x86 so that gd points to the correct data. Options to improve this: - Make gd a fixed register and remove the board_init_r() parameter - Make all archs use this board_init_r() parameter The second has a TODO in the code. The first has a TODO in a future commit ('x86: Support global_data on x86_64') Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Showing 1 changed file with 10 additions and 0 deletions Side-by-side Diff
common/board_r.c
... | ... | @@ -947,6 +947,16 @@ |
947 | 947 | |
948 | 948 | void board_init_r(gd_t *new_gd, ulong dest_addr) |
949 | 949 | { |
950 | + /* | |
951 | + * Set up the new global data pointer. So far only x86 does this | |
952 | + * here. | |
953 | + * TODO(sjg@chromium.org): Consider doing this for all archs, or | |
954 | + * dropping the new_gd parameter. | |
955 | + */ | |
956 | +#if CONFIG_IS_ENABLED(X86_64) | |
957 | + arch_setup_gd(new_gd); | |
958 | +#endif | |
959 | + | |
950 | 960 | #ifdef CONFIG_NEEDS_MANUAL_RELOC |
951 | 961 | int i; |
952 | 962 | #endif |