summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-11-30 00:55:49 +0000
committerpeter <peter@FreeBSD.org>2004-11-30 00:55:49 +0000
commitc3b322350400437d05cd962d794eae4e0ad8e3ea (patch)
tree5fc3c3db7c16ce1af45b2e5ffc412c6cc5964744 /sys/amd64
parent0cb38b1818725b11209d2f12dcc4ddc0d4d3de88 (diff)
downloadFreeBSD-src-c3b322350400437d05cd962d794eae4e0ad8e3ea.zip
FreeBSD-src-c3b322350400437d05cd962d794eae4e0ad8e3ea.tar.gz
Update the gdb register extraction support to use the pcb wherever
possible, like on i386. Registers are handled differently for caller vs callee saved registers.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/gdb_machdep.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c
index 820824b..770e903 100644
--- a/sys/amd64/amd64/gdb_machdep.c
+++ b/sys/amd64/amd64/gdb_machdep.c
@@ -36,39 +36,46 @@ __FBSDID("$FreeBSD$");
#include <machine/frame.h>
#include <machine/gdb_machdep.h>
+#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/reg.h>
#include <machine/trap.h>
+#include <machine/frame.h>
+#include <machine/endian.h>
#include <gdb/gdb.h>
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
- struct trapframe *tf = kdb_frame;
*regsz = gdb_cpu_regsz(regnum);
+
+ if (kdb_thread == curthread) {
+ switch (regnum) {
+ case 0: return (&kdb_frame->tf_rax);
+ case 2: return (&kdb_frame->tf_rcx);
+ case 3: return (&kdb_frame->tf_rdx);
+ case 4: return (&kdb_frame->tf_rsi);
+ case 5: return (&kdb_frame->tf_rdi);
+ case 8: return (&kdb_frame->tf_r8);
+ case 9: return (&kdb_frame->tf_r9);
+ case 10: return (&kdb_frame->tf_r10);
+ case 11: return (&kdb_frame->tf_r11);
+ case 18: return (&kdb_frame->tf_cs);
+ case 19: return (&kdb_frame->tf_ss);
+ }
+ }
switch (regnum) {
- case 0: return (&tf->tf_rax);
- case 1: return (&tf->tf_rbx);
- case 2: return (&tf->tf_rcx);
- case 3: return (&tf->tf_rdx);
- case 4: return (&tf->tf_rsi);
- case 5: return (&tf->tf_rdi);
- case 6: return (&tf->tf_rbp);
- case 7: return (&tf->tf_rsp);
- case 8: return (&tf->tf_r8);
- case 9: return (&tf->tf_r9);
- case 10: return (&tf->tf_r10);
- case 11: return (&tf->tf_r11);
- case 12: return (&tf->tf_r12);
- case 13: return (&tf->tf_r13);
- case 14: return (&tf->tf_r14);
- case 15: return (&tf->tf_r15);
- case 16: return (&tf->tf_rip);
- case 17: return (&tf->tf_rflags);
- case 18: return (&tf->tf_cs);
- case 19: return (&tf->tf_ss);
+ case 1: return (&kdb_thrctx->pcb_rbx);
+ case 6: return (&kdb_thrctx->pcb_rbp);
+ case 7: return (&kdb_thrctx->pcb_rsp);
+ case 12: return (&kdb_thrctx->pcb_r12);
+ case 13: return (&kdb_thrctx->pcb_r13);
+ case 14: return (&kdb_thrctx->pcb_r14);
+ case 15: return (&kdb_thrctx->pcb_r15);
+ case 16: return (&kdb_thrctx->pcb_rip);
+ case 17: return (&kdb_thrctx->pcb_rflags);
}
return (NULL);
}
@@ -76,9 +83,12 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
void
gdb_cpu_setreg(int regnum, register_t val)
{
- struct trapframe *tf = kdb_frame;
+ val = __bswap64(val);
switch (regnum) {
- case GDB_REG_PC: tf->tf_rip = val; break;
+ case GDB_REG_PC:
+ kdb_thrctx->pcb_rip = val;
+ if (kdb_thread == curthread)
+ kdb_frame->tf_rip = val;
}
}
OpenPOWER on IntegriCloud