[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/9] factor out PAE-specific bootstrap
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 4/9] factor out PAE-specific bootstrap |
Date: |
Sun, 12 Feb 2023 18:48:51 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Luca Dariz, le dim. 12 févr. 2023 18:28:13 +0100, a ecrit:
> * i386/intel/pmap.c: move it to pmap_bootstrap_pae()
> ---
> i386/intel/pmap.c | 72 ++++++++++++++++++++++++++---------------------
> 1 file changed, 40 insertions(+), 32 deletions(-)
>
> diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
> index 15577a09..470be744 100644
> --- a/i386/intel/pmap.c
> +++ b/i386/intel/pmap.c
> @@ -581,8 +581,46 @@ vm_offset_t pmap_map_bd(
> return(virt);
> }
>
> +#ifdef PAE
> +static void pmap_bootstrap_pae(void)
> +{
> + vm_offset_t addr;
> +
> +#ifdef __x86_64__
> +#ifdef MACH_HYP
> + kernel_pmap->user_l4base = NULL;
> + kernel_pmap->user_pdpbase = NULL;
> +#endif
> + kernel_pmap->l4base = (pt_entry_t*)phystokv(pmap_grab_page());
> + memset(kernel_pmap->l4base, 0, INTEL_PGBYTES);
> +#endif /* x86_64 */
> +
> + init_alloc_aligned(PDPNUM * INTEL_PGBYTES, &addr);
> + kernel_page_dir = (pt_entry_t*)phystokv(addr);
> +
> + kernel_pmap->pdpbase = (pt_entry_t*)phystokv(pmap_grab_page());
> + memset(kernel_pmap->pdpbase, 0, INTEL_PGBYTES);
> + for (int i = 0; i < PDPNUM; i++)
> + WRITE_PTE(&kernel_pmap->pdpbase[i],
> + pa_to_pte(_kvtophys((void *) kernel_page_dir
> + + i * INTEL_PGBYTES))
> + | INTEL_PTE_VALID
> +#if (defined(__x86_64__) && !defined(MACH_HYP)) ||
> defined(MACH_PV_PAGETABLES)
> + | INTEL_PTE_WRITE
> +#endif
> + );
> +
> +#ifdef __x86_64__
> + WRITE_PTE(&kernel_pmap->l4base[0],
> pa_to_pte(_kvtophys(kernel_pmap->pdpbase)) | INTEL_PTE_VALID |
> INTEL_PTE_WRITE);
> +#ifdef MACH_PV_PAGETABLES
> + pmap_set_page_readonly_init(kernel_pmap->l4base);
> +#endif
> +#endif /* x86_64 */
> +}
> +#endif /* PAE */
> +
> #ifdef MACH_PV_PAGETABLES
> -void pmap_bootstrap_xen()
> +static void pmap_bootstrap_xen(void)
> {
> /* We don't actually deal with the CR3 register content at all */
> hyp_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
> @@ -691,37 +729,7 @@ void pmap_bootstrap(void)
> /* Note: initial Xen mapping holds at least 512kB free mapped page.
> * We use that for directly building our linear mapping. */
> #if PAE
> - {
> - vm_offset_t addr;
> - init_alloc_aligned(PDPNUM * INTEL_PGBYTES, &addr);
> - kernel_page_dir = (pt_entry_t*)phystokv(addr);
> - }
> - kernel_pmap->pdpbase = (pt_entry_t*)phystokv(pmap_grab_page());
> - memset(kernel_pmap->pdpbase, 0, INTEL_PGBYTES);
> - {
> - int i;
> - for (i = 0; i < PDPNUM; i++)
> - WRITE_PTE(&kernel_pmap->pdpbase[i],
> - pa_to_pte(_kvtophys((void *) kernel_page_dir
> - + i * INTEL_PGBYTES))
> - | INTEL_PTE_VALID
> -#if (defined(__x86_64__) && !defined(MACH_HYP)) ||
> defined(MACH_PV_PAGETABLES)
> - | INTEL_PTE_WRITE
> -#endif
> - );
> - }
> -#ifdef __x86_64__
> -#ifdef MACH_HYP
> - kernel_pmap->user_l4base = NULL;
> - kernel_pmap->user_pdpbase = NULL;
> -#endif
> - kernel_pmap->l4base = (pt_entry_t*)phystokv(pmap_grab_page());
> - memset(kernel_pmap->l4base, 0, INTEL_PGBYTES);
> - WRITE_PTE(&kernel_pmap->l4base[0],
> pa_to_pte(_kvtophys(kernel_pmap->pdpbase)) | INTEL_PTE_VALID |
> INTEL_PTE_WRITE);
> -#ifdef MACH_PV_PAGETABLES
> - pmap_set_page_readonly_init(kernel_pmap->l4base);
> -#endif
> -#endif /* x86_64 */
> + pmap_bootstrap_pae();
> #else /* PAE */
> kernel_pmap->dirbase = kernel_page_dir =
> (pt_entry_t*)phystokv(pmap_grab_page());
> #endif /* PAE */
> --
> 2.30.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- Re: [PATCH 6/9] add more explicit names for user space virtual space limits, (continued)
- [PATCH 5/9] use L4 page table directly on x86_64 instead of short-circuiting to pdpbase, Luca Dariz, 2023/02/12
- [PATCH 1/9] prepare pmap helpers for full 64 bit memory map, Luca Dariz, 2023/02/12
- [PATCH 2/9] fix x86_64 asm for higher kernel addresses, Luca Dariz, 2023/02/12
- [PATCH 3/9] factor out xen-specific bootstrap, Luca Dariz, 2023/02/12
- [PATCH 4/9] factor out PAE-specific bootstrap, Luca Dariz, 2023/02/12
- Re: [PATCH 4/9] factor out PAE-specific bootstrap,
Samuel Thibault <=
- [PATCH 7/9] extend data types to hold a 64-bit address, Luca Dariz, 2023/02/12
- [PATCH 9/9] move kernel virtual address space to upper addresses, Luca Dariz, 2023/02/12
- [PATCH 8/9] separate initialization of kernel and user PTP tables, Luca Dariz, 2023/02/12
- Re: [PATCH 0/9 gnumach] move kernel vm map to high addresses on x86_64, Luca, 2023/02/12