Second half of the LDT support. It basically works now.
- New core uinstrs, GETSEG, PUTSEG (save and restore segment regs)
- New core uinstr USESEG, which takes a segment selector and a
virtual address, and returns a linear address -- and also does
a limit check. This calls through to VG_(use_ldt) in vg_ldt.c.
- Insn parser (disAMode) made aware of segment override prefixes
- Obvious fixes to insn emitter and translators
None of the skins understand these new uinstrs, so only --skin=none
works with them at the mo. This and some other rough edges still
need to be fixed.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1139 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/vg_skin.h b/include/vg_skin.h
index 87a7f7b..5454bc7 100644
--- a/include/vg_skin.h
+++ b/include/vg_skin.h
@@ -430,12 +430,19 @@
/*=== UCode definition ===*/
/*====================================================================*/
-/* Tags which describe what operands are. */
+/* Tags which describe what operands are. Must fit into 4 bits, which
+ they clearly do. */
typedef
- enum { TempReg=0, ArchReg=1, RealReg=2,
- SpillNo=3, Literal=4, Lit16=5,
- NoValue=6 }
- Tag;
+enum { TempReg =0, /* virtual temp-reg */
+ ArchReg =1, /* simulated integer reg */
+ ArchRegS =2, /* simulated segment reg */
+ RealReg =3, /* real machine's real reg */
+ SpillNo =4, /* spill slot location */
+ Literal =5, /* literal; .lit32 field has actual value */
+ Lit16 =6, /* literal; .val[123] field has actual value */
+ NoValue =7 /* operand not in use */
+ }
+ Tag;
/* Invalid register numbers (can't be negative) */
#define INVALID_TEMPREG 999999999
@@ -480,6 +487,10 @@
/* Advance the simulated %eip by some small (< 128) number. */
INCEIP,
+ /* Dealing with segment registers */
+ GETSEG, PUTSEG, /* simulated segment register <--> TempReg */
+ USESEG, /* (LDT/GDT index, virtual addr) --> linear addr */
+
/* Not for translating x86 calls -- only to call helpers */
CALLM_S, CALLM_E, /* Mark start/end of CALLM push/pop sequence */
PUSH, POP, CLEAR, /* Add/remove/zap args for helpers */
@@ -526,7 +537,7 @@
CondBE = 6, /* below or equal */
CondNBE = 7, /* not below or equal */
CondS = 8, /* negative */
- ConsNS = 9, /* not negative */
+ CondNS = 9, /* not negative */
CondP = 10, /* parity even */
CondNP = 11, /* not parity even */
CondL = 12, /* jump less */
@@ -768,7 +779,7 @@
/* All this only necessary for skins with VG_(needs).extends_UCode == True. */
-/* This is the Intel register encoding. */
+/* This is the Intel register encoding -- integer regs. */
#define R_EAX 0
#define R_ECX 1
#define R_EDX 2
@@ -787,7 +798,16 @@
#define R_DH (4+R_EDX)
#define R_BH (4+R_EBX)
+/* This is the Intel register encoding -- segment regs. */
+#define R_ES 0
+#define R_CS 1
+#define R_SS 2
+#define R_DS 3
+#define R_FS 4
+#define R_GS 5
+
/* For pretty printing x86 code */
+extern Char* VG_(name_of_seg_reg) ( Int sreg );
extern Char* VG_(name_of_int_reg) ( Int size, Int reg );
extern Char VG_(name_of_int_size) ( Int size );