summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/ChangeLog12
-rw-r--r--runtime/current.c36
-rw-r--r--runtime/runtime.h14
-rw-r--r--runtime/sym.c5
4 files changed, 63 insertions, 4 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 1f0f429a..bd2e8153 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,15 @@
+2005-09-22 Martin Hunt <hunt@redhat.com>
+
+ * runtime.h (init_module): Only initialize _stp_kta and
+ _stp_kallsyms_lookup on i386 and x86_64. Define HAS_LOOKUP.
+
+ * sym.c (_stp_symbol_sprint): If HAS_LOOKUP is not
+ defined, just print address in hex.
+
+ * current.c (_stp_ret_addr): Add ppc64 version.
+ (_stp_sprint_regs): PPC64 version from
+ Ananth N Mavinakayanahalli <ananth@in.ibm.com>
+
2005-09-14 Martin Hunt <hunt@redhat.com>
* map.c (_stp_map_clear): New function. CLears a map but
diff --git a/runtime/current.c b/runtime/current.c
index 7edfaf5f..00ddb3e1 100644
--- a/runtime/current.c
+++ b/runtime/current.c
@@ -29,6 +29,8 @@ unsigned long _stp_ret_addr (struct pt_regs *regs)
return 0;
#elif defined (__i386__)
return regs->esp;
+#elif defined (__powerpc64__)
+ return REG_LINK(regs);
#else
#error Unimplemented architecture
#endif
@@ -129,6 +131,40 @@ void _stp_sprint_regs(String str, struct pt_regs * regs)
_stp_sprintf (str, "CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
}
+#elif defined (__powerpc64__)
+
+void _stp_sprint_regs(String str, struct pt_regs * regs)
+{
+ int i;
+
+ _stp_sprintf(str, "NIP: %016lX XER: %08X LR: %016lX CTR: %016lX\n",
+ regs->nip, (unsigned int)regs->xer, regs->link, regs->ctr);
+ _stp_sprintf(str, "REGS: %p TRAP: %04lx\n", regs, regs->trap);
+ _stp_sprintf(str, "MSR: %016lx CR: %08X\n",
+ regs->msr, (unsigned int)regs->ccr);
+ _stp_sprintf(str, "DAR: %016lx DSISR: %016lx\n",
+ regs->dar, regs->dsisr);
+
+#ifdef CONFIG_SMP
+ _stp_sprintf(str, " CPU: %d", smp_processor_id());
+#endif /* CONFIG_SMP */
+
+ for (i = 0; i < 32; i++) {
+ if ((i % 4) == 0) {
+ _stp_sprintf(str, "\n GPR%02d: ", i);
+ }
+
+ _stp_sprintf(str, "%016lX ", regs->gpr[i]);
+ if (i == 13 && !FULL_REGS(regs))
+ break;
+ }
+ _stp_string_cat(str, "\n");
+ _stp_sprintf(str, "NIP [%016lx] ", regs->nip);
+ _stp_sprintf(str, "LR [%016lx] ", regs->link);
+ _stp_string_cat(str, regs->link);
+ _stp_string_cat(str, "\n");
+}
+
#endif
/** Print the registers.
diff --git a/runtime/runtime.h b/runtime/runtime.h
index b0fc5b5d..94a210a6 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -61,15 +61,15 @@ static struct
#include "arith.c"
#include "copy.c"
+/************* Module Stuff ********************/
+#if defined (__x86_64__) || defined (__i386__)
+#define HAS_LOOKUP 1
static int (*_stp_kta)(unsigned long addr);
static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
unsigned long *symbolsize,
unsigned long *offset,
char **modname, char *namebuf);
-/************* Module Stuff ********************/
-int probe_start(void);
-
int init_module (void)
{
_stp_kta = (int (*)(unsigned long))kallsyms_lookup_name("__kernel_text_address");
@@ -77,6 +77,14 @@ int init_module (void)
kallsyms_lookup_name("kallsyms_lookup");
return _stp_transport_init();
}
+#else
+int init_module (void)
+{
+ return _stp_transport_init();
+}
+#endif
+
+int probe_start(void);
void cleanup_module(void)
{
diff --git a/runtime/sym.c b/runtime/sym.c
index 107f6b33..344df373 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -18,6 +18,7 @@
String _stp_symbol_sprint (String str, unsigned long address)
{
+#ifdef HAS_LOOKUP
char *modname;
const char *name;
unsigned long offset, size;
@@ -33,7 +34,9 @@ String _stp_symbol_sprint (String str, unsigned long address)
else
_stp_sprintf (str, " : %s+%#lx/%#lx", name, offset, size);
}
-
+#else
+ _stp_sprintf (str, "0x%lx", address);
+#endif
return str;
}