diff options
author | Jonas Bonn <jonas@southpole.se> | 2012-03-02 04:05:24 -0500 |
---|---|---|
committer | Jonas Bonn <jonas@southpole.se> | 2012-03-06 04:37:00 -0500 |
commit | 6cbe5e95267449ea0b79c0b049342409949da3ac (patch) | |
tree | 21243a6c899b27f67338d77a28ccbe0f473272bc /arch/openrisc/kernel/entry.S | |
parent | 2f099a280e92c259598d8ed8da82c7ec2dd49845 (diff) |
openrisc: sanitize use of orig_gpr11
The pt_regs struct had both a 'syscallno' field and an 'orig_gpr11' field
and it wasn't really clear how these were supposed to be used. This patch
removes the syscallno field altogether and makes orig_gpr11 work more
like other architectures: keep track of syscall number in progress or
hold -1 for non-syscall exceptions.
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Diffstat (limited to 'arch/openrisc/kernel/entry.S')
-rw-r--r-- | arch/openrisc/kernel/entry.S | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index d5f9c35a583f..6e61af8682b8 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S | |||
@@ -95,7 +95,6 @@ handler: ;\ | |||
95 | /* r1, EPCR, ESR a already saved */ ;\ | 95 | /* r1, EPCR, ESR a already saved */ ;\ |
96 | l.sw PT_GPR2(r1),r2 ;\ | 96 | l.sw PT_GPR2(r1),r2 ;\ |
97 | l.sw PT_GPR3(r1),r3 ;\ | 97 | l.sw PT_GPR3(r1),r3 ;\ |
98 | l.sw PT_ORIG_GPR11(r1),r11 ;\ | ||
99 | /* r4 already save */ ;\ | 98 | /* r4 already save */ ;\ |
100 | l.sw PT_GPR5(r1),r5 ;\ | 99 | l.sw PT_GPR5(r1),r5 ;\ |
101 | l.sw PT_GPR6(r1),r6 ;\ | 100 | l.sw PT_GPR6(r1),r6 ;\ |
@@ -125,7 +124,9 @@ handler: ;\ | |||
125 | /* r30 already save */ ;\ | 124 | /* r30 already save */ ;\ |
126 | /* l.sw PT_GPR30(r1),r30*/ ;\ | 125 | /* l.sw PT_GPR30(r1),r30*/ ;\ |
127 | l.sw PT_GPR31(r1),r31 ;\ | 126 | l.sw PT_GPR31(r1),r31 ;\ |
128 | l.sw PT_SYSCALLNO(r1),r0 | 127 | /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\ |
128 | l.addi r30,r0,-1 ;\ | ||
129 | l.sw PT_ORIG_GPR11(r1),r30 | ||
129 | 130 | ||
130 | #define UNHANDLED_EXCEPTION(handler,vector) \ | 131 | #define UNHANDLED_EXCEPTION(handler,vector) \ |
131 | .global handler ;\ | 132 | .global handler ;\ |
@@ -133,7 +134,6 @@ handler: ;\ | |||
133 | /* r1, EPCR, ESR already saved */ ;\ | 134 | /* r1, EPCR, ESR already saved */ ;\ |
134 | l.sw PT_GPR2(r1),r2 ;\ | 135 | l.sw PT_GPR2(r1),r2 ;\ |
135 | l.sw PT_GPR3(r1),r3 ;\ | 136 | l.sw PT_GPR3(r1),r3 ;\ |
136 | l.sw PT_ORIG_GPR11(r1),r11 ;\ | ||
137 | l.sw PT_GPR5(r1),r5 ;\ | 137 | l.sw PT_GPR5(r1),r5 ;\ |
138 | l.sw PT_GPR6(r1),r6 ;\ | 138 | l.sw PT_GPR6(r1),r6 ;\ |
139 | l.sw PT_GPR7(r1),r7 ;\ | 139 | l.sw PT_GPR7(r1),r7 ;\ |
@@ -162,7 +162,9 @@ handler: ;\ | |||
162 | /* r31 already saved */ ;\ | 162 | /* r31 already saved */ ;\ |
163 | l.sw PT_GPR30(r1),r30 ;\ | 163 | l.sw PT_GPR30(r1),r30 ;\ |
164 | /* l.sw PT_GPR31(r1),r31 */ ;\ | 164 | /* l.sw PT_GPR31(r1),r31 */ ;\ |
165 | l.sw PT_SYSCALLNO(r1),r0 ;\ | 165 | /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\ |
166 | l.addi r30,r0,-1 ;\ | ||
167 | l.sw PT_ORIG_GPR11(r1),r30 ;\ | ||
166 | l.addi r3,r1,0 ;\ | 168 | l.addi r3,r1,0 ;\ |
167 | /* r4 is exception EA */ ;\ | 169 | /* r4 is exception EA */ ;\ |
168 | l.addi r5,r0,vector ;\ | 170 | l.addi r5,r0,vector ;\ |
@@ -554,6 +556,7 @@ ENTRY(_sys_call_handler) | |||
554 | l.sw PT_GPR9(r1),r9 | 556 | l.sw PT_GPR9(r1),r9 |
555 | /* r10 already saved */ | 557 | /* r10 already saved */ |
556 | l.sw PT_GPR11(r1),r11 | 558 | l.sw PT_GPR11(r1),r11 |
559 | /* orig_gpr11 must be set for syscalls */ | ||
557 | l.sw PT_ORIG_GPR11(r1),r11 | 560 | l.sw PT_ORIG_GPR11(r1),r11 |
558 | /* r12,r13 already saved */ | 561 | /* r12,r13 already saved */ |
559 | 562 | ||
@@ -567,9 +570,6 @@ ENTRY(_sys_call_handler) | |||
567 | /* r30 is the only register we clobber in the fast path */ | 570 | /* r30 is the only register we clobber in the fast path */ |
568 | /* r30 already saved */ | 571 | /* r30 already saved */ |
569 | /* l.sw PT_GPR30(r1),r30 */ | 572 | /* l.sw PT_GPR30(r1),r30 */ |
570 | /* This is used by do_signal to determine whether to check for | ||
571 | * syscall restart or not */ | ||
572 | l.sw PT_SYSCALLNO(r1),r11 | ||
573 | 573 | ||
574 | _syscall_check_trace_enter: | 574 | _syscall_check_trace_enter: |
575 | /* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */ | 575 | /* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */ |
@@ -731,7 +731,7 @@ _syscall_trace_enter: | |||
731 | * so that we can do the syscall for real and return to the syscall | 731 | * so that we can do the syscall for real and return to the syscall |
732 | * hot path. | 732 | * hot path. |
733 | */ | 733 | */ |
734 | l.lwz r11,PT_SYSCALLNO(r1) | 734 | l.lwz r11,PT_GPR11(r1) |
735 | l.lwz r3,PT_GPR3(r1) | 735 | l.lwz r3,PT_GPR3(r1) |
736 | l.lwz r4,PT_GPR4(r1) | 736 | l.lwz r4,PT_GPR4(r1) |
737 | l.lwz r5,PT_GPR5(r1) | 737 | l.lwz r5,PT_GPR5(r1) |