From: Alvise Rigo <a.rigo@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
tech@virtualopensystems.com, Paul Brook <paul@codesourcery.com>,
Alvise Rigo <a.rigo@virtualopensystems.com>
Subject: [Qemu-devel] [PATCH 2/2] target-arm: fix sorting iussue of KVM cpreg list
Date: Fri, 11 Oct 2013 19:38:45 +0200 [thread overview]
Message-ID: <1381513125-26802-2-git-send-email-a.rigo@virtualopensystems.com> (raw)
In-Reply-To: <1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com>
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>
---
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
next prev parent reply other threads:[~2013-10-11 17:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 17:38 [Qemu-devel] [PATCH 1/2] target-arm: sort TCG cpreg list by 64bit id version Alvise Rigo
2013-10-11 17:38 ` Alvise Rigo [this message]
2013-10-11 18:41 ` Peter Maydell
2013-10-14 10:45 ` alvise rigo
2013-10-14 11:09 ` Peter Maydell
2013-10-25 16:59 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381513125-26802-2-git-send-email-a.rigo@virtualopensystems.com \
--to=a.rigo@virtualopensystems.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tech@virtualopensystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).