From mboxrd@z Thu Jan 1 00:00:00 1970 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 Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 16 Jul 2015 20:02:52 +0200 Message-Id: <1437069778-8954-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1437069778-8954-1-git-send-email-pbonzini@redhat.com> References: <1437069778-8954-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 2/8] mips/kvm: Sign extend registers written to KVM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: James Hogan , Leon Alrae , kvm@vger.kernel.org, Aurelien Jarno , qemu-stable@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); -- 2.4.3