From d0f7f4d65800eb83d74d4906cc9b1f585e76a91d Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Mon, 22 Jul 2019 10:25:55 +0800 Subject: [PATCH] HV: Remove the mixed usage of inline assembly in wait_sync_change When monitor/mwait is not supported, it still uses the inline assembly in wait_sync_change. As it is not allowed based on MISRA-C, the asm wrapper is used for pause scenario in wait_sync_change. Tracked-On: #3442 Suggested-by: Li, Fei1 Acked-by: Anthony Xu Signed-off-by: Zhao Yakui --- hypervisor/arch/x86/cpu.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 9d5f8082f..7e1d5c1dc 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -439,16 +439,9 @@ void wait_sync_change(uint64_t *sync, uint64_t wake_sync) } } } else { - /* Wait for the event to be set using pause */ - asm volatile ("1: cmpq %%rbx,(%%rax)\n" - " je 2f\n" - " pause\n" - " jmp 1b\n" - "2:\n" - : - : "a" (sync), "d"(0), "c"(0), - "b"(wake_sync) - : "cc"); + while (*((volatile uint64_t *)sync) != wake_sync) { + asm_pause(); + } } }