]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/asm-sparc64/ptrace.h
sparc: Add kgdb support.
[mv-sheeva.git] / include / asm-sparc64 / ptrace.h
index 67341cff2e6b28c1bc9932a9d09f0911dfc2aace..714b81956f32a653a4c9863edbbc2aefb16b89a8 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id: ptrace.h,v 1.14 2002/02/09 19:49:32 davem Exp $ */
 #ifndef _SPARC64_PTRACE_H
 #define _SPARC64_PTRACE_H
 
@@ -8,17 +7,53 @@
  * stack during a system call and basically all traps.
  */
 
+/* This magic value must have the low 9 bits clear,
+ * as that is where we encode the %tt value, see below.
+ */
+#define PT_REGS_MAGIC 0x57ac6c00
+
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
 struct pt_regs {
        unsigned long u_regs[16]; /* globals and ins */
        unsigned long tstate;
        unsigned long tpc;
        unsigned long tnpc;
        unsigned int y;
-       unsigned int fprs;
+
+       /* We encode a magic number, PT_REGS_MAGIC, along
+        * with the %tt (trap type) register value at trap
+        * entry time.  The magic number allows us to identify
+        * accurately a trap stack frame in the stack
+        * unwinder, and the %tt value allows us to test
+        * things like "in a system call" etc. for an arbitray
+        * process.
+        *
+        * The PT_REGS_MAGIC is choosen such that it can be
+        * loaded completely using just a sethi instruction.
+        */
+       unsigned int magic;
 };
 
+static inline int pt_regs_trap_type(struct pt_regs *regs)
+{
+       return regs->magic & 0x1ff;
+}
+
+static inline int pt_regs_clear_trap_type(struct pt_regs *regs)
+{
+       return regs->magic &= ~0x1ff;
+}
+
+static inline bool pt_regs_is_syscall(struct pt_regs *regs)
+{
+       int tt = pt_regs_trap_type(regs);
+
+       return (tt == 0x110 || tt == 0x111 || tt == 0x16d);
+}
+
 struct pt_regs32 {
        unsigned int psr;
        unsigned int pc;
@@ -109,6 +144,7 @@ extern unsigned long profile_pc(struct pt_regs *);
 #define profile_pc(regs) instruction_pointer(regs)
 #endif
 extern void show_regs(struct pt_regs *);
+extern void __show_regs(struct pt_regs *);
 #endif
 
 #else /* __ASSEMBLY__ */
@@ -146,7 +182,7 @@ extern void show_regs(struct pt_regs *);
 #define PT_V9_TPC    0x88
 #define PT_V9_TNPC   0x90
 #define PT_V9_Y      0x98
-#define PT_V9_FPRS   0x9c
+#define PT_V9_MAGIC  0x9c
 #define PT_TSTATE      PT_V9_TSTATE
 #define PT_TPC         PT_V9_TPC
 #define PT_TNPC                PT_V9_TNPC