From: Andi Kleen cris works (thanks to Mikael Starvik) Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton --- 25-akpm/arch/cris/arch-v10/mm/fault.c | 2 +- 25-akpm/arch/cris/arch-v10/mm/init.c | 4 ++-- 25-akpm/arch/cris/arch-v10/mm/tlb.c | 2 +- 25-akpm/arch/cris/mm/fault.c | 8 ++++---- 25-akpm/arch/cris/mm/ioremap.c | 2 +- 25-akpm/include/asm-cris/mmu_context.h | 4 ++-- 25-akpm/include/asm-cris/page.h | 1 + 25-akpm/include/asm-cris/pgalloc.h | 6 ++++-- 25-akpm/include/asm-cris/pgtable.h | 10 ++++------ 9 files changed, 20 insertions(+), 19 deletions(-) diff -puN arch/cris/arch-v10/mm/fault.c~4level-architecture-changes-for-cris arch/cris/arch-v10/mm/fault.c --- 25/arch/cris/arch-v10/mm/fault.c~4level-architecture-changes-for-cris 2004-11-11 01:13:25.416344056 -0800 +++ 25-akpm/arch/cris/arch-v10/mm/fault.c 2004-11-11 01:13:25.545324448 -0800 @@ -24,7 +24,7 @@ #define D(x) #endif -extern volatile pgd_t *current_pgd; +extern volatile pml4_t *current_pml4; extern const struct exception_table_entry *search_exception_tables(unsigned long addr); diff -puN arch/cris/arch-v10/mm/init.c~4level-architecture-changes-for-cris arch/cris/arch-v10/mm/init.c --- 25/arch/cris/arch-v10/mm/init.c~4level-architecture-changes-for-cris 2004-11-11 01:13:25.417343904 -0800 +++ 25-akpm/arch/cris/arch-v10/mm/init.c 2004-11-11 01:13:25.546324296 -0800 @@ -37,12 +37,12 @@ paging_init(void) for(i = 0; i < PTRS_PER_PGD; i++) swapper_pg_dir[i] = __pgd(0); - /* make sure the current pgd table points to something sane + /* make sure the current pml4 table points to something sane * (even if it is most probably not used until the next * switch_mm) */ - current_pgd = init_mm.pgd; + current_pml4 = init_mm.pml4; /* initialise the TLB (tlb.c) */ diff -puN arch/cris/arch-v10/mm/tlb.c~4level-architecture-changes-for-cris arch/cris/arch-v10/mm/tlb.c --- 25/arch/cris/arch-v10/mm/tlb.c~4level-architecture-changes-for-cris 2004-11-11 01:13:25.419343600 -0800 +++ 25-akpm/arch/cris/arch-v10/mm/tlb.c 2004-11-11 01:13:25.547324144 -0800 @@ -237,7 +237,7 @@ switch_mm(struct mm_struct *prev, struct * the pgd. */ - current_pgd = next->pgd; + current_pml4 = next->pml4; /* switch context in the MMU */ diff -puN arch/cris/mm/fault.c~4level-architecture-changes-for-cris arch/cris/mm/fault.c --- 25/arch/cris/mm/fault.c~4level-architecture-changes-for-cris 2004-11-11 01:13:25.420343448 -0800 +++ 25-akpm/arch/cris/mm/fault.c 2004-11-11 01:13:25.548323992 -0800 @@ -118,7 +118,7 @@ extern void die_if_kernel(const char *, /* current active page directory */ -volatile pgd_t *current_pgd; +volatile pml4_t *current_pml4; /* * This routine handles page faults. It determines the address, @@ -337,7 +337,7 @@ vmalloc_fault: * Synchronize this task's top level page-table * with the 'reference' page table. * - * Use current_pgd instead of tsk->active_mm->pgd + * Use current_pml4 instead of tsk->active_mm->pgd * since the latter might be unavailable if this * code is executed in a misfortunately run irq * (like inside schedule() between switch_mm and @@ -349,8 +349,8 @@ vmalloc_fault: pmd_t *pmd, *pmd_k; pte_t *pte_k; - pgd = (pgd_t *)current_pgd + offset; - pgd_k = init_mm.pgd + offset; + pgd = (pgd_t *)current_pml4 + offset; + pgd_k = ((pgd_t *)(init_mm.pml4)) + offset; /* Since we're two-level, we don't need to do both * set_pgd and set_pmd (they do the same thing). If diff -puN arch/cris/mm/ioremap.c~4level-architecture-changes-for-cris arch/cris/mm/ioremap.c --- 25/arch/cris/mm/ioremap.c~4level-architecture-changes-for-cris 2004-11-11 01:13:25.421343296 -0800 +++ 25-akpm/arch/cris/mm/ioremap.c 2004-11-11 01:13:25.548323992 -0800 @@ -71,7 +71,7 @@ static int remap_area_pages(unsigned lon unsigned long end = address + size; phys_addr -= address; - dir = pgd_offset(&init_mm, address); + dir = pml4_pgd_offset(pml4_offset(&init_mm, address), address); flush_cache_all(); if (address >= end) BUG(); diff -puN include/asm-cris/mmu_context.h~4level-architecture-changes-for-cris include/asm-cris/mmu_context.h --- 25/include/asm-cris/mmu_context.h~4level-architecture-changes-for-cris 2004-11-11 01:13:25.537325664 -0800 +++ 25-akpm/include/asm-cris/mmu_context.h 2004-11-11 01:13:25.548323992 -0800 @@ -11,11 +11,11 @@ extern void switch_mm(struct mm_struct * #define activate_mm(prev,next) switch_mm((prev),(next),NULL) -/* current active pgd - this is similar to other processors pgd +/* current active pml4 - this is similar to other processors pgd * registers like cr3 on the i386 */ -extern volatile pgd_t *current_pgd; /* defined in arch/cris/mm/fault.c */ +extern volatile pml4_t *current_pml4; /* defined in arch/cris/mm/fault.c */ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { diff -puN include/asm-cris/page.h~4level-architecture-changes-for-cris include/asm-cris/page.h --- 25/include/asm-cris/page.h~4level-architecture-changes-for-cris 2004-11-11 01:13:25.539325360 -0800 +++ 25-akpm/include/asm-cris/page.h 2004-11-11 01:13:25.549323840 -0800 @@ -95,6 +95,7 @@ static inline int get_order(unsigned lon #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) +#include #endif /* __KERNEL__ */ diff -puN include/asm-cris/pgalloc.h~4level-architecture-changes-for-cris include/asm-cris/pgalloc.h --- 25/include/asm-cris/pgalloc.h~4level-architecture-changes-for-cris 2004-11-11 01:13:25.540325208 -0800 +++ 25-akpm/include/asm-cris/pgalloc.h 2004-11-11 01:13:25.550323688 -0800 @@ -12,9 +12,9 @@ * Allocate and free page tables. */ -extern inline pgd_t *pgd_alloc (struct mm_struct *mm) +extern inline pgd_t *__pgd_alloc (struct mm_struct *mm, pml4_t *pml4, unsigned long address) { - return (pgd_t *)get_zeroed_page(GFP_KERNEL); + return (pgd_t *)get_zeroed_page(GFP_KERNEL); } extern inline void pgd_free (pgd_t *pgd) @@ -64,4 +64,6 @@ extern inline void pte_free(struct page #define check_pgt_cache() do { } while (0) +#include + #endif diff -puN include/asm-cris/pgtable.h~4level-architecture-changes-for-cris include/asm-cris/pgtable.h --- 25/include/asm-cris/pgtable.h~4level-architecture-changes-for-cris 2004-11-11 01:13:25.542324904 -0800 +++ 25-akpm/include/asm-cris/pgtable.h 2004-11-11 01:13:25.551323536 -0800 @@ -272,12 +272,7 @@ extern inline void pmd_set(pmd_t * pmdp, /* to find an entry in a page-table-directory. */ #define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) - -/* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + pgd_index(address); -} +#define pgd_index_k(addr) pgd_index(addr) /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) @@ -344,5 +339,8 @@ extern inline void update_mmu_cache(stru #define pte_to_pgoff(x) (pte_val(x) >> 6) #define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) +#include +#include + #endif /* __ASSEMBLY__ */ #endif /* _CRIS_PGTABLE_H */ _