diff options
-rw-r--r-- | arch/arc/include/asm/entry.h | 24 | ||||
-rw-r--r-- | arch/arc/kernel/entry.S | 56 | ||||
-rw-r--r-- | arch/arc/mm/tlbex.S | 8 |
3 files changed, 37 insertions, 51 deletions
diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h index df57611652e5..884081099f80 100644 --- a/arch/arc/include/asm/entry.h +++ b/arch/arc/include/asm/entry.h | |||
@@ -365,7 +365,7 @@ | |||
365 | * it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP). | 365 | * it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP). |
366 | * | 366 | * |
367 | * Before saving the full regfile - this reg is restored back, only | 367 | * Before saving the full regfile - this reg is restored back, only |
368 | * to be saved again on kernel mode stack, as part of ptregs. | 368 | * to be saved again on kernel mode stack, as part of pt_regs. |
369 | *-------------------------------------------------------------*/ | 369 | *-------------------------------------------------------------*/ |
370 | .macro EXCPN_PROLOG_FREEUP_REG reg | 370 | .macro EXCPN_PROLOG_FREEUP_REG reg |
371 | #ifdef CONFIG_SMP | 371 | #ifdef CONFIG_SMP |
@@ -384,6 +384,28 @@ | |||
384 | .endm | 384 | .endm |
385 | 385 | ||
386 | /*-------------------------------------------------------------- | 386 | /*-------------------------------------------------------------- |
387 | * Exception Entry prologue | ||
388 | * -Switches stack to K mode (if not already) | ||
389 | * -Saves the register file | ||
390 | * | ||
391 | * After this it is safe to call the "C" handlers | ||
392 | *-------------------------------------------------------------*/ | ||
393 | .macro EXCEPTION_PROLOGUE | ||
394 | |||
395 | /* Need at least 1 reg to code the early exception prologue */ | ||
396 | EXCPN_PROLOG_FREEUP_REG r9 | ||
397 | |||
398 | /* U/K mode at time of exception (stack not switched if already K) */ | ||
399 | lr r9, [erstatus] | ||
400 | |||
401 | /* ARC700 doesn't provide auto-stack switching */ | ||
402 | SWITCH_TO_KERNEL_STK | ||
403 | |||
404 | /* save the regfile */ | ||
405 | SAVE_ALL_SYS | ||
406 | .endm | ||
407 | |||
408 | /*-------------------------------------------------------------- | ||
387 | * Save all registers used by Exceptions (TLB Miss, Prot-V, Mem err etc) | 409 | * Save all registers used by Exceptions (TLB Miss, Prot-V, Mem err etc) |
388 | * Requires SP to be already switched to kernel mode Stack | 410 | * Requires SP to be already switched to kernel mode Stack |
389 | * sp points to the next free element on the stack at exit of this macro. | 411 | * sp points to the next free element on the stack at exit of this macro. |
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 1d7165156e17..059ca94e3df8 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S | |||
@@ -267,12 +267,7 @@ ARC_EXIT handle_interrupt_level1 | |||
267 | 267 | ||
268 | ARC_ENTRY instr_service | 268 | ARC_ENTRY instr_service |
269 | 269 | ||
270 | EXCPN_PROLOG_FREEUP_REG r9 | 270 | EXCEPTION_PROLOGUE |
271 | |||
272 | lr r9, [erstatus] | ||
273 | |||
274 | SWITCH_TO_KERNEL_STK | ||
275 | SAVE_ALL_SYS | ||
276 | 271 | ||
277 | lr r0, [efa] | 272 | lr r0, [efa] |
278 | mov r1, sp | 273 | mov r1, sp |
@@ -289,15 +284,13 @@ ARC_EXIT instr_service | |||
289 | 284 | ||
290 | ARC_ENTRY mem_service | 285 | ARC_ENTRY mem_service |
291 | 286 | ||
292 | EXCPN_PROLOG_FREEUP_REG r9 | 287 | EXCEPTION_PROLOGUE |
293 | |||
294 | lr r9, [erstatus] | ||
295 | |||
296 | SWITCH_TO_KERNEL_STK | ||
297 | SAVE_ALL_SYS | ||
298 | 288 | ||
299 | lr r0, [efa] | 289 | lr r0, [efa] |
300 | mov r1, sp | 290 | mov r1, sp |
291 | |||
292 | FAKE_RET_FROM_EXCPN r9 | ||
293 | |||
301 | bl do_memory_error | 294 | bl do_memory_error |
302 | b ret_from_exception | 295 | b ret_from_exception |
303 | ARC_EXIT mem_service | 296 | ARC_EXIT mem_service |
@@ -308,11 +301,7 @@ ARC_EXIT mem_service | |||
308 | 301 | ||
309 | ARC_ENTRY EV_MachineCheck | 302 | ARC_ENTRY EV_MachineCheck |
310 | 303 | ||
311 | EXCPN_PROLOG_FREEUP_REG r9 | 304 | EXCEPTION_PROLOGUE |
312 | lr r9, [erstatus] | ||
313 | |||
314 | SWITCH_TO_KERNEL_STK | ||
315 | SAVE_ALL_SYS | ||
316 | 305 | ||
317 | lr r2, [ecr] | 306 | lr r2, [ecr] |
318 | lr r0, [efa] | 307 | lr r0, [efa] |
@@ -342,13 +331,7 @@ ARC_EXIT EV_MachineCheck | |||
342 | 331 | ||
343 | ARC_ENTRY EV_TLBProtV | 332 | ARC_ENTRY EV_TLBProtV |
344 | 333 | ||
345 | EXCPN_PROLOG_FREEUP_REG r9 | 334 | EXCEPTION_PROLOGUE |
346 | |||
347 | ;Which mode (user/kernel) was the system in when Exception occured | ||
348 | lr r9, [erstatus] | ||
349 | |||
350 | SWITCH_TO_KERNEL_STK | ||
351 | SAVE_ALL_SYS | ||
352 | 335 | ||
353 | ;---------(3) Save some more regs----------------- | 336 | ;---------(3) Save some more regs----------------- |
354 | ; vineetg: Mar 6th: Random Seg Fault issue #1 | 337 | ; vineetg: Mar 6th: Random Seg Fault issue #1 |
@@ -406,12 +389,7 @@ ARC_EXIT EV_TLBProtV | |||
406 | ; --------------------------------------------- | 389 | ; --------------------------------------------- |
407 | ARC_ENTRY EV_PrivilegeV | 390 | ARC_ENTRY EV_PrivilegeV |
408 | 391 | ||
409 | EXCPN_PROLOG_FREEUP_REG r9 | 392 | EXCEPTION_PROLOGUE |
410 | |||
411 | lr r9, [erstatus] | ||
412 | |||
413 | SWITCH_TO_KERNEL_STK | ||
414 | SAVE_ALL_SYS | ||
415 | 393 | ||
416 | lr r0, [efa] | 394 | lr r0, [efa] |
417 | mov r1, sp | 395 | mov r1, sp |
@@ -427,14 +405,13 @@ ARC_EXIT EV_PrivilegeV | |||
427 | ; --------------------------------------------- | 405 | ; --------------------------------------------- |
428 | ARC_ENTRY EV_Extension | 406 | ARC_ENTRY EV_Extension |
429 | 407 | ||
430 | EXCPN_PROLOG_FREEUP_REG r9 | 408 | EXCEPTION_PROLOGUE |
431 | lr r9, [erstatus] | ||
432 | |||
433 | SWITCH_TO_KERNEL_STK | ||
434 | SAVE_ALL_SYS | ||
435 | 409 | ||
436 | lr r0, [efa] | 410 | lr r0, [efa] |
437 | mov r1, sp | 411 | mov r1, sp |
412 | |||
413 | FAKE_RET_FROM_EXCPN r9 | ||
414 | |||
438 | bl do_extension_fault | 415 | bl do_extension_fault |
439 | b ret_from_exception | 416 | b ret_from_exception |
440 | ARC_EXIT EV_Extension | 417 | ARC_EXIT EV_Extension |
@@ -526,14 +503,7 @@ trap_with_param: | |||
526 | 503 | ||
527 | ARC_ENTRY EV_Trap | 504 | ARC_ENTRY EV_Trap |
528 | 505 | ||
529 | ; Need at least 1 reg to code the early exception prolog | 506 | EXCEPTION_PROLOGUE |
530 | EXCPN_PROLOG_FREEUP_REG r9 | ||
531 | |||
532 | ;Which mode (user/kernel) was the system in when intr occured | ||
533 | lr r9, [erstatus] | ||
534 | |||
535 | SWITCH_TO_KERNEL_STK | ||
536 | SAVE_ALL_SYS | ||
537 | 507 | ||
538 | ;------- (4) What caused the Trap -------------- | 508 | ;------- (4) What caused the Trap -------------- |
539 | lr r12, [ecr] | 509 | lr r12, [ecr] |
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S index 5c5bb23001b0..fc34ebc103bc 100644 --- a/arch/arc/mm/tlbex.S +++ b/arch/arc/mm/tlbex.S | |||
@@ -371,13 +371,7 @@ do_slow_path_pf: | |||
371 | 371 | ||
372 | ; Slow path TLB Miss handled as a regular ARC Exception | 372 | ; Slow path TLB Miss handled as a regular ARC Exception |
373 | ; (stack switching / save the complete reg-file). | 373 | ; (stack switching / save the complete reg-file). |
374 | ; That requires freeing up r9 | 374 | EXCEPTION_PROLOGUE |
375 | EXCPN_PROLOG_FREEUP_REG r9 | ||
376 | |||
377 | lr r9, [erstatus] | ||
378 | |||
379 | SWITCH_TO_KERNEL_STK | ||
380 | SAVE_ALL_SYS | ||
381 | 375 | ||
382 | ; ------- setup args for Linux Page fault Hanlder --------- | 376 | ; ------- setup args for Linux Page fault Hanlder --------- |
383 | mov_s r0, sp | 377 | mov_s r0, sp |