aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2013-02-14 10:16:49 -0500
committerJonas Bonn <jonas@southpole.se>2013-02-14 10:39:26 -0500
commita81252d75e14cc2cf0ee45078ef143562a0bc279 (patch)
tree7b8bb82ebd471c129788dade8667f4e4fae285dc
parent7f81ea7e28c3e4e5b762111dc676b24152f85a3a (diff)
openrisc: fix up vmalloc page table loading
vmalloc'ed pages are faulted into a process' page tables on demand. In order to facilitate this, do_page_fault needs to know whether it was called via a page fault exception or a TLB-miss exception. This patch adds a wrapper around the _x_page_fault_handler entry points that the TLB-miss exceptions can call into in order to have the relevant parameter set to satisfy do_page_fault. This fixes a bug and is "good enough" for now. That said, this whole handling of vmalloc needs to be audited for correctness at some point. Signed-off-by: Jonas Bonn <jonas@southpole.se>
-rw-r--r--arch/openrisc/kernel/entry.S14
-rw-r--r--arch/openrisc/kernel/head.S6
2 files changed, 14 insertions, 6 deletions
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index 5e5b30601bbf..3de971224cfc 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -201,12 +201,17 @@ EXCEPTION_ENTRY(_bus_fault_handler)
201 l.nop 201 l.nop
202 202
203/* ---[ 0x300: Data Page Fault exception ]------------------------------- */ 203/* ---[ 0x300: Data Page Fault exception ]------------------------------- */
204EXCEPTION_ENTRY(_dtlb_miss_page_fault_handler)
205 l.and r5,r5,r0
206 l.j 1f
207 l.nop
204 208
205EXCEPTION_ENTRY(_data_page_fault_handler) 209EXCEPTION_ENTRY(_data_page_fault_handler)
206 /* set up parameters for do_page_fault */ 210 /* set up parameters for do_page_fault */
211 l.ori r5,r0,0x300 // exception vector
2121:
207 l.addi r3,r1,0 // pt_regs 213 l.addi r3,r1,0 // pt_regs
208 /* r4 set be EXCEPTION_HANDLE */ // effective address of fault 214 /* r4 set be EXCEPTION_HANDLE */ // effective address of fault
209 l.ori r5,r0,0x300 // exception vector
210 215
211 /* 216 /*
212 * __PHX__: TODO 217 * __PHX__: TODO
@@ -276,12 +281,17 @@ EXCEPTION_ENTRY(_data_page_fault_handler)
276 l.nop 281 l.nop
277 282
278/* ---[ 0x400: Insn Page Fault exception ]------------------------------- */ 283/* ---[ 0x400: Insn Page Fault exception ]------------------------------- */
284EXCEPTION_ENTRY(_itlb_miss_page_fault_handler)
285 l.and r5,r5,r0
286 l.j 1f
287 l.nop
279 288
280EXCEPTION_ENTRY(_insn_page_fault_handler) 289EXCEPTION_ENTRY(_insn_page_fault_handler)
281 /* set up parameters for do_page_fault */ 290 /* set up parameters for do_page_fault */
291 l.ori r5,r0,0x400 // exception vector
2921:
282 l.addi r3,r1,0 // pt_regs 293 l.addi r3,r1,0 // pt_regs
283 /* r4 set be EXCEPTION_HANDLE */ // effective address of fault 294 /* r4 set be EXCEPTION_HANDLE */ // effective address of fault
284 l.ori r5,r0,0x400 // exception vector
285 l.ori r6,r0,0x0 // !write access 295 l.ori r6,r0,0x0 // !write access
286 296
287 /* call fault.c handler in or32/mm/fault.c */ 297 /* call fault.c handler in or32/mm/fault.c */
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index 46aa940ebd20..b357e7f79aca 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -1069,8 +1069,7 @@ d_pte_not_present:
1069 EXCEPTION_LOAD_GPR4 1069 EXCEPTION_LOAD_GPR4
1070 EXCEPTION_LOAD_GPR5 1070 EXCEPTION_LOAD_GPR5
1071 EXCEPTION_LOAD_GPR6 1071 EXCEPTION_LOAD_GPR6
1072 l.j _dispatch_do_dpage_fault 1072 EXCEPTION_HANDLE(_dtlb_miss_page_fault_handler)
1073 l.nop
1074 1073
1075/* ==============================================[ ITLB miss handler ]=== */ 1074/* ==============================================[ ITLB miss handler ]=== */
1076ENTRY(itlb_miss_handler) 1075ENTRY(itlb_miss_handler)
@@ -1192,8 +1191,7 @@ i_pte_not_present:
1192 EXCEPTION_LOAD_GPR4 1191 EXCEPTION_LOAD_GPR4
1193 EXCEPTION_LOAD_GPR5 1192 EXCEPTION_LOAD_GPR5
1194 EXCEPTION_LOAD_GPR6 1193 EXCEPTION_LOAD_GPR6
1195 l.j _dispatch_do_ipage_fault 1194 EXCEPTION_HANDLE(_itlb_miss_page_fault_handler)
1196 l.nop
1197 1195
1198/* ==============================================[ boot tlb handlers ]=== */ 1196/* ==============================================[ boot tlb handlers ]=== */
1199 1197