From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUggg-0008HV-PU for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:39:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUgga-0003Oz-CL for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:39:42 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:56568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUgga-0003Om-6a for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:39:36 -0400 Received: by mail-wg0-f49.google.com with SMTP id x12so2139114wgg.4 for ; Fri, 11 Oct 2013 10:39:35 -0700 (PDT) From: Alvise Rigo Date: Fri, 11 Oct 2013 19:38:44 +0200 Message-Id: <1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [PATCH 1/2] target-arm: sort TCG cpreg list by 64bit id version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , tech@virtualopensystems.com, Paul Brook , Alvise Rigo 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 --- 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