mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
a6714e720b
This is the order of the page table allocation, not the order of a PGD. Since its always hardwired to 0, simply drop it. Link: https://lkml.kernel.org/r/20220703141203.147893-9-rppt@kernel.org Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Acked-by: Dinh Nguyen <dinguyen@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Guo Ren <guoren@kernel.org> Cc: Helge Deller <deller@gmx.de> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Xuerui Wang <kernel@xen0n.name> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
74 lines
1.7 KiB
C
74 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2009 Wind River Systems Inc
|
|
* Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/sched.h>
|
|
|
|
#include <asm/cpuinfo.h>
|
|
|
|
/* pteaddr:
|
|
* ptbase | vpn* | zero
|
|
* 31-22 | 21-2 | 1-0
|
|
*
|
|
* *vpn is preserved on double fault
|
|
*
|
|
* tlbacc:
|
|
* IG |*flags| pfn
|
|
* 31-25|24-20 | 19-0
|
|
*
|
|
* *crwxg
|
|
*
|
|
* tlbmisc:
|
|
* resv |way |rd | we|pid |dbl|bad|perm|d
|
|
* 31-24 |23-20 |19 | 20|17-4|3 |2 |1 |0
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* Initialize a new pgd / pmd table with invalid pointers.
|
|
*/
|
|
static void pgd_init(pgd_t *pgd)
|
|
{
|
|
unsigned long *p = (unsigned long *) pgd;
|
|
int i;
|
|
|
|
for (i = 0; i < USER_PTRS_PER_PGD; i += 8) {
|
|
p[i + 0] = (unsigned long) invalid_pte_table;
|
|
p[i + 1] = (unsigned long) invalid_pte_table;
|
|
p[i + 2] = (unsigned long) invalid_pte_table;
|
|
p[i + 3] = (unsigned long) invalid_pte_table;
|
|
p[i + 4] = (unsigned long) invalid_pte_table;
|
|
p[i + 5] = (unsigned long) invalid_pte_table;
|
|
p[i + 6] = (unsigned long) invalid_pte_table;
|
|
p[i + 7] = (unsigned long) invalid_pte_table;
|
|
}
|
|
}
|
|
|
|
pgd_t *pgd_alloc(struct mm_struct *mm)
|
|
{
|
|
pgd_t *ret, *init;
|
|
|
|
ret = (pgd_t *) __get_free_page(GFP_KERNEL);
|
|
if (ret) {
|
|
init = pgd_offset(&init_mm, 0UL);
|
|
pgd_init(ret);
|
|
memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
|
|
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
void __init pagetable_init(void)
|
|
{
|
|
/* Initialize the entire pgd. */
|
|
pgd_init(swapper_pg_dir);
|
|
pgd_init(swapper_pg_dir + USER_PTRS_PER_PGD);
|
|
}
|