# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1250695645 -3600
# Node ID 8a75274cb3b5fb779f4eeaec31ec403c1278baba
# Parent dc54e755bd8f7f2b08fa37c62718c79591ca1681
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@xxxxxxxxxx>
xen-unstable changeset: 20054:8a9f81672c76
xen-unstable date: Wed Aug 12 14:27:52 2009 +0100
gdbstub: Fix the build and make a few cleanups.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset: 20055:da620c454916
xen-unstable date: Thu Aug 13 08:40:39 2009 +0100
x86: Do not clear EF.TF in crash-debug mode.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset: 20056:042e2103c3a2
xen-unstable date: Fri Aug 14 08:22:34 2009 +0100
[IA64] define BYTES_PER_LONG to fix compilation error.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
xen-unstable changeset: 20085:49ba52281a4f
xen-unstable date: Wed Aug 19 14:21:56 2009 +0100
---
xen/arch/x86/traps.c | 15 ++++++++++-----
xen/common/gdbstub.c | 33 +++++++++++++++++++++++++++------
xen/include/asm-ia64/xentypes.h | 2 ++
xen/include/xen/gdbstub.h | 6 ------
4 files changed, 39 insertions(+), 17 deletions(-)
diff -r dc54e755bd8f -r 8a75274cb3b5 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Wed Aug 19 16:24:52 2009 +0100
+++ b/xen/arch/x86/traps.c Wed Aug 19 16:27:25 2009 +0100
@@ -2981,13 +2981,18 @@ asmlinkage void do_debug(struct cpu_user
void sysenter_eflags_saved(void);
/* In SYSENTER entry path we can't zap TF until EFLAGS is saved. */
if ( (regs->rip >= (unsigned long)sysenter_entry) &&
- (regs->rip < (unsigned long)sysenter_eflags_saved) )
+ (regs->rip <= (unsigned long)sysenter_eflags_saved) )
+ {
+ if ( regs->rip == (unsigned long)sysenter_eflags_saved )
+ regs->eflags &= ~EF_TF;
goto out;
- WARN_ON(regs->rip != (unsigned long)sysenter_eflags_saved);
-#else
- WARN_ON(1);
+ }
#endif
- regs->eflags &= ~EF_TF;
+ if ( !debugger_trap_fatal(TRAP_debug, regs) )
+ {
+ WARN_ON(1);
+ regs->eflags &= ~EF_TF;
+ }
}
else
{
diff -r dc54e755bd8f -r 8a75274cb3b5 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c Wed Aug 19 16:24:52 2009 +0100
+++ b/xen/common/gdbstub.c Wed Aug 19 16:27:25 2009 +0100
@@ -71,15 +71,14 @@ static void gdbstub_console_puts(const c
static void gdbstub_console_puts(const char *str);
/* value <-> char (de)serialzers */
-char
+static char
hex2char(unsigned long x)
{
const char array[] = "0123456789abcdef";
-
return array[x & 15];
}
-int
+static unsigned int
char2hex(unsigned char c)
{
if ( (c >= '0') && (c <= '9') )
@@ -93,13 +92,13 @@ char2hex(unsigned char c)
return -1;
}
-char
+static unsigned char
str2hex(const char *str)
{
return (char2hex(str[0]) << 4) | char2hex(str[1]);
}
-unsigned long
+static unsigned long
str2ulong(const char *str, unsigned long bytes)
{
unsigned long x = 0;
@@ -111,6 +110,28 @@ str2ulong(const char *str, unsigned long
x += char2hex(*str);
++str;
++i;
+ }
+
+ return x;
+}
+
+static 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;
@@ -488,7 +509,7 @@ process_command(struct cpu_user_regs *re
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':
diff -r dc54e755bd8f -r 8a75274cb3b5 xen/include/asm-ia64/xentypes.h
--- a/xen/include/asm-ia64/xentypes.h Wed Aug 19 16:24:52 2009 +0100
+++ b/xen/include/asm-ia64/xentypes.h Wed Aug 19 16:27:25 2009 +0100
@@ -10,6 +10,8 @@ typedef char bool_t;
#define test_and_set_bool(b) xchg(&(b), 1)
#define test_and_clear_bool(b) xchg(&(b), 0)
+#define BYTES_PER_LONG 8
+
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_IA64_XENTYPES_H */
diff -r dc54e755bd8f -r 8a75274cb3b5 xen/include/xen/gdbstub.h
--- a/xen/include/xen/gdbstub.h Wed Aug 19 16:24:52 2009 +0100
+++ b/xen/include/xen/gdbstub.h Wed Aug 19 16:27:25 2009 +0100
@@ -25,12 +25,6 @@
#include <asm/page.h>
#ifdef CRASH_DEBUG
-
-/* value <-> char (de)serialzers for arch specific gdb backends */
-char hex2char(unsigned long x);
-int char2hex(unsigned char c);
-char str2hex(const char *str);
-unsigned long str2ulong(const char *str, unsigned long bytes);
struct gdb_context {
int serhnd; /* handle on our serial line */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|