Skip to contentSkip to conversation

x86: Enhanced dump of segment registers

PATCH RESEND Applied Jan Kiszka 2 participants 2 messages Apr 13, 2009 – Apr 18, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH RESEND v2 1/1 x86: Enhanced dump of segment registers

Parse the descriptor flags that segment registers refer to and show the result in a more human-friendly format. The output of info registers eg. then looks like this:

[...]
ES =007b 00000000 ffffffff 00cff300 DPL=3 DS [-WA]
CS =0060 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA]
SS =0068 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
DS =007b 00000000 ffffffff 00cff300 DPL=3 DS [-WA]
FS =0000 00000000 00000000 00000000
GS =0033 b7dd66c0 ffffffff b7dff3dd DPL=3 DS [-WA]
LDT=0000 00000000 00000000 00008200 DPL=0 LDT TR =0080 c06da700 0000206b 00008900 DPL=0 TSS32-avl [...]

Changes in this version:
- refactoring so that only a single helper is used for dumping the segment descriptor cache
- tiny typo fixed that broke 64-bit segment type names

---

 target-i386/cpu.h    |    3 +-
 target-i386/helper.c |  100 +++++++++++++++++++++++++++++++-------------------
 2 files changed, 64 insertions(+), 39 deletions(-)
target-i386/cpu.h +2 -1
index 90bceab..f38f194 100644
@@ -82,9 +82,10 @@
 #define DESC_AVL_MASK   (1 << 20)
 #define DESC_P_MASK     (1 << 15)
 #define DESC_DPL_SHIFT  13
-#define DESC_DPL_MASK   (1 << DESC_DPL_SHIFT)
+#define DESC_DPL_MASK   (3 << DESC_DPL_SHIFT)
 #define DESC_S_MASK     (1 << 12)
 #define DESC_TYPE_SHIFT 8
+#define DESC_TYPE_MASK  (15 << DESC_TYPE_SHIFT)
 #define DESC_A_MASK     (1 << 8)
 
 #define DESC_CS_MASK    (1 << 11) /* 1=code segment 0=data segment */
target-i386/helper.c +62 -38

120 lines not on this page · raw message

#1 lore raw
Quoted 15 lines · Jan Kiszka

Parse the descriptor flags that segment registers refer to and show the result in a more human-friendly format. The output of info registers eg. then looks like this:

[...]
ES =007b 00000000 ffffffff 00cff300 DPL=3 DS [-WA]
CS =0060 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA]
SS =0068 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
DS =007b 00000000 ffffffff 00cff300 DPL=3 DS [-WA]
FS =0000 00000000 00000000 00000000
GS =0033 b7dd66c0 ffffffff b7dff3dd DPL=3 DS [-WA]
LDT=0000 00000000 00000000 00008200 DPL=0 LDT TR =0080 c06da700 0000206b 00008900 DPL=0 TSS32-avl [...]

Quoted 7 lines

Changes in this version:
- refactoring so that only a single helper is used for dumping the segment descriptor cache
- tiny typo fixed that broke 64-bit segment type names

Applied. Thanks.

Signature · 3 lines
Regards,

Anthony Liguori