From: Michael Roth Subject: [PATCH 44/53] mips/kvm: Sign extend registers written to KVM Date: Thu, 30 Jul 2015 06:32:59 -0500 Message-ID: <1438255988-10418-45-git-send-email-mdroth@linux.vnet.ibm.com> References: <1438255988-10418-1-git-send-email-mdroth@linux.vnet.ibm.com> Cc: qemu-stable@nongnu.org, James Hogan , Paolo Bonzini , Leon Alrae , Aurelien Jarno , kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from e39.co.us.ibm.com ([32.97.110.160]:46150 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754245AbbG3Lfv (ORCPT ); Thu, 30 Jul 2015 07:35:51 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Jul 2015 05:35:50 -0600 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 891EE6E801D for ; Thu, 30 Jul 2015 07:27:34 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t6UBZmZQ54067388 for ; Thu, 30 Jul 2015 11:35:48 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t6UBZlr0014662 for ; Thu, 30 Jul 2015 07:35:48 -0400 In-Reply-To: <1438255988-10418-1-git-send-email-mdroth@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 (cherry picked from commit 02dae26ac4ceb1e82c432cfca4d9b65ae82343c6) Signed-off-by: Michael Roth --- 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 1597bbe..d5388ca 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -633,12 +633,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); -- 1.9.1