diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-27 12:53:57 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-27 12:53:57 +0000 |
commit | fa56aa1711ef1a57d66cf99b599129459a808ef5 (patch) | |
tree | 186756efbfd8c4a77c7410482df9387edf6984a8 /xen/arch/x86/gdbstub.c | |
parent | e2d6a0473bbffb26177c0d4bb3ddbe6268c3ca70 (diff) | |
download | xen-fa56aa1711ef1a57d66cf99b599129459a808ef5.tar.gz xen-fa56aa1711ef1a57d66cf99b599129459a808ef5.tar.bz2 xen-fa56aa1711ef1a57d66cf99b599129459a808ef5.zip |
gdbstub: Various fixes.
Highlights:
- Removed panics and smp stop calls in favour of an smp pause
mechanism.
- Added x86_64 register mapping for gdb serial protocol support.
Signed-off-by: Dan Doucette <doucette.daniel@gmail.com>
Diffstat (limited to 'xen/arch/x86/gdbstub.c')
-rw-r--r-- | xen/arch/x86/gdbstub.c | 75 |
1 files changed, 19 insertions, 56 deletions
diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c index 3d0d0d0429..44165033d3 100644 --- a/xen/arch/x86/gdbstub.c +++ b/xen/arch/x86/gdbstub.c @@ -24,51 +24,7 @@ u16 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie) { - /* XXX */ - return 1; -} - -void -gdb_arch_read_reg_array(struct cpu_user_regs *regs, struct gdb_context *ctx) -{ -#define GDB_REG(r) gdb_write_to_packet_hex(r, sizeof(r), ctx); - GDB_REG(regs->eax); - GDB_REG(regs->ecx); - GDB_REG(regs->edx); - GDB_REG(regs->ebx); - GDB_REG(regs->esp); - GDB_REG(regs->ebp); - GDB_REG(regs->esi); - GDB_REG(regs->edi); - GDB_REG(regs->eip); - GDB_REG(regs->eflags); -#undef GDB_REG -#define GDB_SEG_REG(s) gdb_write_to_packet_hex(s, sizeof(u32), ctx); - /* sizeof(segment) = 16bit */ - /* but gdb requires its return value as 32bit value */ - GDB_SEG_REG(regs->cs); - GDB_SEG_REG(regs->ss); - GDB_SEG_REG(regs->ds); - GDB_SEG_REG(regs->es); - GDB_SEG_REG(regs->fs); - GDB_SEG_REG(regs->gs); -#undef GDB_SEG_REG - gdb_send_packet(ctx); -} - -void -gdb_arch_write_reg_array(struct cpu_user_regs *regs, const char* buf, - struct gdb_context *ctx) -{ - /* XXX TODO */ - gdb_send_reply("E02", ctx); -} - -void -gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs, - struct gdb_context *ctx) -{ - gdb_send_reply("", ctx); + return 5; /* TRAP signal. see include/gdb/signals.h */ } /* @@ -87,17 +43,6 @@ gdb_arch_copy_to_user(void *dest, const void *src, unsigned len) return __copy_to_user(dest, src, len); } -void -gdb_arch_resume(struct cpu_user_regs *regs, - unsigned long addr, unsigned long type, - struct gdb_context *ctx) -{ - /* XXX */ - if (type == GDB_STEP) { - gdb_send_reply("S01", ctx); - } -} - void gdb_arch_print_state(struct cpu_user_regs *regs) { @@ -116,6 +61,24 @@ gdb_arch_exit(struct cpu_user_regs *regs) /* nothing */ } +void +gdb_arch_resume(struct cpu_user_regs *regs, + unsigned long addr, unsigned long type, + struct gdb_context *ctx) +{ + if ( addr != -1UL ) + regs->eip = addr; + + regs->eflags &= ~X86_EFLAGS_TF; + + /* Set eflags.RF to ensure we do not re-enter. */ + regs->eflags |= X86_EFLAGS_RF; + + /* Set the trap flag if we are single stepping. */ + if ( type == GDB_STEP ) + regs->eflags |= X86_EFLAGS_TF; +} + /* * Local variables: * mode: C |