Source-Changes-D archive

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

Re: CVS commit: src/sys/arch/xen/x86



Le 08/08/2016 à 04:27, Cherry G. Mathew a écrit :
On 2 August 2016 at 19:51, Maxime Villard <maxv%netbsd.org@localhost <mailto:maxv%netbsd.org@localhost>> wrote:

    Module Name:    src
    Committed By:   maxv
    Date:           Tue Aug  2 14:21:53 UTC 2016

    Modified Files:
            src/sys/arch/xen/x86: x86_xpmap.c

    Log Message:
    Map the kernel text, rodata and data+bss independently on Xen, with
    respectively RX, R and RW.



Hi - wondering why you're getting more divergence from generic x86 -

We are not getting more divergence.

is there a way to do this (and the pg_nx stuff for eg:) without having to special case this in Xen ?

Not really. On a normal x86, when the kernel starts, the CPU does not yet have
64bit registers, paging, WP, NX, MSRs, etc. The kernel itself enables them,
and to do so, it uses temporary variables and a temporary page tree before
relocating itself at KERNBASE. All this needs to be done in assembly.

On Xen, however, when the kernel starts, the CPU already has 64bit registers,
paging etc, so the only thing the kernel has to do is creating its own page
table, and for that purpose it also uses temporary variables, such as pg_nx.
This time, it all can be done in C.

This initialization process is referred to as the locore, and even if machdep
and pmap can be shared between amd64<->i386<->PAE<->Xen, the locore cannot. When
it comes to pg_nx, we cannot use pmap_pg_nx, since it is part of the pmap, which
is shared and initialized later. For that same reason, we use nox_flag in
assembly in the amd64 and i386 locores.


Home | Main Index | Thread Index | Old Index