diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-08-12 14:27:52 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-08-12 14:27:52 +0100 |
commit | 91c2518a67dd1eb6b0ca7c9e14317c9a121baab9 (patch) | |
tree | b9da047d9d3b89f80a8ecc0c90aec5cca4df8a7a /xen/common/gdbstub.c | |
parent | 2606d3eec651a0e6d9b912df903f695db425e148 (diff) | |
download | xen-91c2518a67dd1eb6b0ca7c9e14317c9a121baab9.tar.gz xen-91c2518a67dd1eb6b0ca7c9e14317c9a121baab9.tar.bz2 xen-91c2518a67dd1eb6b0ca7c9e14317c9a121baab9.zip |
gdbstub: Small fixes.
* Correctly handly EFLAGS.TF in the hypervisor
* Register value sent with 'P' command is in native byte order.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/gdbstub.c')
-rw-r--r-- | xen/common/gdbstub.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 6bbd23f395..512172a1aa 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -116,6 +116,28 @@ str2ulong(const char *str, unsigned long bytes) return x; } +unsigned long +str_to_native_ulong(const char *str) +{ + unsigned long x = 0, i = 0; + + while ( *str && (i < BYTES_PER_LONG) ) + { +#ifdef __BIG_ENDIAN + x <<= 8; + x += str2hex(*str); +#elif defined(__LITTLE_ENDIAN) + x += (unsigned long)str2hex(*str) << (i*8); +#else +# error unknown endian +#endif + str += 2; + i++; + } + + return x; +} + /* gdb io wrappers */ static signed long gdb_io_write(const char *buf, unsigned long len, struct gdb_context *ctx) @@ -488,7 +510,7 @@ process_command(struct cpu_user_regs *regs, struct gdb_context *ctx) return 0; } ptr++; - val = str2ulong(ptr, sizeof(unsigned long)); + val = str_to_native_ulong(ptr); gdb_arch_write_reg(addr, val, regs, ctx); break; case 'D': |