[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/9] prepare pmap helpers for full 64 bit memory map
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 1/9] prepare pmap helpers for full 64 bit memory map |
Date: |
Sun, 12 Feb 2023 18:41:05 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Luca Dariz, le dim. 12 févr. 2023 18:28:10 +0100, a ecrit:
> * i386/intel/pmap.c: start walking the page table tree from the L4
> table instead of the PDP table in pmap_pte() and pmap_pde(),
> preparing for the kernel to run on high addresses.
> ---
> i386/intel/pmap.c | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
> index 615b0fff..9fe16368 100644
> --- a/i386/intel/pmap.c
> +++ b/i386/intel/pmap.c
> @@ -437,10 +437,22 @@ pmap_pde(const pmap_t pmap, vm_offset_t addr)
> if (pmap == kernel_pmap)
> addr = kvtolin(addr);
> #if PAE
> - page_dir = (pt_entry_t *) ptetokv(pmap->pdpbase[lin2pdpnum(addr)]);
> -#else
> + pt_entry_t *pdp_table, pdp, pde;
> +#ifdef __x86_64__
> + pdp = pmap->l4base[lin2l4num(addr)];
> + if ((pdp & INTEL_PTE_VALID) == 0)
> + return PT_ENTRY_NULL;
> + pdp_table = (pt_entry_t *) ptetokv(pdp);
> +#else /* __x86_64__ */
> + pdp_table = pmap->pdpbase;
> +#endif /* __x86_64__ */
> + pde = pdp_table[lin2pdpnum(addr)];
> + if ((pde & INTEL_PTE_VALID) == 0)
> + return PT_ENTRY_NULL;
> + page_dir = (pt_entry_t *) ptetokv(pde);
> +#else /* PAE */
> page_dir = pmap->dirbase;
> -#endif
> +#endif /* PAE */
> return &page_dir[lin2pdenum(addr)];
> }
>
> @@ -457,14 +469,20 @@ pmap_pte(const pmap_t pmap, vm_offset_t addr)
> pt_entry_t *ptp;
> pt_entry_t pte;
>
> -#if PAE
> +#ifdef __x86_64__
> + if (pmap->l4base == 0)
> + return(PT_ENTRY_NULL);
> +#elif PAE
> if (pmap->pdpbase == 0)
> return(PT_ENTRY_NULL);
> #else
> if (pmap->dirbase == 0)
> return(PT_ENTRY_NULL);
> #endif
> - pte = *pmap_pde(pmap, addr);
> + ptp = pmap_pde(pmap, addr);
> + if (ptp == 0)
> + return(PT_ENTRY_NULL);
> + pte = *ptp;
> if ((pte & INTEL_PTE_VALID) == 0)
> return(PT_ENTRY_NULL);
> ptp = (pt_entry_t *)ptetokv(pte);
> --
> 2.30.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- [PATCH 0/9 gnumach] move kernel vm map to high addresses on x86_64, Luca Dariz, 2023/02/12
- [PATCH 6/9] add more explicit names for user space virtual space limits, Luca Dariz, 2023/02/12
- [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
- Re: [PATCH 1/9] prepare pmap helpers for full 64 bit memory map,
Samuel Thibault <=
- [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
- [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