diff options
| -rw-r--r-- | arch/sparc/include/asm/ptrace.h | 4 | ||||
| -rw-r--r-- | arch/sparc/include/asm/thread_info_64.h | 16 | ||||
| -rw-r--r-- | arch/sparc/kernel/etrap_64.S | 8 | ||||
| -rw-r--r-- | arch/sparc/kernel/syscalls.S | 31 | ||||
| -rw-r--r-- | arch/sparc/kernel/traps_64.c | 2 |
5 files changed, 31 insertions, 30 deletions
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h index eeed804316bf..fd9c3f21cbf0 100644 --- a/arch/sparc/include/asm/ptrace.h +++ b/arch/sparc/include/asm/ptrace.h | |||
| @@ -202,7 +202,9 @@ struct global_reg_snapshot { | |||
| 202 | }; | 202 | }; |
| 203 | extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; | 203 | extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; |
| 204 | 204 | ||
| 205 | #define force_successful_syscall_return() set_thread_noerror(1) | 205 | #define force_successful_syscall_return() \ |
| 206 | do { current_thread_info()->syscall_noerror = 1; \ | ||
| 207 | } while (0) | ||
| 206 | #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) | 208 | #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) |
| 207 | #define instruction_pointer(regs) ((regs)->tpc) | 209 | #define instruction_pointer(regs) ((regs)->tpc) |
| 208 | #define instruction_pointer_set(regs, val) ((regs)->tpc = (val)) | 210 | #define instruction_pointer_set(regs, val) ((regs)->tpc = (val)) |
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index 8511e5fcc97d..cfa8c38fb9c8 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h | |||
| @@ -18,12 +18,10 @@ | |||
| 18 | #define TI_FLAG_CWP_SHIFT 40 | 18 | #define TI_FLAG_CWP_SHIFT 40 |
| 19 | #define TI_FLAG_BYTE_CURRENT_DS 3 | 19 | #define TI_FLAG_BYTE_CURRENT_DS 3 |
| 20 | #define TI_FLAG_CURRENT_DS_SHIFT 32 | 20 | #define TI_FLAG_CURRENT_DS_SHIFT 32 |
| 21 | #define TI_FLAG_BYTE_NOERROR 4 | 21 | #define TI_FLAG_BYTE_FPDEPTH 4 |
| 22 | #define TI_FLAG_BYTE_NOERROR_SHIFT 24 | 22 | #define TI_FLAG_FPDEPTH_SHIFT 24 |
| 23 | #define TI_FLAG_BYTE_FPDEPTH 5 | 23 | #define TI_FLAG_BYTE_WSAVED 5 |
| 24 | #define TI_FLAG_FPDEPTH_SHIFT 16 | 24 | #define TI_FLAG_WSAVED_SHIFT 16 |
| 25 | #define TI_FLAG_BYTE_WSAVED 6 | ||
| 26 | #define TI_FLAG_WSAVED_SHIFT 8 | ||
| 27 | 25 | ||
| 28 | #include <asm/page.h> | 26 | #include <asm/page.h> |
| 29 | 27 | ||
| @@ -49,7 +47,7 @@ struct thread_info { | |||
| 49 | struct exec_domain *exec_domain; | 47 | struct exec_domain *exec_domain; |
| 50 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 48 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
| 51 | __u8 new_child; | 49 | __u8 new_child; |
| 52 | __u8 __pad; | 50 | __u8 syscall_noerror; |
| 53 | __u16 cpu; | 51 | __u16 cpu; |
| 54 | 52 | ||
| 55 | unsigned long *utraps; | 53 | unsigned long *utraps; |
| @@ -79,7 +77,6 @@ struct thread_info { | |||
| 79 | #define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS) | 77 | #define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS) |
| 80 | #define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) | 78 | #define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) |
| 81 | #define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) | 79 | #define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) |
| 82 | #define TI_SYS_NOERROR (TI_FLAGS + TI_FLAG_BYTE_NOERROR) | ||
| 83 | #define TI_FPSAVED 0x00000010 | 80 | #define TI_FPSAVED 0x00000010 |
| 84 | #define TI_KSP 0x00000018 | 81 | #define TI_KSP 0x00000018 |
| 85 | #define TI_FAULT_ADDR 0x00000020 | 82 | #define TI_FAULT_ADDR 0x00000020 |
| @@ -87,6 +84,7 @@ struct thread_info { | |||
| 87 | #define TI_EXEC_DOMAIN 0x00000030 | 84 | #define TI_EXEC_DOMAIN 0x00000030 |
| 88 | #define TI_PRE_COUNT 0x00000038 | 85 | #define TI_PRE_COUNT 0x00000038 |
| 89 | #define TI_NEW_CHILD 0x0000003c | 86 | #define TI_NEW_CHILD 0x0000003c |
| 87 | #define TI_SYS_NOERROR 0x0000003d | ||
| 90 | #define TI_CPU 0x0000003e | 88 | #define TI_CPU 0x0000003e |
| 91 | #define TI_UTRAPS 0x00000040 | 89 | #define TI_UTRAPS 0x00000040 |
| 92 | #define TI_REG_WINDOW 0x00000048 | 90 | #define TI_REG_WINDOW 0x00000048 |
| @@ -157,8 +155,6 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
| 157 | #define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val)) | 155 | #define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val)) |
| 158 | #define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS]) | 156 | #define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS]) |
| 159 | #define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val)) | 157 | #define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val)) |
| 160 | #define get_thread_noerror() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR]) | ||
| 161 | #define set_thread_noerror(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR] = (val)) | ||
| 162 | #define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH]) | 158 | #define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH]) |
| 163 | #define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val)) | 159 | #define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val)) |
| 164 | #define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED]) | 160 | #define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED]) |
diff --git a/arch/sparc/kernel/etrap_64.S b/arch/sparc/kernel/etrap_64.S index 1276ca2567ba..786b185e6e3f 100644 --- a/arch/sparc/kernel/etrap_64.S +++ b/arch/sparc/kernel/etrap_64.S | |||
| @@ -92,10 +92,8 @@ etrap_save: save %g2, -STACK_BIAS, %sp | |||
| 92 | rdpr %wstate, %g2 | 92 | rdpr %wstate, %g2 |
| 93 | wrpr %g0, 0, %canrestore | 93 | wrpr %g0, 0, %canrestore |
| 94 | sll %g2, 3, %g2 | 94 | sll %g2, 3, %g2 |
| 95 | |||
| 96 | /* Set TI_SYS_FPDEPTH to 1 and clear TI_SYS_NOERROR. */ | ||
| 97 | mov 1, %l5 | 95 | mov 1, %l5 |
| 98 | sth %l5, [%l6 + TI_SYS_NOERROR] | 96 | stb %l5, [%l6 + TI_FPDEPTH] |
| 99 | 97 | ||
| 100 | wrpr %g3, 0, %otherwin | 98 | wrpr %g3, 0, %otherwin |
| 101 | wrpr %g2, 0, %wstate | 99 | wrpr %g2, 0, %wstate |
| @@ -154,9 +152,7 @@ etrap_save: save %g2, -STACK_BIAS, %sp | |||
| 154 | add %l6, TI_FPSAVED + 1, %l4 | 152 | add %l6, TI_FPSAVED + 1, %l4 |
| 155 | srl %l5, 1, %l3 | 153 | srl %l5, 1, %l3 |
| 156 | add %l5, 2, %l5 | 154 | add %l5, 2, %l5 |
| 157 | 155 | stb %l5, [%l6 + TI_FPDEPTH] | |
| 158 | /* Set TI_SYS_FPDEPTH to %l5 and clear TI_SYS_NOERROR. */ | ||
| 159 | sth %l5, [%l6 + TI_SYS_NOERROR] | ||
| 160 | ba,pt %xcc, 2b | 156 | ba,pt %xcc, 2b |
| 161 | stb %g0, [%l4 + %l3] | 157 | stb %g0, [%l4 + %l3] |
| 162 | nop | 158 | nop |
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index b0ac10306425..1d7e274f3f2b 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S | |||
| @@ -212,19 +212,24 @@ linux_sparc_syscall: | |||
| 212 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 212 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
| 213 | ret_sys_call: | 213 | ret_sys_call: |
| 214 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 | 214 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 |
| 215 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc | ||
| 215 | sra %o0, 0, %o0 | 216 | sra %o0, 0, %o0 |
| 216 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 | 217 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 |
| 217 | sllx %g2, 32, %g2 | 218 | sllx %g2, 32, %g2 |
| 218 | 219 | ||
| 220 | /* Check if force_successful_syscall_return() | ||
| 221 | * was invoked. | ||
| 222 | */ | ||
| 223 | ldub [%g6 + TI_SYS_NOERROR], %l2 | ||
| 224 | brnz,a,pn %l2, 80f | ||
| 225 | stb %g0, [%g6 + TI_SYS_NOERROR] | ||
| 226 | |||
| 219 | cmp %o0, -ERESTART_RESTARTBLOCK | 227 | cmp %o0, -ERESTART_RESTARTBLOCK |
| 220 | bgeu,pn %xcc, 1f | 228 | bgeu,pn %xcc, 1f |
| 221 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 | 229 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 |
| 222 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc | 230 | 80: |
| 223 | |||
| 224 | 2: | ||
| 225 | /* System call success, clear Carry condition code. */ | 231 | /* System call success, clear Carry condition code. */ |
| 226 | andn %g3, %g2, %g3 | 232 | andn %g3, %g2, %g3 |
| 227 | 3: | ||
| 228 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] | 233 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] |
| 229 | bne,pn %icc, linux_syscall_trace2 | 234 | bne,pn %icc, linux_syscall_trace2 |
| 230 | add %l1, 0x4, %l2 ! npc = npc+4 | 235 | add %l1, 0x4, %l2 ! npc = npc+4 |
| @@ -233,20 +238,20 @@ ret_sys_call: | |||
| 233 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] | 238 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] |
| 234 | 239 | ||
| 235 | 1: | 240 | 1: |
| 236 | /* Check if force_successful_syscall_return() | ||
| 237 | * was invoked. | ||
| 238 | */ | ||
| 239 | ldub [%g6 + TI_SYS_NOERROR], %l2 | ||
| 240 | brnz,pn %l2, 2b | ||
| 241 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc | ||
| 242 | /* System call failure, set Carry condition code. | 241 | /* System call failure, set Carry condition code. |
| 243 | * Also, get abs(errno) to return to the process. | 242 | * Also, get abs(errno) to return to the process. |
| 244 | */ | 243 | */ |
| 244 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 | ||
| 245 | sub %g0, %o0, %o0 | 245 | sub %g0, %o0, %o0 |
| 246 | or %g3, %g2, %g3 | ||
| 246 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 247 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
| 247 | ba,pt %xcc, 3b | 248 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] |
| 248 | or %g3, %g2, %g3 | 249 | bne,pn %icc, linux_syscall_trace2 |
| 250 | add %l1, 0x4, %l2 ! npc = npc+4 | ||
| 251 | stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] | ||
| 249 | 252 | ||
| 253 | b,pt %xcc, rtrap | ||
| 254 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] | ||
| 250 | linux_syscall_trace2: | 255 | linux_syscall_trace2: |
| 251 | call syscall_trace_leave | 256 | call syscall_trace_leave |
| 252 | add %sp, PTREGS_OFF, %o0 | 257 | add %sp, PTREGS_OFF, %o0 |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 82af591fe43f..fa1f1d375ffc 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
| @@ -2547,6 +2547,8 @@ void __init trap_init(void) | |||
| 2547 | TI_PRE_COUNT != offsetof(struct thread_info, | 2547 | TI_PRE_COUNT != offsetof(struct thread_info, |
| 2548 | preempt_count) || | 2548 | preempt_count) || |
| 2549 | TI_NEW_CHILD != offsetof(struct thread_info, new_child) || | 2549 | TI_NEW_CHILD != offsetof(struct thread_info, new_child) || |
| 2550 | TI_SYS_NOERROR != offsetof(struct thread_info, | ||
| 2551 | syscall_noerror) || | ||
| 2550 | TI_RESTART_BLOCK != offsetof(struct thread_info, | 2552 | TI_RESTART_BLOCK != offsetof(struct thread_info, |
| 2551 | restart_block) || | 2553 | restart_block) || |
| 2552 | TI_KUNA_REGS != offsetof(struct thread_info, | 2554 | TI_KUNA_REGS != offsetof(struct thread_info, |
