We want to rework how set_pXd() behaves for generic compile-time folded
page tables by disallowing its use and triggering a compile-time error
when it is used improperly, ensuring that the actual first-level
set_pXd() function is used instead.

Therefore, replace set_pgd() with set_pud() to setup first-level pgtable
in case of X86_PAE.

There should be no functional change.

Signed-off-by: Yeoreum Yun <[email protected]>
---
 arch/x86/mm/init_32.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 0908c44d51e6f..690afa27a631b 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -70,19 +70,17 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
        pud_t *pud;
        pmd_t *pmd_table;
 
+       p4d = p4d_offset(pgd, 0);
+       pud = pud_offset(p4d, 0);
 #ifdef CONFIG_X86_PAE
-       if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
+       if (!(pud_val(*pud) & _PAGE_PRESENT)) {
                pmd_table = (pmd_t *)alloc_low_page();
-               set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
-               p4d = p4d_offset(pgd, 0);
-               pud = pud_offset(p4d, 0);
+               set_pud(pud, __pud(__pa(pmd_table) | _PAGE_PRESENT));
                BUG_ON(pmd_table != pmd_offset(pud, 0));
 
                return pmd_table;
        }
 #endif
-       p4d = p4d_offset(pgd, 0);
-       pud = pud_offset(p4d, 0);
        pmd_table = pmd_offset(pud, 0);
 
        return pmd_table;
-- 
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}


Reply via email to