Skip to content

Commit

Permalink
target-arm: fix sorting issue of KVM cpreg list
Browse files Browse the repository at this point in the history
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 <[email protected]>
Message-id: [email protected]
[PMM: fixed coding style, indent and commit message formatting]
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
arigo-vos authored and edgarigl committed Oct 31, 2013
1 parent cbf239b commit 0bc2a33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion target-arm/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0bc2a33

Please sign in to comment.