aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-02 03:49:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-30 22:21:37 -0400
commitbfd170d56505bf21cb636b0f1f169eaa815bdfe4 (patch)
tree9a783a04a5b8e013af113704c3d4b51a6db77cd2 /arch
parent583d632fb3f6d7e9d133a7260829dd7565f8cc99 (diff)
arm: optimized current_pt_regs()
... no need to read current_thread_info()->task only to feed it to task_thread_page() immediately afterwards. Moreover, not using current_thread_info() at all ends up with better assembler - we need a location very close to the top of kernel stack page and it's actually better to do or with 0x1fff, followed be subtracting a small constant than and with ~0x1fff, followed by adding a large one. Both & and | would be a couple of insns (mvn lsr/mvn lsl for |, a pair of bic for &), but the following addition would cost a pair of add while the subtraction ends up as a single sub. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/ptrace.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 355ece523f4..44fe998269d 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -254,6 +254,11 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
254 return regs->ARM_sp; 254 return regs->ARM_sp;
255} 255}
256 256
257#define current_pt_regs(void) ({ \
258 register unsigned long sp asm ("sp"); \
259 (struct pt_regs *)((sp | (THREAD_SIZE - 1)) - 7) - 1; \
260})
261
257#endif /* __KERNEL__ */ 262#endif /* __KERNEL__ */
258 263
259#endif /* __ASSEMBLY__ */ 264#endif /* __ASSEMBLY__ */