bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "ELF-Symbols" tag for relocatable images


From: Rodrigo V. G.
Subject: Re: "ELF-Symbols" tag for relocatable images
Date: Thu, 23 Mar 2017 12:41:35 +0100

On 3/23/17, Andrei Borzenkov <address@hidden> wrote:
> 22.03.2017 22:23, Daniel Kiper пишет:
>> On Wed, Mar 22, 2017 at 04:43:35PM +0100, Rodrigo Vali??a Guti??rrez
>> wrote:
>>>>> They also may not match if virtual address != physical address, but as
>>>>> we do not establish any address translation when launching image, this
>>>>> probably is going to fail. Still would be good to have this assumption
>>>>> explicitly listed in multiboot2 manual.
>>>>
>>>> I think that we should state in multiboot2 spec that physical address
>>>> ==
>>>> virtual address in ELF.
>>>
>>> That may be true (that is going to fail) for entry point address, but
>>> please note that many kernels have the entry point and bootstrap code
>>> in a section/segment with virtual == physical, but then setup address
>>> translation and jump to another sections/segments with virtual !=
>>> physical addresses.
>>
>
> Do those kernels use actually use ELF envelope for bootstrap part? We do
> not really care what happens after payload is launched.
>
> Can you give links to such kernels?
>

Most kernels that I have seen (including hobby os) that use ELF, use
it also for the bootstrap part, in a single binary. Even in x86_64
they may use ELF64 with a bootstrap code in 32 bits included in a
section that enables long mode and jumps to other sections with 64 bit
code.
And the multiboot (1 or 2 or both) header may be included in one of
the first sections for easy detecting it, placed near the beginning of
the binary file.
The multiboot info tag structures about ELF may not be needed, though.

Some links:

Documentation that shows a linker script that loads at 0x00100000
physical and 0xC0100000 virtual:

http://wiki.osdev.org/Higher_Half_x86_Bare_Bones#linker.ld
https://littleosbook.github.io/#higher-half-linker-script

Documentation for linker scripts for x86_64 ELF64, where KERNEL_LMA
may be 0x0000000000100000 (1MB) and KERNEL_VMA may be
0xffffffff80000000 (-2GB):

http://wiki.osdev.org/Creating_a_64-bit_kernel#link.ld_2

Also Minix3: Its linker script loads at 0x00400000 physical and some
parts with the same virtual and other parts with 0xF0400000 virtual:

http://git.minix3.org/index.cgi?p=minix.git;a=blob;f=minix/kernel/arch/i386/kernel.lds;h=24c0c1f90e8ca2c0e0abb89b1c1385522f26e115;hb=HEAD



reply via email to

[Prev in Thread] Current Thread [Next in Thread]