@@ -55,11 +55,11 @@ enum {
55
55
};
56
56
57
57
/* struct vie_op.op_flags */
58
- #define VIE_OP_F_IMM (1 << 0) /* 16/32-bit immediate operand */
59
- #define VIE_OP_F_IMM8 (1 << 1) /* 8-bit immediate operand */
60
- #define VIE_OP_F_MOFFSET (1 << 2) /* 16/32/64-bit immediate moffset */
61
- #define VIE_OP_F_NO_MODRM (1 << 3)
62
- #define VIE_OP_F_NO_GLA_VERIFICATION (1 << 4)
58
+ #define VIE_OP_F_IMM (1U << 0) /* 16/32-bit immediate operand */
59
+ #define VIE_OP_F_IMM8 (1U << 1) /* 8-bit immediate operand */
60
+ #define VIE_OP_F_MOFFSET (1U << 2) /* 16/32/64-bit immediate moffset */
61
+ #define VIE_OP_F_NO_MODRM (1U << 3)
62
+ #define VIE_OP_F_NO_GLA_VERIFICATION (1U << 4)
63
63
64
64
static const struct vie_op two_byte_opcodes [256 ] = {
65
65
[0xB6 ] = {
@@ -272,9 +272,9 @@ vie_calc_bytereg(struct vie *vie, enum vm_reg_name *reg, int *lhbr)
272
272
* %ah, %ch, %dh and %bh respectively.
273
273
*/
274
274
if (vie -> rex_present == 0U ) {
275
- if ((vie -> reg & 0x4 ) != 0U ) {
275
+ if ((vie -> reg & 0x4U ) != 0U ) {
276
276
* lhbr = 1 ;
277
- * reg = gpr_map [vie -> reg & 0x3 ];
277
+ * reg = gpr_map [vie -> reg & 0x3U ];
278
278
}
279
279
}
280
280
}
@@ -1343,7 +1343,7 @@ emulate_push(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie,
1343
1343
* PUSH is part of the group 5 extended opcodes and is identified
1344
1344
* by ModRM:reg = b110.
1345
1345
*/
1346
- if ((vie -> reg & 7 ) != 6 )
1346
+ if ((vie -> reg & 7U ) != 6 )
1347
1347
return - EINVAL ;
1348
1348
1349
1349
error = emulate_stack_op (vcpu , mmio_gpa , vie , paging , memread ,
@@ -1364,7 +1364,7 @@ emulate_pop(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie,
1364
1364
* POP is part of the group 1A extended opcodes and is identified
1365
1365
* by ModRM:reg = b000.
1366
1366
*/
1367
- if ((vie -> reg & 7 ) != 0 )
1367
+ if ((vie -> reg & 7U ) != 0 )
1368
1368
return - EINVAL ;
1369
1369
1370
1370
error = emulate_stack_op (vcpu , mmio_gpa , vie , paging , memread ,
@@ -1380,16 +1380,16 @@ emulate_group1(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
1380
1380
{
1381
1381
int error ;
1382
1382
1383
- switch (vie -> reg & 7 ) {
1384
- case 0x1 : /* OR */
1383
+ switch (vie -> reg & 7U ) {
1384
+ case 0x1U : /* OR */
1385
1385
error = emulate_or (vcpu , gpa , vie ,
1386
1386
memread , memwrite , memarg );
1387
1387
break ;
1388
- case 0x4 : /* AND */
1388
+ case 0x4U : /* AND */
1389
1389
error = emulate_and (vcpu , gpa , vie ,
1390
1390
memread , memwrite , memarg );
1391
1391
break ;
1392
- case 0x7 : /* CMP */
1392
+ case 0x7U : /* CMP */
1393
1393
error = emulate_cmp (vcpu , gpa , vie ,
1394
1394
memread , memwrite , memarg );
1395
1395
break ;
@@ -1415,7 +1415,7 @@ emulate_bittest(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
1415
1415
* Currently we only emulate the 'Bit Test' instruction which is
1416
1416
* identified by a ModR/M:reg encoding of 100b.
1417
1417
*/
1418
- if ((vie -> reg & 7 ) != 4 )
1418
+ if ((vie -> reg & 7U ) != 4 )
1419
1419
return - EINVAL ;
1420
1420
1421
1421
error = vie_read_register (vcpu , VM_REG_GUEST_RFLAGS , & rflags );
@@ -1607,7 +1607,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg,
1607
1607
1608
1608
if ((prot & PROT_READ ) != 0 ) {
1609
1609
/* #GP on a read access to a exec-only code segment */
1610
- if ((type & 0xA ) == 0x8 )
1610
+ if ((type & 0xAU ) == 0x8U )
1611
1611
return -1 ;
1612
1612
}
1613
1613
@@ -1616,18 +1616,18 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg,
1616
1616
* #GP on a write access to a code segment or a
1617
1617
* read-only data segment.
1618
1618
*/
1619
- if ((type & 0x8 ) != 0 ) /* code segment */
1619
+ if ((type & 0x8U ) != 0 ) /* code segment */
1620
1620
return -1 ;
1621
1621
1622
- if ((type & 0xA ) == 0 ) /* read-only data seg */
1622
+ if ((type & 0xAU ) == 0 ) /* read-only data seg */
1623
1623
return -1 ;
1624
1624
}
1625
1625
1626
1626
/*
1627
1627
* 'desc->limit' is fully expanded taking granularity into
1628
1628
* account.
1629
1629
*/
1630
- if ((type & 0xC ) == 0x4 ) {
1630
+ if ((type & 0xCU ) == 0x4U ) {
1631
1631
/* expand-down data segment */
1632
1632
low_limit = desc -> limit + 1 ;
1633
1633
high_limit = SEG_DESC_DEF32 (desc -> access ) ?
@@ -1786,10 +1786,10 @@ decode_prefixes(struct vie *vie, enum vm_cpu_mode cpu_mode, int cs_d)
1786
1786
*/
1787
1787
if (cpu_mode == CPU_MODE_64BIT && x >= 0x40 && x <= 0x4F ) {
1788
1788
vie -> rex_present = 1 ;
1789
- vie -> rex_w = (x & 0x8 ) != 0U ? 1 : 0 ;
1790
- vie -> rex_r = (x & 0x4 ) != 0U ? 1 : 0 ;
1791
- vie -> rex_x = (x & 0x2 ) != 0U ? 1 : 0 ;
1792
- vie -> rex_b = (x & 0x1 ) != 0U ? 1 : 0 ;
1789
+ vie -> rex_w = (x & 0x8U ) != 0U ? 1 : 0 ;
1790
+ vie -> rex_r = (x & 0x4U ) != 0U ? 1 : 0 ;
1791
+ vie -> rex_x = (x & 0x2U ) != 0U ? 1 : 0 ;
1792
+ vie -> rex_b = (x & 0x1U ) != 0U ? 1 : 0 ;
1793
1793
vie_advance (vie );
1794
1794
}
1795
1795
@@ -1872,9 +1872,9 @@ decode_modrm(struct vie *vie, enum vm_cpu_mode cpu_mode)
1872
1872
if (vie_peek (vie , & x ) != 0 )
1873
1873
return -1 ;
1874
1874
1875
- vie -> mod = (x >> 6 ) & 0x3 ;
1876
- vie -> rm = (x >> 0 ) & 0x7 ;
1877
- vie -> reg = (x >> 3 ) & 0x7 ;
1875
+ vie -> mod = (x >> 6 ) & 0x3U ;
1876
+ vie -> rm = (x >> 0 ) & 0x7U ;
1877
+ vie -> reg = (x >> 3 ) & 0x7U ;
1878
1878
1879
1879
/*
1880
1880
* A direct addressing mode makes no sense in the context of an EPT
@@ -1954,9 +1954,9 @@ decode_sib(struct vie *vie)
1954
1954
return -1 ;
1955
1955
1956
1956
/* De-construct the SIB byte */
1957
- vie -> ss = (x >> 6 ) & 0x3 ;
1958
- vie -> index = (x >> 3 ) & 0x7 ;
1959
- vie -> base = (x >> 0 ) & 0x7 ;
1957
+ vie -> ss = (x >> 6 ) & 0x3U ;
1958
+ vie -> index = (x >> 3 ) & 0x7U ;
1959
+ vie -> base = (x >> 0 ) & 0x7U ;
1960
1960
1961
1961
/* Apply the REX prefix modifiers */
1962
1962
vie -> index |= vie -> rex_x << 3 ;
0 commit comments