Skip to content

Commit 158242d

Browse files
junjiemao1lijinxia
authored andcommitted
HV: instr_emul: enforce unsignedness of VIE_OP constants
Translate the VIE_OP_* enum constants (which belong to an anonymous enum type) to macros to ensure that they are always unsigned. Signed-off-by: Junjie Mao <junjie.mao@intel.com>
1 parent 479dacc commit 158242d

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

hypervisor/arch/x86/guest/instr_emul.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,22 @@
3434
#include "instr_emul.h"
3535

3636
/* struct vie_op.op_type */
37-
enum {
38-
VIE_OP_TYPE_NONE = 0,
39-
VIE_OP_TYPE_MOV,
40-
VIE_OP_TYPE_MOVSX,
41-
VIE_OP_TYPE_MOVZX,
42-
VIE_OP_TYPE_AND,
43-
VIE_OP_TYPE_OR,
44-
VIE_OP_TYPE_SUB,
45-
VIE_OP_TYPE_TWO_BYTE,
46-
VIE_OP_TYPE_PUSH,
47-
VIE_OP_TYPE_CMP,
48-
VIE_OP_TYPE_POP,
49-
VIE_OP_TYPE_MOVS,
50-
VIE_OP_TYPE_GROUP1,
51-
VIE_OP_TYPE_STOS,
52-
VIE_OP_TYPE_BITTEST,
53-
VIE_OP_TYPE_TEST,
54-
VIE_OP_TYPE_LAST
55-
};
37+
#define VIE_OP_TYPE_NONE 0U
38+
#define VIE_OP_TYPE_MOV 1U
39+
#define VIE_OP_TYPE_MOVSX 2U
40+
#define VIE_OP_TYPE_MOVZX 3U
41+
#define VIE_OP_TYPE_AND 4U
42+
#define VIE_OP_TYPE_OR 5U
43+
#define VIE_OP_TYPE_SUB 6U
44+
#define VIE_OP_TYPE_TWO_BYTE 7U
45+
#define VIE_OP_TYPE_PUSH 8U
46+
#define VIE_OP_TYPE_CMP 9U
47+
#define VIE_OP_TYPE_POP 10U
48+
#define VIE_OP_TYPE_MOVS 11U
49+
#define VIE_OP_TYPE_GROUP1 12U
50+
#define VIE_OP_TYPE_STOS 13U
51+
#define VIE_OP_TYPE_BITTEST 14U
52+
#define VIE_OP_TYPE_TEST 15U
5653

5754
/* struct vie_op.op_flags */
5855
#define VIE_OP_F_IMM (1U << 0) /* 16/32-bit immediate operand */

0 commit comments

Comments
 (0)