summaryrefslogtreecommitdiffstats
path: root/runtime/current.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-05-17 08:02:30 +0000
committerhunt <hunt>2005-05-17 08:02:30 +0000
commit43614f5d7e0d18f553c0ee2a4e195d7b8f63be1f (patch)
tree89edd85aa491b4f9632d10705fcd68c04fc98db3 /runtime/current.c
parent30add090cbcbb6367c06c8bcc3c270e60c2f928e (diff)
downloadsystemtap-steved-43614f5d7e0d18f553c0ee2a4e195d7b8f63be1f.tar.gz
systemtap-steved-43614f5d7e0d18f553c0ee2a4e195d7b8f63be1f.tar.xz
systemtap-steved-43614f5d7e0d18f553c0ee2a4e195d7b8f63be1f.zip
Rewritten maps and other updated files.
Diffstat (limited to 'runtime/current.c')
-rw-r--r--runtime/current.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/runtime/current.c b/runtime/current.c
index 78820c40..618c9fc9 100644
--- a/runtime/current.c
+++ b/runtime/current.c
@@ -30,5 +30,58 @@ unsigned long _stp_ret_addr (struct pt_regs *regs)
else
return 0;
}
+
+#ifdef __x86_64__
+#include <linux/utsname.h>
+
+void _stp_print_regs(struct pt_regs * regs)
+{
+ unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
+ unsigned int fsindex,gsindex;
+ unsigned int ds,cs,es;
+
+ _stp_printf("\n");
+ // print_modules();
+ _stp_printf("Pid: %d, comm: %.20s %s\n",
+ current->pid, current->comm, system_utsname.release);
+ _stp_printf("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
+ _stp_symbol_print (regs->rip);
+ _stp_printf("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags);
+ _stp_printf("RAX: %016lx RBX: %016lx RCX: %016lx\n",
+ regs->rax, regs->rbx, regs->rcx);
+ _stp_printf("RDX: %016lx RSI: %016lx RDI: %016lx\n",
+ regs->rdx, regs->rsi, regs->rdi);
+ _stp_printf("RBP: %016lx R08: %016lx R09: %016lx\n",
+ regs->rbp, regs->r8, regs->r9);
+ _stp_printf("R10: %016lx R11: %016lx R12: %016lx\n",
+ regs->r10, regs->r11, regs->r12);
+ _stp_printf("R13: %016lx R14: %016lx R15: %016lx\n",
+ regs->r13, regs->r14, regs->r15);
+
+ asm("movl %%ds,%0" : "=r" (ds));
+ asm("movl %%cs,%0" : "=r" (cs));
+ asm("movl %%es,%0" : "=r" (es));
+ asm("movl %%fs,%0" : "=r" (fsindex));
+ asm("movl %%gs,%0" : "=r" (gsindex));
+
+ rdmsrl(MSR_FS_BASE, fs);
+ rdmsrl(MSR_GS_BASE, gs);
+ rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
+
+ asm("movq %%cr0, %0": "=r" (cr0));
+ asm("movq %%cr2, %0": "=r" (cr2));
+ asm("movq %%cr3, %0": "=r" (cr3));
+ asm("movq %%cr4, %0": "=r" (cr4));
+
+ _stp_printf("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
+ fs,fsindex,gs,gsindex,shadowgs);
+ _stp_printf("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0);
+ _stp_printf("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);
+ _stp_print_flush();
+}
+#endif /* __x86_64__ */
+
+
+
/** @} */
#endif /* _CURRENT_C_ */