Przeglądaj źródła

[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 lat temu
rodzic
commit
3715c8c721
2 zmienionych plików z 14 dodań i 8 usunięć
  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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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

Ładowanie…
Anuluj
Zapisz