Browse Source

[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.
tags/v0.9.4
Stefan Hajnoczi 16 years ago
parent
commit
3715c8c721
2 changed files with 14 additions and 8 deletions
  1. 12
    6
      src/arch/i386/core/gdbidt.S
  2. 2
    2
      src/tests/gdbstub_test.gdb

+ 12
- 6
src/arch/i386/core/gdbidt.S View File

@@ -163,12 +163,18 @@ int_page_fault:
163 163
 #define IH_OFFSET_FLUX_END ( IH_OFFSET_END - 20 )
164 164
 do_interrupt:
165 165
 	/* Store CPU state in GDB register snapshot */
166
-	pushl	%gs
167
-	pushl	%fs
168
-	pushl	%es
169
-	pushl	%ds
170
-	pushl	%ss
171
-	pushl	IH_OFFSET_FLUX_OLD_CS(%esp)
166
+	pushw	$0
167
+	pushw	%gs
168
+	pushw	$0
169
+	pushw	%fs
170
+	pushw	$0
171
+	pushw	%es
172
+	pushw	$0
173
+	pushw	%ds
174
+	pushw	$0
175
+	pushw	%ss
176
+	pushw	$0
177
+	pushw	IH_OFFSET_FLUX_OLD_CS + 2(%esp)
172 178
 	pushl	IH_OFFSET_FLUX_OLD_EFLAGS(%esp)
173 179
 	pushl	IH_OFFSET_FLUX_OLD_EIP(%esp)
174 180
 	pushl	%edi

+ 2
- 2
src/tests/gdbstub_test.gdb View File

@@ -81,13 +81,13 @@ define gpxe_test_awatch
81 81
 	awatch watch_me
82 82
 
83 83
 	c
84
-	gpxe_assert $ecx 0x600d0000 "gpxe_test_awatch"
84
+	gpxe_assert $ecx 0x600d0000 "gpxe_test_awatch read"
85 85
 	if $ecx == 0x600d0000
86 86
 		c
87 87
 	end
88 88
 
89 89
 	c
90
-	gpxe_assert $ecx 0x600d0001 "gpxe_test_awatch"
90
+	gpxe_assert $ecx 0x600d0001 "gpxe_test_awatch write"
91 91
 	if $ecx == 0x600d0001
92 92
 		c
93 93
 	end

Loading…
Cancel
Save