39
39
* Within the following groups,register name need to be
40
40
* kept in order:
41
41
* General register names group (CPU_REG_RAX~CPU_REG_RDI);
42
- * Non general register names group (CPU_REG_CR0~CPU_REG_LAST );
42
+ * Non general register names group (CPU_REG_CR0~CPU_REG_GDTR );
43
43
* Segement register names group (CPU_REG_ES~CPU_REG_GS).
44
- *
45
- * CPU_REG_NATURAL_LAST indicates in the non general register names
46
- * group the register name (less than CPU_REG_NATURAL_last) is
47
- * corresponds to the natural width field in VMCS;
48
- *
49
- * CPU_REG_64BIT_LAST indicates in the non general register names
50
- * group the register name (less than CPU_REG_64BIT_LAST and more than
51
- * CPU_REG_NATURAL_last) corresponds to the 64-bit field in VMCS.
52
- *
53
- * CPU_REG_LAST indicates the last register name.
54
- *
55
44
*/
56
45
enum cpu_reg_name {
57
46
CPU_REG_RAX ,
@@ -77,13 +66,13 @@ enum cpu_reg_name {
77
66
CPU_REG_RSP ,
78
67
CPU_REG_RIP ,
79
68
CPU_REG_RFLAGS ,
80
- CPU_REG_NATURAL_LAST ,
69
+ /* CPU_REG_NATURAL_LAST*/
81
70
CPU_REG_EFER ,
82
71
CPU_REG_PDPTE0 ,
83
72
CPU_REG_PDPTE1 ,
84
73
CPU_REG_PDPTE2 ,
85
74
CPU_REG_PDPTE3 ,
86
- CPU_REG_64BIT_LAST ,
75
+ /* CPU_REG_64BIT_LAST,*/
87
76
CPU_REG_ES ,
88
77
CPU_REG_CS ,
89
78
CPU_REG_SS ,
@@ -93,10 +82,61 @@ enum cpu_reg_name {
93
82
CPU_REG_LDTR ,
94
83
CPU_REG_TR ,
95
84
CPU_REG_IDTR ,
96
- CPU_REG_GDTR ,
97
- CPU_REG_LAST
85
+ CPU_REG_GDTR
86
+ /* CPU_REG_LAST*/
98
87
};
99
88
89
+ /**
90
+ * Define the following MACRO to make range checking clear.
91
+ *
92
+ * CPU_REG_FIRST indicates the first register name, its value
93
+ * is the same as CPU_REG_RAX;
94
+ * CPU_REG_LAST indicates the last register name, its value is
95
+ * the same as CPU_REG_GDTR;
96
+ *
97
+ * CPU_REG_GENERAL_FIRST indicates the first general register name,
98
+ * its value is the same as CPU_REG_RAX;
99
+ * CPU_REG_GENERAL_LAST indicates the last general register name,
100
+ * its value is the same as CPU_REG_RDI;
101
+ *
102
+ * CPU_REG_NONGENERAL_FIRST indicates the first non general register
103
+ * name, its value is the same as CPU_REG_CR0;
104
+ * CPU_REG_NONGENERAL_LAST indicates the last non general register
105
+ * name, its value is the same as CPU_REG_GDTR;
106
+ *
107
+ * CPU_REG_NATURAL_FIRST indicates the first register name that
108
+ * is corresponds to the natural width field in VMCS, its value
109
+ * is the same as CPU_REG_CR0;
110
+ * CPU_REG_NATURAL_LAST indicates the last register name that
111
+ * is corresponds to the natural width field in VMCS, its value
112
+ * is the same as CPU_REG_RFLAGS;
113
+ *
114
+ * CPU_REG_64BIT_FIRST indicates the first register name that
115
+ * is corresponds to the 64 bit field in VMCS, its value
116
+ * is the same as CPU_REG_EFER;
117
+ * CPU_REG_64BIT_LAST indicates the last register name that
118
+ * is corresponds to the 64 bit field in VMCS, its value
119
+ * is the same as CPU_REG_PDPTE3;
120
+ *
121
+ * CPU_REG_SEG_FIRST indicates the first segement register name,
122
+ * its value is the same as CPU_REG_ES;
123
+ * CPU_REG_SEG_FIRST indicates the last segement register name,
124
+ * its value is the same as CPU_REG_GS
125
+ *
126
+ */
127
+ #define CPU_REG_FIRST CPU_REG_RAX
128
+ #define CPU_REG_LAST CPU_REG_GDTR
129
+ #define CPU_REG_GENERAL_FIRST CPU_REG_RAX
130
+ #define CPU_REG_GENERAL_LAST CPU_REG_RDI
131
+ #define CPU_REG_NONGENERAL_FIRST CPU_REG_CR0
132
+ #define CPU_REG_NONGENERAL_LAST CPU_REG_GDTR
133
+ #define CPU_REG_NATURAL_FIRST CPU_REG_CR0
134
+ #define CPU_REG_NATURAL_LAST CPU_REG_RFLAGS
135
+ #define CPU_REG_64BIT_FIRST CPU_REG_EFER
136
+ #define CPU_REG_64BIT_LAST CPU_REG_PDPTE3
137
+ #define CPU_REG_SEG_FIRST CPU_REG_ES
138
+ #define CPU_REG_SEG_LAST CPU_REG_GS
139
+
100
140
struct vie_op {
101
141
uint8_t op_byte ; /* actual opcode byte */
102
142
uint8_t op_type ; /* type of operation (e.g. MOV) */
0 commit comments