diff options
author | Michal Simek <monstr@monstr.eu> | 2010-06-22 10:22:01 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-08-04 04:22:52 -0400 |
commit | 06a54604a31f06715a393a4fdd099b03611cce10 (patch) | |
tree | a7428fe0382c3e0b25dfd7e0395c5db9392171ec /arch/microblaze/kernel | |
parent | 40eb0dc456dc3dd3f01da94e1f36085e956f20cc (diff) |
microblaze: Optimize SAVE_STATE macro
SAVE_STATE macro could be used for user_exception
or interrupt functions.
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r-- | arch/microblaze/kernel/entry.S | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 8f4a45e34a9e..aa611cd35042 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -513,9 +513,6 @@ C_ENTRY(sys_rt_sigreturn_wrapper): | |||
513 | tophys(r1,r1); \ | 513 | tophys(r1,r1); \ |
514 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | 514 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ |
515 | SAVE_REGS \ | 515 | SAVE_REGS \ |
516 | /* PC, before IRQ/trap - this is one instruction above */ \ | ||
517 | swi r17, r1, PTO+PT_PC; \ | ||
518 | \ | ||
519 | addi r11, r0, 1; /* Was in kernel-mode. */ \ | 516 | addi r11, r0, 1; /* Was in kernel-mode. */ \ |
520 | swi r11, r1, PTO+PT_MODE; \ | 517 | swi r11, r1, PTO+PT_MODE; \ |
521 | brid 2f; \ | 518 | brid 2f; \ |
@@ -528,20 +525,19 @@ C_ENTRY(sys_rt_sigreturn_wrapper): | |||
528 | tophys(r1,r1); \ | 525 | tophys(r1,r1); \ |
529 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ | 526 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\ |
530 | SAVE_REGS \ | 527 | SAVE_REGS \ |
531 | /* PC, before IRQ/trap - this is one instruction above FIXME*/ \ | ||
532 | swi r17, r1, PTO+PT_PC; \ | ||
533 | \ | ||
534 | swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \ | 528 | swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \ |
535 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | 529 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ |
536 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ | 530 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ |
537 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \ | 531 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
538 | tovirt(r1,r1) | ||
539 | 532 | ||
540 | C_ENTRY(full_exception_trap): | 533 | C_ENTRY(full_exception_trap): |
541 | /* adjust exception address for privileged instruction | 534 | /* adjust exception address for privileged instruction |
542 | * for finding where is it */ | 535 | * for finding where is it */ |
543 | addik r17, r17, -4 | 536 | addik r17, r17, -4 |
544 | SAVE_STATE /* Save registers */ | 537 | SAVE_STATE /* Save registers */ |
538 | /* PC, before IRQ/trap - this is one instruction above */ | ||
539 | swi r17, r1, PTO+PT_PC; | ||
540 | tovirt(r1,r1) | ||
545 | /* FIXME this can be store directly in PT_ESR reg. | 541 | /* FIXME this can be store directly in PT_ESR reg. |
546 | * I tested it but there is a fault */ | 542 | * I tested it but there is a fault */ |
547 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 543 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
@@ -581,6 +577,9 @@ C_ENTRY(unaligned_data_trap): | |||
581 | set_ee; | 577 | set_ee; |
582 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 578 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
583 | SAVE_STATE /* Save registers.*/ | 579 | SAVE_STATE /* Save registers.*/ |
580 | /* PC, before IRQ/trap - this is one instruction above */ | ||
581 | swi r17, r1, PTO+PT_PC; | ||
582 | tovirt(r1,r1) | ||
584 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 583 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
585 | addik r15, r0, ret_from_exc-8 | 584 | addik r15, r0, ret_from_exc-8 |
586 | mfs r3, resr /* ESR */ | 585 | mfs r3, resr /* ESR */ |
@@ -613,6 +612,9 @@ C_ENTRY(unaligned_data_trap): | |||
613 | /* data and intruction trap - which is choose is resolved int fault.c */ | 612 | /* data and intruction trap - which is choose is resolved int fault.c */ |
614 | C_ENTRY(page_fault_data_trap): | 613 | C_ENTRY(page_fault_data_trap): |
615 | SAVE_STATE /* Save registers.*/ | 614 | SAVE_STATE /* Save registers.*/ |
615 | /* PC, before IRQ/trap - this is one instruction above */ | ||
616 | swi r17, r1, PTO+PT_PC; | ||
617 | tovirt(r1,r1) | ||
616 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 618 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
617 | addik r15, r0, ret_from_exc-8 | 619 | addik r15, r0, ret_from_exc-8 |
618 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | 620 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ |
@@ -627,6 +629,9 @@ C_ENTRY(page_fault_data_trap): | |||
627 | 629 | ||
628 | C_ENTRY(page_fault_instr_trap): | 630 | C_ENTRY(page_fault_instr_trap): |
629 | SAVE_STATE /* Save registers.*/ | 631 | SAVE_STATE /* Save registers.*/ |
632 | /* PC, before IRQ/trap - this is one instruction above */ | ||
633 | swi r17, r1, PTO+PT_PC; | ||
634 | tovirt(r1,r1) | ||
630 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 635 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
631 | addik r15, r0, ret_from_exc-8 | 636 | addik r15, r0, ret_from_exc-8 |
632 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | 637 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ |