mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-06 19:30:46 +00:00
hv: remove the theoretic infinite loop
There may the theoretic infinite loop with some code. But actually it doesn't. This patch make these code more obvious it's not a potentially infinite loop. Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -1669,9 +1669,9 @@ static bool segment_override(uint8_t x, enum cpu_reg_name *seg)
|
||||
static int decode_prefixes(struct instr_emul_vie *vie,
|
||||
enum vm_cpu_mode cpu_mode, bool cs_d)
|
||||
{
|
||||
uint8_t x;
|
||||
uint8_t x, i;
|
||||
|
||||
while (1) {
|
||||
for (i = 0U; i < VIE_PREFIX_SIZE; i++) {
|
||||
if (vie_peek(vie, &x) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@@ -87,7 +87,8 @@ struct instr_emul_vie_op {
|
||||
uint16_t op_flags;
|
||||
};
|
||||
|
||||
#define VIE_INST_SIZE 15U
|
||||
#define VIE_PREFIX_SIZE 4U
|
||||
#define VIE_INST_SIZE 15U
|
||||
struct instr_emul_vie {
|
||||
uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */
|
||||
uint8_t num_valid; /* size of the instruction */
|
||||
|
@@ -35,8 +35,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data)
|
||||
struct smp_call_info_data *smp_call;
|
||||
|
||||
/* wait for previous smp call complete, which may run on other cpus */
|
||||
while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX)
|
||||
!= 0UL);
|
||||
while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX) != 0UL);
|
||||
pcpu_id = ffs64(mask);
|
||||
while (pcpu_id != INVALID_BIT_INDEX) {
|
||||
bitmap_clear_nolock(pcpu_id, &mask);
|
||||
|
@@ -99,7 +99,7 @@ void do_acpi_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val,
|
||||
acpi_gas_write(&(sx_data->pm1b_cnt), pm1b_cnt_val);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
/* polling PM1 state register to detect wether
|
||||
* the Sx state enter is interrupted by wakeup event.
|
||||
*/
|
||||
@@ -117,10 +117,7 @@ void do_acpi_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val,
|
||||
* WAK_STS(bit 15) is set if system will transition to working
|
||||
* state.
|
||||
*/
|
||||
if ((s1 & (1U << BIT_WAK_STS)) != 0U) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while ((s1 & (1U << BIT_WAK_STS)) == 0U);
|
||||
}
|
||||
|
||||
void enter_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val, uint32_t pm1b_cnt_val)
|
||||
|
Reference in New Issue
Block a user