linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Implement GET_IP/SET_IP for powerpc architecture.
@ 2012-02-02 14:41 Srikar Dronamraju
  2012-02-02 16:28 ` Mike Frysinger
  2012-02-08 14:53 ` [PATCH v2 ] " Srikar Dronamraju
  0 siblings, 2 replies; 7+ messages in thread
From: Srikar Dronamraju @ 2012-02-02 14:41 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Mike Frysinger

With this change, helpers such as instruction_pointer() et al, get defined
in the generic header in terms of GET_IP

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
 arch/powerpc/include/asm/ptrace.h |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 78a2051..889408d 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -83,8 +83,20 @@ struct pt_regs {
 
 #ifndef __ASSEMBLY__
 
-#define instruction_pointer(regs) ((regs)->nip)
-#define user_stack_pointer(regs) ((regs)->gpr[1])
+#define GET_IP(regs)		((regs)->nip)
+#define GET_USP(regs)		((regs)->gpr[1])
+#define GET_FP(regs)		(0)
+#define SET_FP(regs, val)
+
+#ifdef CONFIG_SMP
+extern unsigned long profile_pc(struct pt_regs *regs);
+#define profile_pc profile_pc
+#else
+#define profile_pc(regs) GET_IP(regs)
+#endif
+
+#include <asm-generic/ptrace.h>
+
 #define kernel_stack_pointer(regs) ((regs)->gpr[1])
 static inline int is_syscall_success(struct pt_regs *regs)
 {
@@ -99,12 +111,6 @@ static inline long regs_return_value(struct pt_regs *regs)
 		return -regs->gpr[3];
 }
 
-#ifdef CONFIG_SMP
-extern unsigned long profile_pc(struct pt_regs *regs);
-#else
-#define profile_pc(regs) instruction_pointer(regs)
-#endif
-
 #ifdef __powerpc64__
 #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
 #else

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

* Re: [PATCH] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-02 14:41 [PATCH] Implement GET_IP/SET_IP for powerpc architecture Srikar Dronamraju
@ 2012-02-02 16:28 ` Mike Frysinger
  2012-02-02 16:36   ` Srikar Dronamraju
  2012-02-02 21:23   ` Benjamin Herrenschmidt
  2012-02-08 14:53 ` [PATCH v2 ] " Srikar Dronamraju
  1 sibling, 2 replies; 7+ messages in thread
From: Mike Frysinger @ 2012-02-02 16:28 UTC (permalink / raw)
  To: Srikar Dronamraju; +Cc: linuxppc-dev, Benjamin Herrenschmidt

[-- Attachment #1: Type: Text/Plain, Size: 314 bytes --]

On Thursday 02 February 2012 09:41:25 Srikar Dronamraju wrote:
> +#define GET_FP(regs)		(0)
> +#define SET_FP(regs, val)

ppc doesn't have a standard FP location ?

> +#define profile_pc(regs) GET_IP(regs)

pretty sure you don't need this as asm-generic/ptrace.h already has a 
definition for you
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-02 16:28 ` Mike Frysinger
@ 2012-02-02 16:36   ` Srikar Dronamraju
  2012-02-02 17:02     ` Mike Frysinger
  2012-02-02 21:23   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Srikar Dronamraju @ 2012-02-02 16:36 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linuxppc-dev, Benjamin Herrenschmidt

* Mike Frysinger <vapier@gentoo.org> [2012-02-02 11:28:46]:

> On Thursday 02 February 2012 09:41:25 Srikar Dronamraju wrote:
> > +#define GET_FP(regs)		(0)
> > +#define SET_FP(regs, val)
> 
> ppc doesn't have a standard FP location ?
> 
> > +#define profile_pc(regs) GET_IP(regs)
> 
> pretty sure you don't need this as asm-generic/ptrace.h already has a 
> definition for you

On ppc64, profile_pc is an extern function if CONFIG_SMP is set. 
else its same as whats defined in asm-generic/ptrace.h

Now if we allow asm-generic/ptrace.h definition to take effect, then
powerpc/time.h (where the actual profile_pc  is defined as an extern
function) fails with an error for redefinition.

Hence our approach was to define profile_pc before asm-generic/ptrace.h
gets included.  One change  that we could do was to define profile_pc
only under CONFIG_SMP. But I think it makes the code less confusing.
Otherwise people might keep wondering why profile_pc is defined only for
CONFIG_SMP case.

-- 
Thanks and Regards
Srikar

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

* Re: [PATCH] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-02 16:36   ` Srikar Dronamraju
@ 2012-02-02 17:02     ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2012-02-02 17:02 UTC (permalink / raw)
  To: Srikar Dronamraju; +Cc: linuxppc-dev, Benjamin Herrenschmidt

[-- Attachment #1: Type: Text/Plain, Size: 525 bytes --]

On Thursday 02 February 2012 11:36:59 Srikar Dronamraju wrote:
> * Mike Frysinger <vapier@gentoo.org> [2012-02-02 11:28:46]:
> > On Thursday 02 February 2012 09:41:25 Srikar Dronamraju wrote:
> > > +#define profile_pc(regs) GET_IP(regs)
> > 
> > pretty sure you don't need this as asm-generic/ptrace.h already has a
> > definition for you
> 
> On ppc64, profile_pc is an extern function if CONFIG_SMP is set.
> else its same as whats defined in asm-generic/ptrace.h

the code i quoted was from !CONFIG_SMP
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-02 16:28 ` Mike Frysinger
  2012-02-02 16:36   ` Srikar Dronamraju
@ 2012-02-02 21:23   ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2012-02-02 21:23 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linuxppc-dev, Srikar Dronamraju

On Thu, 2012-02-02 at 11:28 -0500, Mike Frysinger wrote:
> On Thursday 02 February 2012 09:41:25 Srikar Dronamraju wrote:
> > +#define GET_FP(regs)		(0)
> > +#define SET_FP(regs, val)
> 
> ppc doesn't have a standard FP location ?

Not really no, it's the sp (r1). r31 might be considered a "frame
pointer" under some circumstances but there isn't much you can do with
it, it's really r1 that gives you the ability to backtrace (each stack
frame contains a pointer to the next one).

> > +#define profile_pc(regs) GET_IP(regs)
> 
> pretty sure you don't need this as asm-generic/ptrace.h already has a 
> definition for you
> -mike

Cheers,
Ben.

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

* Re: [PATCH v2 ] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-02 14:41 [PATCH] Implement GET_IP/SET_IP for powerpc architecture Srikar Dronamraju
  2012-02-02 16:28 ` Mike Frysinger
@ 2012-02-08 14:53 ` Srikar Dronamraju
  2012-02-09  2:56   ` Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Srikar Dronamraju @ 2012-02-08 14:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Mike Frysinger

With this change, helpers such as instruction_pointer() et al, get defined
in the generic header in terms of GET_IP

Removed the unnecessary definition of profile_pc in !CONFIG_SMP case as
suggested by Mike Frysinger.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
 arch/powerpc/include/asm/ptrace.h |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 78a2051..84cc784 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -83,8 +83,18 @@ struct pt_regs {
 
 #ifndef __ASSEMBLY__
 
-#define instruction_pointer(regs) ((regs)->nip)
-#define user_stack_pointer(regs) ((regs)->gpr[1])
+#define GET_IP(regs)		((regs)->nip)
+#define GET_USP(regs)		((regs)->gpr[1])
+#define GET_FP(regs)		(0)
+#define SET_FP(regs, val)
+
+#ifdef CONFIG_SMP
+extern unsigned long profile_pc(struct pt_regs *regs);
+#define profile_pc profile_pc
+#endif
+
+#include <asm-generic/ptrace.h>
+
 #define kernel_stack_pointer(regs) ((regs)->gpr[1])
 static inline int is_syscall_success(struct pt_regs *regs)
 {
@@ -99,12 +109,6 @@ static inline long regs_return_value(struct pt_regs *regs)
 		return -regs->gpr[3];
 }
 
-#ifdef CONFIG_SMP
-extern unsigned long profile_pc(struct pt_regs *regs);
-#else
-#define profile_pc(regs) instruction_pointer(regs)
-#endif
-
 #ifdef __powerpc64__
 #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
 #else

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

* Re: [PATCH v2 ] Implement GET_IP/SET_IP for powerpc architecture.
  2012-02-08 14:53 ` [PATCH v2 ] " Srikar Dronamraju
@ 2012-02-09  2:56   ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2012-02-09  2:56 UTC (permalink / raw)
  To: Srikar Dronamraju; +Cc: linuxppc-dev, Benjamin Herrenschmidt

[-- Attachment #1: Type: Text/Plain, Size: 51 bytes --]

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-02-09  2:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 14:41 [PATCH] Implement GET_IP/SET_IP for powerpc architecture Srikar Dronamraju
2012-02-02 16:28 ` Mike Frysinger
2012-02-02 16:36   ` Srikar Dronamraju
2012-02-02 17:02     ` Mike Frysinger
2012-02-02 21:23   ` Benjamin Herrenschmidt
2012-02-08 14:53 ` [PATCH v2 ] " Srikar Dronamraju
2012-02-09  2:56   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).