aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-07-24 22:36:26 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-24 22:36:26 -0400
commitdb7d9a4eb700be766cc9f29241483dbb1e748832 (patch)
tree48848384df15d9404ceab05867d7f4ef6b1a4bbe /include
parentcdd5186f753b23ab51f86679bdc4cc698ab0b893 (diff)
[SPARC64]: Move syscall success and newchild state out of thread flags.
These two bits were accesses non-atomically from assembler code. So, in order to eliminate any potential races resulting from that, move these pieces of state into two bytes elsewhere in struct thread_info. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc64/ptrace.h5
-rw-r--r--include/asm-sparc64/system.h11
-rw-r--r--include/asm-sparc64/thread_info.h12
3 files changed, 15 insertions, 13 deletions
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index 2d2b5a113d24..6194f771e9fc 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -94,8 +94,9 @@ struct sparc_trapf {
94#define STACKFRAME32_SZ sizeof(struct sparc_stackf32) 94#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
95 95
96#ifdef __KERNEL__ 96#ifdef __KERNEL__
97#define force_successful_syscall_return() \ 97#define force_successful_syscall_return() \
98 set_thread_flag(TIF_SYSCALL_SUCCESS) 98do { current_thread_info()->syscall_noerror = 1; \
99} while (0)
99#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) 100#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
100#define instruction_pointer(regs) ((regs)->tpc) 101#define instruction_pointer(regs) ((regs)->tpc)
101#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index f9be2c5b4dc9..ee4bdfc6b88f 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -190,24 +190,23 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
190 "wrpr %%g1, %%cwp\n\t" \ 190 "wrpr %%g1, %%cwp\n\t" \
191 "ldx [%%g6 + %3], %%o6\n\t" \ 191 "ldx [%%g6 + %3], %%o6\n\t" \
192 "ldub [%%g6 + %2], %%o5\n\t" \ 192 "ldub [%%g6 + %2], %%o5\n\t" \
193 "ldx [%%g6 + %4], %%o7\n\t" \ 193 "ldub [%%g6 + %4], %%o7\n\t" \
194 "mov %%g6, %%l2\n\t" \ 194 "mov %%g6, %%l2\n\t" \
195 "wrpr %%o5, 0x0, %%wstate\n\t" \ 195 "wrpr %%o5, 0x0, %%wstate\n\t" \
196 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 196 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
197 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 197 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
198 "wrpr %%g0, 0x94, %%pstate\n\t" \ 198 "wrpr %%g0, 0x94, %%pstate\n\t" \
199 "mov %%l2, %%g6\n\t" \ 199 "mov %%l2, %%g6\n\t" \
200 "ldx [%%g6 + %7], %%g4\n\t" \ 200 "ldx [%%g6 + %6], %%g4\n\t" \
201 "wrpr %%g0, 0x96, %%pstate\n\t" \ 201 "wrpr %%g0, 0x96, %%pstate\n\t" \
202 "andcc %%o7, %6, %%g0\n\t" \ 202 "brz,pt %%o7, 1f\n\t" \
203 "beq,pt %%icc, 1f\n\t" \
204 " mov %%g7, %0\n\t" \ 203 " mov %%g7, %0\n\t" \
205 "b,a ret_from_syscall\n\t" \ 204 "b,a ret_from_syscall\n\t" \
206 "1:\n\t" \ 205 "1:\n\t" \
207 : "=&r" (last) \ 206 : "=&r" (last) \
208 : "0" (next->thread_info), \ 207 : "0" (next->thread_info), \
209 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_FLAGS), "i" (TI_CWP), \ 208 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \
210 "i" (_TIF_NEWCHILD), "i" (TI_TASK) \ 209 "i" (TI_CWP), "i" (TI_TASK) \
211 : "cc", \ 210 : "cc", \
212 "g1", "g2", "g3", "g7", \ 211 "g1", "g2", "g3", "g7", \
213 "l2", "l3", "l4", "l5", "l6", "l7", \ 212 "l2", "l3", "l4", "l5", "l6", "l7", \
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index a1d25c06f92a..352d9943661a 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -47,7 +47,9 @@ struct thread_info {
47 struct pt_regs *kregs; 47 struct pt_regs *kregs;
48 struct exec_domain *exec_domain; 48 struct exec_domain *exec_domain;
49 int preempt_count; /* 0 => preemptable, <0 => BUG */ 49 int preempt_count; /* 0 => preemptable, <0 => BUG */
50 int __pad; 50 __u8 new_child;
51 __u8 syscall_noerror;
52 __u16 __pad;
51 53
52 unsigned long *utraps; 54 unsigned long *utraps;
53 55
@@ -87,6 +89,8 @@ struct thread_info {
87#define TI_KREGS 0x00000028 89#define TI_KREGS 0x00000028
88#define TI_EXEC_DOMAIN 0x00000030 90#define TI_EXEC_DOMAIN 0x00000030
89#define TI_PRE_COUNT 0x00000038 91#define TI_PRE_COUNT 0x00000038
92#define TI_NEW_CHILD 0x0000003c
93#define TI_SYS_NOERROR 0x0000003d
90#define TI_UTRAPS 0x00000040 94#define TI_UTRAPS 0x00000040
91#define TI_REG_WINDOW 0x00000048 95#define TI_REG_WINDOW 0x00000048
92#define TI_RWIN_SPTRS 0x000003c8 96#define TI_RWIN_SPTRS 0x000003c8
@@ -219,10 +223,10 @@ register struct thread_info *current_thread_info_reg asm("g6");
219#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */ 223#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
220#define TIF_NEWSIGNALS 6 /* wants new-style signals */ 224#define TIF_NEWSIGNALS 6 /* wants new-style signals */
221#define TIF_32BIT 7 /* 32-bit binary */ 225#define TIF_32BIT 7 /* 32-bit binary */
222#define TIF_NEWCHILD 8 /* just-spawned child process */ 226/* flag bit 8 is available */
223#define TIF_SECCOMP 9 /* secure computing */ 227#define TIF_SECCOMP 9 /* secure computing */
224#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ 228#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
225#define TIF_SYSCALL_SUCCESS 11 229/* flag bit 11 is available */
226/* NOTE: Thread flags >= 12 should be ones we have no interest 230/* NOTE: Thread flags >= 12 should be ones we have no interest
227 * in using in assembly, else we can't use the mask as 231 * in using in assembly, else we can't use the mask as
228 * an immediate value in instructions such as andcc. 232 * an immediate value in instructions such as andcc.
@@ -239,10 +243,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
239#define _TIF_UNALIGNED (1<<TIF_UNALIGNED) 243#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
240#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS) 244#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS)
241#define _TIF_32BIT (1<<TIF_32BIT) 245#define _TIF_32BIT (1<<TIF_32BIT)
242#define _TIF_NEWCHILD (1<<TIF_NEWCHILD)
243#define _TIF_SECCOMP (1<<TIF_SECCOMP) 246#define _TIF_SECCOMP (1<<TIF_SECCOMP)
244#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 247#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
245#define _TIF_SYSCALL_SUCCESS (1<<TIF_SYSCALL_SUCCESS)
246#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 248#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
247#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 249#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
248 250