Skip to contentSkip to conversation

target-i386: Fix segment cache dump

PATCH Superseded Tobias Markus 1 participant 1 message Aug 22, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: Fix segment cache dump

When in Long Mode, cpu_x86_seg_cache() logs "DS16" because the Default operation size bit (D/B bit) is not set for Long Mode Data Segments since there are only Data Segments in Long Mode and no explicit 16/32/64-bit Descriptors.
This patch fixes this by checking the Long Mode Active bit of the hidden flags variable and logging "DS" if it is set, i.e. in Long Mode all Data Segments are logged as "DS".

---
Note that alternatively, Data Segments in Long Mode could be logged as "DS64" to avoid confusion about the missing 64 postfix. (But that would be, strictly speaking, wrong because there are only DSs and no DS16/32/64 in Long Mode.)
PS: This is my first contribution to an Open Source Project and I would be very happy about constructive feedback, especially about possible wrong word wrapping.

 target-i386/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-i386/helper.c +0 -0
index bf3e2ac..a8facdf 100644
@@ -147,7 +147,7 @@ cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f,

fprintf_function cpu_fprintf,

             cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
                         (sc->flags & DESC_R_MASK) ? 'R' : '-');
         } else {
-            cpu_fprintf(f, (sc->flags & DESC_B_MASK) ? "DS  " : "DS16");
+            cpu_fprintf(f, (sc->flags & DESC_B_MASK || env->hflags &
HF_LMA_MASK) ? "DS  " : "DS16");
             cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
                         (sc->flags & DESC_W_MASK) ? 'W' : '-');
         }
Signature · 1 line
1.8.3.4