Commit f1a1f7a1 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/32s: Kernel space starts at TASK_SIZE

Kernel space starts at TASK_SIZE. Select kernel page table
when address is over TASK_SIZE.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/893425e32cd0a003539573b2d115e0ffa98bc26c.1593428200.git.christophe.leroy@csgroup.eu
parent b6be1bb7
...@@ -474,7 +474,7 @@ InstructionTLBMiss: ...@@ -474,7 +474,7 @@ InstructionTLBMiss:
/* Get PTE (linux-style) and check access */ /* Get PTE (linux-style) and check access */
mfspr r3,SPRN_IMISS mfspr r3,SPRN_IMISS
#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC)
lis r1,PAGE_OFFSET@h /* check if kernel address */ lis r1, TASK_SIZE@h /* check if kernel address */
cmplw 0,r1,r3 cmplw 0,r1,r3
#endif #endif
mfspr r2, SPRN_SPRG_PGDIR mfspr r2, SPRN_SPRG_PGDIR
...@@ -484,7 +484,7 @@ InstructionTLBMiss: ...@@ -484,7 +484,7 @@ InstructionTLBMiss:
li r1,_PAGE_PRESENT | _PAGE_EXEC li r1,_PAGE_PRESENT | _PAGE_EXEC
#endif #endif
#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC)
bge- 112f bgt- 112f
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
#endif #endif
...@@ -541,7 +541,7 @@ DataLoadTLBMiss: ...@@ -541,7 +541,7 @@ DataLoadTLBMiss:
*/ */
/* Get PTE (linux-style) and check access */ /* Get PTE (linux-style) and check access */
mfspr r3,SPRN_DMISS mfspr r3,SPRN_DMISS
lis r1,PAGE_OFFSET@h /* check if kernel address */ lis r1, TASK_SIZE@h /* check if kernel address */
cmplw 0,r1,r3 cmplw 0,r1,r3
mfspr r2, SPRN_SPRG_PGDIR mfspr r2, SPRN_SPRG_PGDIR
#ifdef CONFIG_SWAP #ifdef CONFIG_SWAP
...@@ -549,7 +549,7 @@ DataLoadTLBMiss: ...@@ -549,7 +549,7 @@ DataLoadTLBMiss:
#else #else
li r1, _PAGE_PRESENT li r1, _PAGE_PRESENT
#endif #endif
bge- 112f bgt- 112f
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
...@@ -621,7 +621,7 @@ DataStoreTLBMiss: ...@@ -621,7 +621,7 @@ DataStoreTLBMiss:
*/ */
/* Get PTE (linux-style) and check access */ /* Get PTE (linux-style) and check access */
mfspr r3,SPRN_DMISS mfspr r3,SPRN_DMISS
lis r1,PAGE_OFFSET@h /* check if kernel address */ lis r1, TASK_SIZE@h /* check if kernel address */
cmplw 0,r1,r3 cmplw 0,r1,r3
mfspr r2, SPRN_SPRG_PGDIR mfspr r2, SPRN_SPRG_PGDIR
#ifdef CONFIG_SWAP #ifdef CONFIG_SWAP
...@@ -629,7 +629,7 @@ DataStoreTLBMiss: ...@@ -629,7 +629,7 @@ DataStoreTLBMiss:
#else #else
li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT
#endif #endif
bge- 112f bgt- 112f
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
......
...@@ -62,7 +62,7 @@ _GLOBAL(hash_page) ...@@ -62,7 +62,7 @@ _GLOBAL(hash_page)
isync isync
#endif #endif
/* Get PTE (linux-style) and check access */ /* Get PTE (linux-style) and check access */
lis r0,KERNELBASE@h /* check if kernel address */ lis r0, TASK_SIZE@h /* check if kernel address */
cmplw 0,r4,r0 cmplw 0,r4,r0
ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment