diff options
| author | Michal Simek <monstr@monstr.eu> | 2010-06-22 12:09:29 -0400 |
|---|---|---|
| committer | Michal Simek <monstr@monstr.eu> | 2010-08-04 04:32:22 -0400 |
| commit | 9814cc11e559d982874f6ebac2bc795e33cb0244 (patch) | |
| tree | 61c7226b24bedef5e9c517bd46b7b79fa373fa5c | |
| parent | da23355280d106b1160a0a07028838097b639f0b (diff) | |
microblaze: Use delay slot in syscall macros
Saving instruction with delay slot usage.
Signed-off-by: Michal Simek <monstr@monstr.eu>
| -rw-r--r-- | arch/microblaze/kernel/entry.S | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 0747e1d61d55..34100a526194 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
| @@ -411,10 +411,8 @@ C_ENTRY(_user_exception): | |||
| 411 | 411 | ||
| 412 | /* The syscall number is invalid, return an error. */ | 412 | /* The syscall number is invalid, return an error. */ |
| 413 | 5: | 413 | 5: |
| 414 | rtsd r15, 8; /* looks like a normal subroutine return */ | ||
| 414 | addi r3, r0, -ENOSYS; | 415 | addi r3, r0, -ENOSYS; |
| 415 | rtsd r15,8; /* looks like a normal subroutine return */ | ||
| 416 | or r0, r0, r0 | ||
| 417 | |||
| 418 | 416 | ||
| 419 | /* Entry point used to return from a syscall/trap */ | 417 | /* Entry point used to return from a syscall/trap */ |
| 420 | /* We re-enable BIP bit before state restore */ | 418 | /* We re-enable BIP bit before state restore */ |
| @@ -491,9 +489,8 @@ C_ENTRY(sys_fork_wrapper): | |||
| 491 | addik r7, r1, PTO /* Arg 2: parent context */ | 489 | addik r7, r1, PTO /* Arg 2: parent context */ |
| 492 | add r8. r0, r0 /* Arg 3: (unused) */ | 490 | add r8. r0, r0 /* Arg 3: (unused) */ |
| 493 | add r9, r0, r0; /* Arg 4: (unused) */ | 491 | add r9, r0, r0; /* Arg 4: (unused) */ |
| 494 | add r10, r0, r0; /* Arg 5: (unused) */ | ||
| 495 | brid do_fork /* Do real work (tail-call) */ | 492 | brid do_fork /* Do real work (tail-call) */ |
| 496 | nop; | 493 | add r10, r0, r0; /* Arg 5: (unused) */ |
| 497 | 494 | ||
| 498 | /* This the initial entry point for a new child thread, with an appropriate | 495 | /* This the initial entry point for a new child thread, with an appropriate |
| 499 | stack in place that makes it look the the child is in the middle of an | 496 | stack in place that makes it look the the child is in the middle of an |
| @@ -504,9 +501,8 @@ C_ENTRY(ret_from_fork): | |||
| 504 | bralid r15, schedule_tail; /* ...which is schedule_tail's arg */ | 501 | bralid r15, schedule_tail; /* ...which is schedule_tail's arg */ |
| 505 | add r3, r5, r0; /* switch_thread returns the prev task */ | 502 | add r3, r5, r0; /* switch_thread returns the prev task */ |
| 506 | /* ( in the delay slot ) */ | 503 | /* ( in the delay slot ) */ |
| 507 | add r3, r0, r0; /* Child's fork call should return 0. */ | ||
| 508 | brid ret_from_trap; /* Do normal trap return */ | 504 | brid ret_from_trap; /* Do normal trap return */ |
| 509 | nop; | 505 | add r3, r0, r0; /* Child's fork call should return 0. */ |
| 510 | 506 | ||
| 511 | C_ENTRY(sys_vfork): | 507 | C_ENTRY(sys_vfork): |
| 512 | brid microblaze_vfork /* Do real work (tail-call) */ | 508 | brid microblaze_vfork /* Do real work (tail-call) */ |
| @@ -518,21 +514,18 @@ C_ENTRY(sys_clone): | |||
| 518 | 1: addik r7, r1, PTO; /* Arg 2: parent context */ | 514 | 1: addik r7, r1, PTO; /* Arg 2: parent context */ |
| 519 | add r8, r0, r0; /* Arg 3: (unused) */ | 515 | add r8, r0, r0; /* Arg 3: (unused) */ |
| 520 | add r9, r0, r0; /* Arg 4: (unused) */ | 516 | add r9, r0, r0; /* Arg 4: (unused) */ |
| 521 | add r10, r0, r0; /* Arg 5: (unused) */ | ||
| 522 | brid do_fork /* Do real work (tail-call) */ | 517 | brid do_fork /* Do real work (tail-call) */ |
| 523 | nop; | 518 | add r10, r0, r0; /* Arg 5: (unused) */ |
| 524 | 519 | ||
| 525 | C_ENTRY(sys_execve): | 520 | C_ENTRY(sys_execve): |
| 526 | addik r8, r1, PTO; /* add user context as 4th arg */ | ||
| 527 | brid microblaze_execve; /* Do real work (tail-call).*/ | 521 | brid microblaze_execve; /* Do real work (tail-call).*/ |
| 528 | nop; | 522 | addik r8, r1, PTO; /* add user context as 4th arg */ |
| 529 | 523 | ||
| 530 | C_ENTRY(sys_rt_sigreturn_wrapper): | 524 | C_ENTRY(sys_rt_sigreturn_wrapper): |
| 531 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | 525 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ |
| 532 | swi r4, r1, PTO+PT_R4; | 526 | swi r4, r1, PTO+PT_R4; |
| 533 | addik r5, r1, PTO; /* add user context as 1st arg */ | ||
| 534 | brlid r15, sys_rt_sigreturn /* Do real work */ | 527 | brlid r15, sys_rt_sigreturn /* Do real work */ |
| 535 | nop; | 528 | addik r5, r1, PTO; /* add user context as 1st arg */ |
| 536 | lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | 529 | lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ |
| 537 | lwi r4, r1, PTO+PT_R4; | 530 | lwi r4, r1, PTO+PT_R4; |
| 538 | bri ret_from_trap /* fall through will not work here due to align */ | 531 | bri ret_from_trap /* fall through will not work here due to align */ |
| @@ -553,7 +546,6 @@ C_ENTRY(full_exception_trap): | |||
| 553 | * I tested it but there is a fault */ | 546 | * I tested it but there is a fault */ |
| 554 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 547 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
| 555 | addik r15, r0, ret_from_exc - 8 | 548 | addik r15, r0, ret_from_exc - 8 |
| 556 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | ||
| 557 | mfs r6, resr | 549 | mfs r6, resr |
| 558 | nop | 550 | nop |
| 559 | mfs r7, rfsr; /* save FSR */ | 551 | mfs r7, rfsr; /* save FSR */ |
| @@ -561,7 +553,7 @@ C_ENTRY(full_exception_trap): | |||
| 561 | mts rfsr, r0; /* Clear sticky fsr */ | 553 | mts rfsr, r0; /* Clear sticky fsr */ |
| 562 | nop | 554 | nop |
| 563 | rted r0, full_exception | 555 | rted r0, full_exception |
| 564 | nop | 556 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ |
| 565 | 557 | ||
| 566 | /* | 558 | /* |
| 567 | * Unaligned data trap. | 559 | * Unaligned data trap. |
| @@ -623,13 +615,12 @@ C_ENTRY(page_fault_data_trap): | |||
| 623 | tovirt(r1,r1) | 615 | tovirt(r1,r1) |
| 624 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 616 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
| 625 | addik r15, r0, ret_from_exc-8 | 617 | addik r15, r0, ret_from_exc-8 |
| 626 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | ||
| 627 | mfs r6, rear /* parameter unsigned long address */ | 618 | mfs r6, rear /* parameter unsigned long address */ |
| 628 | nop | 619 | nop |
| 629 | mfs r7, resr /* parameter unsigned long error_code */ | 620 | mfs r7, resr /* parameter unsigned long error_code */ |
| 630 | nop | 621 | nop |
| 631 | rted r0, do_page_fault | 622 | rted r0, do_page_fault |
| 632 | nop | 623 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ |
| 633 | 624 | ||
| 634 | C_ENTRY(page_fault_instr_trap): | 625 | C_ENTRY(page_fault_instr_trap): |
| 635 | SAVE_STATE /* Save registers.*/ | 626 | SAVE_STATE /* Save registers.*/ |
| @@ -638,11 +629,11 @@ C_ENTRY(page_fault_instr_trap): | |||
| 638 | tovirt(r1,r1) | 629 | tovirt(r1,r1) |
| 639 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 630 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
| 640 | addik r15, r0, ret_from_exc-8 | 631 | addik r15, r0, ret_from_exc-8 |
| 641 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | ||
| 642 | mfs r6, rear /* parameter unsigned long address */ | 632 | mfs r6, rear /* parameter unsigned long address */ |
| 643 | nop | 633 | nop |
| 644 | rted r0, do_page_fault | ||
| 645 | ori r7, r0, 0 /* parameter unsigned long error_code */ | 634 | ori r7, r0, 0 /* parameter unsigned long error_code */ |
| 635 | rted r0, do_page_fault | ||
| 636 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | ||
| 646 | 637 | ||
| 647 | /* Entry point used to return from an exception. */ | 638 | /* Entry point used to return from an exception. */ |
| 648 | C_ENTRY(ret_from_exc): | 639 | C_ENTRY(ret_from_exc): |
