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 1/2] target-arm: sort TCG cpreg list by 64bit id version
Date: Fri, 11 Oct 2013 19:38:44 +0200 [thread overview]
Message-ID: <1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com> (raw)
Both KVM and TCG populate the cpreg_list with 64 bit registers IDs, but in the TCG side the cpreg_list is sorted using the 32 bit id version while in the kvm side the 64 bit id version is used.
This patch makes the sorting of the cpreg_list consistent between KVM and TCG.
Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com>
---
target-arm/helper.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 2a98be7..834041e 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -225,10 +225,14 @@ static void count_cpreg(gpointer key, gpointer opaque)
static gint cpreg_key_compare(gconstpointer a, gconstpointer b)
{
- uint32_t aidx = *(uint32_t *)a;
- uint32_t bidx = *(uint32_t *)b;
-
- return aidx - bidx;
+ uint64_t aidx = cpreg_to_kvm_id(*(uint32_t *)a);
+ uint64_t bidx = cpreg_to_kvm_id(*(uint32_t *)b);
+
+ if (aidx > bidx)
+ return 1;
+ if (aidx < bidx)
+ return -1;
+ return 0;
}
static void cpreg_make_keylist(gpointer key, gpointer value, gpointer udata)
--
1.8.1.2
next reply other threads:[~2013-10-11 17:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 17:38 Alvise Rigo [this message]
2013-10-11 17:38 ` [Qemu-devel] [PATCH 2/2] target-arm: fix sorting iussue of KVM cpreg list Alvise Rigo
2013-10-11 18:41 ` [Qemu-devel] [PATCH 1/2] target-arm: sort TCG cpreg list by 64bit id version 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-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.