summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Hajnoczi2008-06-13 11:26:49 +0200
committerMichael Brown2008-06-30 20:19:48 +0200
commit3715c8c721d312d79339a3b1b0b0900537c93b15 (patch)
treeaddfab1cb06b5444bd504179a6082bb8b2201459
parent[GDB] Add copyright header for gdbmach.c (diff)
downloadipxe-3715c8c721d312d79339a3b1b0b0900537c93b15.tar.gz
ipxe-3715c8c721d312d79339a3b1b0b0900537c93b15.tar.xz
ipxe-3715c8c721d312d79339a3b1b0b0900537c93b15.zip
[GDB] Zero-extend 16-bit segment registers
When the 16-bit segment registers are accessed using 32-bit instructions the high order bytes are undefined on older CPUs. We now explicitly zero the high order bytes when snapshotting the CPU state. This ensures that the GDB stub reports consistent values for the segment registers.
-rw-r--r--src/arch/i386/core/gdbidt.S18
-rwxr-xr-xsrc/tests/gdbstub_test.gdb4
2 files changed, 14 insertions, 8 deletions
diff --git a/src/arch/i386/core/gdbidt.S b/src/arch/i386/core/gdbidt.S
index a4949232..860f7b01 100644
--- a/src/arch/i386/core/gdbidt.S
+++ b/src/arch/i386/core/gdbidt.S
@@ -163,12 +163,18 @@ int_page_fault:
#define IH_OFFSET_FLUX_END ( IH_OFFSET_END - 20 )
do_interrupt:
/* Store CPU state in GDB register snapshot */
- pushl %gs
- pushl %fs
- pushl %es
- pushl %ds
- pushl %ss
- pushl IH_OFFSET_FLUX_OLD_CS(%esp)
+ pushw $0
+ pushw %gs
+ pushw $0
+ pushw %fs
+ pushw $0
+ pushw %es
+ pushw $0
+ pushw %ds
+ pushw $0
+ pushw %ss
+ pushw $0
+ pushw IH_OFFSET_FLUX_OLD_CS + 2(%esp)
pushl IH_OFFSET_FLUX_OLD_EFLAGS(%esp)
pushl IH_OFFSET_FLUX_OLD_EIP(%esp)
pushl %edi
diff --git a/src/tests/gdbstub_test.gdb b/src/tests/gdbstub_test.gdb
index 191799af..52aa693f 100755
--- a/src/tests/gdbstub_test.gdb
+++ b/src/tests/gdbstub_test.gdb
@@ -81,13 +81,13 @@ define gpxe_test_awatch
awatch watch_me
c
- gpxe_assert $ecx 0x600d0000 "gpxe_test_awatch"
+ gpxe_assert $ecx 0x600d0000 "gpxe_test_awatch read"
if $ecx == 0x600d0000
c
end
c
- gpxe_assert $ecx 0x600d0001 "gpxe_test_awatch"
+ gpxe_assert $ecx 0x600d0001 "gpxe_test_awatch write"
if $ecx == 0x600d0001
c
end