Message ID | 1437580180-6405-24-git-send-email-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Hi Simon, On Wed, Jul 22, 2015 at 11:49 PM, Simon Glass <sjg@chromium.org> wrote: > When running as an EFI application we must skip relocation. Add support for > this in the x86 relocation code. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > Can we squash this patch into previous patch#5? [U-Boot,05/48] Add a way to skip relocation http://patchwork.ozlabs.org/patch/498649/ > arch/x86/lib/relocate.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c > index 1a62142..0839f59 100644 > --- a/arch/x86/lib/relocate.c > +++ b/arch/x86/lib/relocate.c > @@ -28,7 +28,8 @@ int copy_uboot_to_ram(void) > { > size_t len = (size_t)&__data_end - (size_t)&__text_start; > > - memcpy((void *)gd->relocaddr, (void *)&__text_start, len); > + if (!(gd->flags & GD_FLG_SKIP_RELOC)) > + memcpy((void *)gd->relocaddr, (void *)&__text_start, len); Can we just do in the function beginning, like in patch#5: if (gd->flags & GD_FLG_SKIP_RELOC) return 0; > > return 0; > } > @@ -38,7 +39,8 @@ int clear_bss(void) > ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; > size_t len = (size_t)&__bss_end - (size_t)&__bss_start; > > - memset((void *)dst_addr, 0x00, len); > + if (!(gd->flags & GD_FLG_SKIP_RELOC)) > + memset((void *)dst_addr, 0x00, len); > Ditto. > return 0; > } > @@ -58,6 +60,8 @@ int do_elf_reloc_fixups(void) > /* The size of the region of u-boot that runs out of RAM. */ > uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start; > > + if (gd->flags & GD_FLG_SKIP_RELOC) > + return 0; > if (re_src == re_end) > panic("No relocation data"); > > -- Regards, Bin
Hi Bin, On 23 July 2015 at 02:51, Bin Meng <bmeng.cn@gmail.com> wrote: > Hi Simon, > > On Wed, Jul 22, 2015 at 11:49 PM, Simon Glass <sjg@chromium.org> wrote: >> When running as an EFI application we must skip relocation. Add support for >> this in the x86 relocation code. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> > > Can we squash this patch into previous patch#5? That's generic code though so I would rather that the arch-specific implementations are in separate patches. > > [U-Boot,05/48] Add a way to skip relocation > http://patchwork.ozlabs.org/patch/498649/ > >> arch/x86/lib/relocate.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c >> index 1a62142..0839f59 100644 >> --- a/arch/x86/lib/relocate.c >> +++ b/arch/x86/lib/relocate.c >> @@ -28,7 +28,8 @@ int copy_uboot_to_ram(void) >> { >> size_t len = (size_t)&__data_end - (size_t)&__text_start; >> >> - memcpy((void *)gd->relocaddr, (void *)&__text_start, len); >> + if (!(gd->flags & GD_FLG_SKIP_RELOC)) >> + memcpy((void *)gd->relocaddr, (void *)&__text_start, len); > > Can we just do in the function beginning, like in patch#5: > > if (gd->flags & GD_FLG_SKIP_RELOC) > return 0; > >> >> return 0; >> } >> @@ -38,7 +39,8 @@ int clear_bss(void) >> ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; >> size_t len = (size_t)&__bss_end - (size_t)&__bss_start; >> >> - memset((void *)dst_addr, 0x00, len); >> + if (!(gd->flags & GD_FLG_SKIP_RELOC)) >> + memset((void *)dst_addr, 0x00, len); >> > > Ditto. > >> return 0; >> } >> @@ -58,6 +60,8 @@ int do_elf_reloc_fixups(void) >> /* The size of the region of u-boot that runs out of RAM. */ >> uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start; >> >> + if (gd->flags & GD_FLG_SKIP_RELOC) >> + return 0; >> if (re_src == re_end) >> panic("No relocation data"); >> >> -- > > Regards, > Bin Regards, Simon
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c index 1a62142..0839f59 100644 --- a/arch/x86/lib/relocate.c +++ b/arch/x86/lib/relocate.c @@ -28,7 +28,8 @@ int copy_uboot_to_ram(void) { size_t len = (size_t)&__data_end - (size_t)&__text_start; - memcpy((void *)gd->relocaddr, (void *)&__text_start, len); + if (!(gd->flags & GD_FLG_SKIP_RELOC)) + memcpy((void *)gd->relocaddr, (void *)&__text_start, len); return 0; } @@ -38,7 +39,8 @@ int clear_bss(void) ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; size_t len = (size_t)&__bss_end - (size_t)&__bss_start; - memset((void *)dst_addr, 0x00, len); + if (!(gd->flags & GD_FLG_SKIP_RELOC)) + memset((void *)dst_addr, 0x00, len); return 0; } @@ -58,6 +60,8 @@ int do_elf_reloc_fixups(void) /* The size of the region of u-boot that runs out of RAM. */ uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start; + if (gd->flags & GD_FLG_SKIP_RELOC) + return 0; if (re_src == re_end) panic("No relocation data");
When running as an EFI application we must skip relocation. Add support for this in the x86 relocation code. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/x86/lib/relocate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)