Message ID | 1479587152-25065-27-git-send-email-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Bin Meng |
Headers | show |
Hi Simon, On Sun, Nov 20, 2016 at 4:25 AM, Simon Glass <sjg@chromium.org> wrote: > 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 Can you move these from commit message to a "TODO" part in the codes? > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: None > > common/board_r.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/common/board_r.c b/common/board_r.c > index d959ad3..02800ca 100644 > --- a/common/board_r.c > +++ b/common/board_r.c > @@ -974,6 +974,11 @@ init_fnc_t init_sequence_r[] = { > > void board_init_r(gd_t *new_gd, ulong dest_addr) > { > + /* Set up the new global data pointer */ > +#if CONFIG_IS_ENABLED(X86_64) > + arch_setup_gd(new_gd); > +#endif > + > #ifdef CONFIG_NEEDS_MANUAL_RELOC > int i; > #endif > -- Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Regards, Bin
diff --git a/common/board_r.c b/common/board_r.c index d959ad3..02800ca 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -974,6 +974,11 @@ init_fnc_t init_sequence_r[] = { void board_init_r(gd_t *new_gd, ulong dest_addr) { + /* Set up the new global data pointer */ +#if CONFIG_IS_ENABLED(X86_64) + arch_setup_gd(new_gd); +#endif + #ifdef CONFIG_NEEDS_MANUAL_RELOC int i; #endif
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 Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v2: None common/board_r.c | 5 +++++ 1 file changed, 5 insertions(+)