[PATCH] D24987: [ELF] Use MaxPageSize for aligning PT_LOAD

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 13:21:06 PDT 2016


On 4 November 2016 at 20:06, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>
> From your reply in the other thread I am guessing that the problem is
>
> * The kernel needs some memory available at the low address.
> * If the kernel is loaded at 4k, there is only 4k available and that
> is not enough.

Correct. In fact the first 16 4K pages are set aside and unused
because there are (apparently) BIOSes that corrupt memory low physical
address memory across a suspend-resume cycle. So there's no low memory
available at all.

> If that is the case, it seems the correct fix is to just replace
>
> kernphys = CONSTANT (MAXPAGESIZE);
>
> with
>
> kernphys = 0x200000;
>
> or some other constant. You mentioned 640 kb, so maybe 0xa0000 would work too.

Well, there are (at least) two reasons for this:
1) The need for below-640k memory
2) Aligning the kernel phys addr with a large page mapping

I can certainly just set this to 0x200000 in the FreeBSD linker
script, I just want to make sure we're diverging from ld.bfd for a
good reason.


More information about the llvm-commits mailing list