mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers
@ 2013-09-06 21:42 behanw
  2013-09-06 21:42 ` [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp behanw
  0 siblings, 1 reply; 3+ messages in thread
From: behanw @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel
  Cc: behanw, Paul E. McKenney, David Howells, Catalin Marinas, Dave Jones

From: Behan Webster <behanw@converseincode.com>

The LLVMLinux Project is working to be able to build the Linux kernel with
clang/LLVM. With the release of LLVM 3.3 clang is now able to compile the Linux
kernel with a number of small patches (available from the LLVMLinux git repo).

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.

Behan Webster (1):
  arm: LLVMLinux: Calculate pt_regs address from fp

 arch/arm/include/asm/ptrace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
  2013-09-06 21:42 [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers behanw
@ 2013-09-06 21:42 ` behanw
  2013-09-06 22:18   ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: behanw @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux
  Cc: behanw, Mark Charlebois, Paul E. McKenney, David Howells,
	Catalin Marinas, Dave Jones, moderated list:ARM PORT, open list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
  2013-09-06 21:42 ` [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp behanw
@ 2013-09-06 22:18   ` Russell King - ARM Linux
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2013-09-06 22:18 UTC (permalink / raw)
  To: behanw
  Cc: Mark Charlebois, Paul E. McKenney, David Howells,
	Catalin Marinas, Dave Jones, moderated list:ARM PORT, open list

On Fri, Sep 06, 2013 at 05:42:41PM -0400, behanw@converseincode.com wrote:
> 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.

What happens when frame pointers are disabled on gcc?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-06 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 21:42 [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers behanw
2013-09-06 21:42 ` [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp behanw
2013-09-06 22:18   ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®