From: behanw@converseincode.com (behanw at converseincode.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
Date: Fri, 6 Sep 2013 17:42:41 -0400 [thread overview]
Message-ID: <1378503762-7236-2-git-send-email-behanw@converseincode.com> (raw)
In-Reply-To: <1378503762-7236-1-git-send-email-behanw@converseincode.com>
From: Behan Webster <behanw@converseincode.com>
Use the frame pointer to calculate the end of the stack for current_pt_regs()
The existing code uses the stack pointer to do this calculation.
Using the frame pointer yeilds the same value in a more portable way.
This change supports being able to compile the kernel with gcc and clang.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Jan-Simon M?ller <dl9pf@gmx.de>
---
arch/arm/include/asm/ptrace.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 04c99f3..8aec2db 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -138,9 +138,9 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
return regs->ARM_sp;
}
-#define current_pt_regs(void) ({ \
- register unsigned long sp asm ("sp"); \
- (struct pt_regs *)((sp | (THREAD_SIZE - 1)) - 7) - 1; \
+#define current_pt_regs(void) ({ \
+ (struct pt_regs *)(((unsigned long)(__builtin_frame_address(0)) \
+ | (THREAD_SIZE - 1)) - 7) - 1; \
})
#endif /* __ASSEMBLY__ */
--
1.8.1.2
next prev parent reply other threads:[~2013-09-06 21:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-06 21:42 [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers behanw at converseincode.com
2013-09-06 21:42 ` behanw at converseincode.com [this message]
2013-09-06 22:18 ` [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp Russell King - ARM Linux
2013-09-06 23:02 ` Behan Webster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378503762-7236-2-git-send-email-behanw@converseincode.com \
--to=behanw@converseincode.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox