[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] target-arm: fix sorting iussue of KVM cpreg lis
From: |
Alvise Rigo |
Subject: |
[Qemu-devel] [PATCH 2/2] target-arm: fix sorting iussue of KVM cpreg list |
Date: |
Fri, 11 Oct 2013 19:38:45 +0200 |
The compare_u64 function was not sorting the KVM cpreg_list in the right way
due to the wrong returned value. Since we are comparing two 64bit values we
can't simply return their difference if the returned type is int.
Signed-off-by: Alvise Rigo <address@hidden>
---
target-arm/kvm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index b92e00d..9120f72 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -67,7 +67,11 @@ static bool reg_syncs_via_tuple_list(uint64_t regidx)
static int compare_u64(const void *a, const void *b)
{
- return *(uint64_t *)a - *(uint64_t *)b;
+ if (*(uint64_t *)a > *(uint64_t *)b)
+ return 1;
+ if (*(uint64_t *)a < *(uint64_t *)b)
+ return -1;
+ return 0;
}
int kvm_arch_init_vcpu(CPUState *cs)
--
1.8.1.2