From patchwork Thu Jul 16 18:02:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 496808 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C8DBB140280 for ; Fri, 17 Jul 2015 04:06:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=a9FsHVI+; dkim-atps=neutral Received: from localhost ([::1]:41396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFnXo-0005w4-RZ for incoming@patchwork.ozlabs.org; Thu, 16 Jul 2015 14:06:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFnV3-0001Vh-AX for qemu-devel@nongnu.org; Thu, 16 Jul 2015 14:03:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFnV2-0002rC-9q for qemu-devel@nongnu.org; Thu, 16 Jul 2015 14:03:13 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:34812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFnV2-0002qy-2k; Thu, 16 Jul 2015 14:03:12 -0400 Received: by wibud3 with SMTP id ud3so21686178wib.1; Thu, 16 Jul 2015 11:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=e0qmzlEQzB0AHp+Mwj10VzU6lLInjL6wp0LkYZUJwK4=; b=a9FsHVI+K0RHilUFwVbbTSJpbIyrCMTbmtaVtfUmbnAttnnRw/R5LQPGY6Eb3o1J1b 1VX5MTaDW1U3hKIbh47c4DuDY5orvCBGDyNYSFAUt1SC0P/B5iGNqgBHMumLNHWSCeVV z9s4/bPaiq4xjC86vxn1TYx3Vhk0AQM+wPJPrD/U2soLpQv2oOBuwKZwv4oY3IoFHCZH +JgWFglCEIYVPlN1mrd9DHEmWYZUzGvuWmRwTG16nYTImtXD4FKVveYW9eZxmlMZvYyW sNXxILVF7fBuYvtLian1WDNtI2E/pWnJNUj3HNTqkOsTU7i1nq1uy9v7+skUgrljIYxM giwQ== X-Received: by 10.181.13.36 with SMTP id ev4mr7446019wid.65.1437069791467; Thu, 16 Jul 2015 11:03:11 -0700 (PDT) Received: from donizetti.redhat.com (host231-210-dynamic.21-79-r.retail.telecomitalia.it. [79.21.210.231]) by smtp.gmail.com with ESMTPSA id l2sm4422399wib.11.2015.07.16.11.03.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 11:03:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 16 Jul 2015 20:02:52 +0200 Message-Id: <1437069778-8954-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1437069778-8954-1-git-send-email-pbonzini@redhat.com> References: <1437069778-8954-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::229 Cc: James Hogan , Leon Alrae , kvm@vger.kernel.org, Aurelien Jarno , qemu-stable@nongnu.org Subject: [Qemu-devel] [PULL 2/8] mips/kvm: Sign extend registers written to KVM 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 From: James Hogan In case we're running on a 64-bit host, be sure to sign extend the general purpose registers and hi/lo/pc before writing them to KVM, so as to take advantage of MIPS32/MIPS64 compatibility. Signed-off-by: James Hogan Cc: Paolo Bonzini Cc: Leon Alrae Cc: Aurelien Jarno Cc: kvm@vger.kernel.org Cc: qemu-stable@nongnu.org Message-Id: <1429871214-23514-3-git-send-email-james.hogan@imgtec.com> Signed-off-by: Paolo Bonzini --- target-mips/kvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 85256f3..d287d42 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -628,12 +628,12 @@ int kvm_arch_put_registers(CPUState *cs, int level) /* Set the registers based on QEMU's view of things */ for (i = 0; i < 32; i++) { - regs.gpr[i] = env->active_tc.gpr[i]; + regs.gpr[i] = (int64_t)(target_long)env->active_tc.gpr[i]; } - regs.hi = env->active_tc.HI[0]; - regs.lo = env->active_tc.LO[0]; - regs.pc = env->active_tc.PC; + regs.hi = (int64_t)(target_long)env->active_tc.HI[0]; + regs.lo = (int64_t)(target_long)env->active_tc.LO[0]; + regs.pc = (int64_t)(target_long)env->active_tc.PC; ret = kvm_vcpu_ioctl(cs, KVM_SET_REGS, ®s);