From patchwork Fri Oct 11 17:38:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvise Rigo X-Patchwork-Id: 282877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 098862C016B for ; Sat, 12 Oct 2013 04:41:22 +1100 (EST) Received: from localhost ([::1]:55639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUgiG-0001Aj-LI for incoming@patchwork.ozlabs.org; Fri, 11 Oct 2013 13:41:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUggt-0008V5-NB for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUggn-0003QD-Nx for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:39:55 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:41845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUggn-0003Q4-Ht for qemu-devel@nongnu.org; Fri, 11 Oct 2013 13:39:49 -0400 Received: by mail-wg0-f53.google.com with SMTP id y10so2235979wgg.8 for ; Fri, 11 Oct 2013 10:39:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jw6q9xwNvbK5XkfXqXgYNglwBimJJat20Hb8yg0Wtj0=; b=UrHD/usZ8Fc8X7BerGMRv6pnJNlfV/YCVKC7O8t6yIwFH49CFc+R8EA5ZJE19PKc93 M2atvWbgmeALOCP/6+6909J1SN1SjFQeEJJuhSDP+7DZOja7RHZ9rtrj2/Tg21px/kpK HLYOIOX3yMmvRbs3ZsqEwUHX5+hHXIClF5/hXLEBBDGvv2d+pZrDMd4+gREI1d8+bzsi jzXLdS1345soU5xOnsDmvTl2dY2DCzBfjwx9tEQlOG7HZ93aosomIZTQypHS8BdrD7Ec QlEPt9xG9pLqvOaqA5FsR5qVkdiNJaV5jDLju+2MvMePRYF8MnmEmBJRRnZIe8+UK+LD U16A== X-Gm-Message-State: ALoCoQloC/zlbgKYIH/SZ0lpYGHnToGzbgUXe8I/y/0Wg7Cp2uMmll2tWA7Kkyn8EPhiy2pVCZdc X-Received: by 10.180.36.36 with SMTP id n4mr4133566wij.62.1381513188835; Fri, 11 Oct 2013 10:39:48 -0700 (PDT) Received: from localhost.localdomain (AGrenoble-651-1-495-107.w82-122.abo.wanadoo.fr. [82.122.55.107]) by mx.google.com with ESMTPSA id mw9sm8133018wib.0.2013.10.11.10.39.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 10:39:48 -0700 (PDT) From: Alvise Rigo To: qemu-devel@nongnu.org Date: Fri, 11 Oct 2013 19:38:45 +0200 Message-Id: <1381513125-26802-2-git-send-email-a.rigo@virtualopensystems.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com> References: <1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.53 Cc: Peter Maydell , tech@virtualopensystems.com, Paul Brook , Alvise Rigo Subject: [Qemu-devel] [PATCH 2/2] target-arm: fix sorting iussue of KVM cpreg list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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)