mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
hv: instr_emul: fix 'Parameter indexing array too big at call'
- explicitly declare the array size of 'size2mask[]' otherwise, the static checking tool treats the array size to be 4, so that it complains when accessing index '4' or '8' - unify the comments style and make sure the line length less than 80 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
84d320d49c
commit
f4ca3cc571
@ -233,7 +233,7 @@ static enum cpu_reg_name gpr_map[16] = {
|
||||
CPU_REG_R15
|
||||
};
|
||||
|
||||
static uint64_t size2mask[] = {
|
||||
static uint64_t size2mask[9] = {
|
||||
[1] = 0xffUL,
|
||||
[2] = 0xffffUL,
|
||||
[4] = 0xffffffffUL,
|
||||
@ -1312,7 +1312,8 @@ emulate_stack_op(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie,
|
||||
pr_err("TODO: inject ss exception");
|
||||
}
|
||||
|
||||
if (vie_alignment_check(paging->cpl, size, cr0, rflags, stack_gla) != 0) {
|
||||
if (vie_alignment_check(paging->cpl, size, cr0, rflags, stack_gla)
|
||||
!= 0) {
|
||||
/*vm_inject_ac(vcpu, 0);*/
|
||||
pr_err("TODO: inject ac exception");
|
||||
return 0;
|
||||
@ -1545,7 +1546,8 @@ vmm_emulate_instruction(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
|
||||
}
|
||||
|
||||
int
|
||||
vie_alignment_check(uint8_t cpl, uint8_t size, uint64_t cr0, uint64_t rf, uint64_t gla)
|
||||
vie_alignment_check(uint8_t cpl, uint8_t size, uint64_t cr0, uint64_t rf,
|
||||
uint64_t gla)
|
||||
{
|
||||
ASSERT(size == 1U || size == 2U || size == 4U || size == 8U,
|
||||
"%s: invalid size %hhu", __func__, size);
|
||||
@ -1589,8 +1591,8 @@ vie_size2mask(uint8_t size)
|
||||
|
||||
int
|
||||
vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum cpu_reg_name seg,
|
||||
struct seg_desc *desc, uint64_t offset, uint8_t length, uint8_t addrsize,
|
||||
uint32_t prot, uint64_t *gla)
|
||||
struct seg_desc *desc, uint64_t offset, uint8_t length,
|
||||
uint8_t addrsize, uint32_t prot, uint64_t *gla)
|
||||
{
|
||||
uint64_t firstoff, low_limit, high_limit, segbase;
|
||||
uint8_t glasize;
|
||||
|
Loading…
Reference in New Issue
Block a user