]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
parisc: Fix initial page table creation for boot
authorHelge Deller <deller@gmx.de>
Wed, 4 Mar 2026 21:24:18 +0000 (22:24 +0100)
committerHelge Deller <deller@gmx.de>
Fri, 6 Mar 2026 10:33:13 +0000 (11:33 +0100)
The KERNEL_INITIAL_ORDER value defines the initial size (usually 32 or
64 MB) of the page table during bootup. Up until now the whole area was
initialized with PTE entries, but there was no check if we filled too
many entries.  Change the code to fill up with so many entries that the
"_end" symbol can be reached by the kernel, but not more entries than
actually fit into the initial PTE tables.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # v6.0+
arch/parisc/kernel/head.S

index 96e0264ac96163618b5bbd38366cb7cedf793c7f..9188c8d87437048ab4f8f80343f20dc94792c8f3 100644 (file)
@@ -56,6 +56,7 @@ ENTRY(parisc_kernel_start)
 
        .import __bss_start,data
        .import __bss_stop,data
+       .import __end,data
 
        load32          PA(__bss_start),%r3
        load32          PA(__bss_stop),%r4
@@ -149,7 +150,11 @@ $cpu_ok:
         * everything ... it will get remapped correctly later */
        ldo             0+_PAGE_KERNEL_RWX(%r0),%r3 /* Hardwired 0 phys addr start */
        load32          (1<<(KERNEL_INITIAL_ORDER-PAGE_SHIFT)),%r11 /* PFN count */
-       load32          PA(pg0),%r1
+       load32          PA(_end),%r1
+       SHRREG          %r1,PAGE_SHIFT,%r1  /* %r1 is PFN count for _end symbol */
+       cmpb,<<,n       %r11,%r1,1f
+       copy            %r1,%r11        /* %r1 PFN count smaller than %r11 */
+1:     load32          PA(pg0),%r1
 
 $pgt_fill_loop:
        STREGM          %r3,ASM_PTE_ENTRY_SIZE(%r1)