aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvise Rigo <a.rigo@virtualopensystems.com>2013-10-11 19:38:45 +0200
committerPeter Maydell <peter.maydell@linaro.org>2013-10-25 17:38:34 +0100
commit26317bf4f777bf019a6aa12ba7cef2e4e8590d73 (patch)
tree626dacaadc4d6e5971f4dcbf0df83bd5bef459ee
parent55178a8ca03ed1aecc9acfaeb846f2c7e01fad01 (diff)
target-arm: fix sorting issue of KVM cpreg list
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 <a.rigo@virtualopensystems.com> Message-id: 1381513125-26802-2-git-send-email-a.rigo@virtualopensystems.com [PMM: fixed coding style, indent and commit message formatting] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target-arm/kvm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index b92e00dae0..6e5cd36fae 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -67,7 +67,13 @@ 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)