Re: [PATCH v2] x86, realmode: explicitly set entry via command line
From: Borislav Petkov
Date: Wed Sep 25 2019 - 13:10:27 EST
On Wed, Sep 25, 2019 at 09:35:24AM -0700, Nick Desaulniers wrote:
> Thanks for the consideration Boris. So IIUC if the preceding sections
> are larger than 0x1000 altogether, setting the entry there will be
> wrong?
Well, I spent some time this morning grepping to find out whether PA
0x1000 was magical but didn't find anything. Perhaps hpa can refresh my
memory...
> Currently, .text looks like it's currently at 0x1000 for a defconfig,
> and I assume that could move in the case I stated above?
Yes, I think we shouldn't hardcode.
> $ readelf -S arch/x86/realmode/rm/realmode.elf | grep text
> [ 3] .text PROGBITS 00001000 201000 000f51 00 AX
> 0 0 4096
> ...
>
> In that case, it seems that maybe I should set the ENTRY in the linker
> script as:
> diff --git a/arch/x86/realmode/rm/realmode.lds.S
> b/arch/x86/realmode/rm/realmode.lds.S
> index 3bb980800c58..64d135d1ee63 100644
> --- a/arch/x86/realmode/rm/realmode.lds.S
> +++ b/arch/x86/realmode/rm/realmode.lds.S
> @@ -11,6 +11,7 @@
>
> OUTPUT_FORMAT("elf32-i386")
> OUTPUT_ARCH(i386)
> +ENTRY(pa_text_start)
Well, looking at arch/x86/boot/setup.ld, it does do:
ENTRY(_start)
for the global _start symbol in .../boot/header.S.
So you doing the respective thing in that linker script would make
sense...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette