Re: [PATCH 03/18] KVM: PPC: Teach MMIO Signedness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/04/2010 05:55 PM, Alexander Graf wrote:
The guest I was trying to get to run uses the LHA and LHAU instructions.
Those instructions basically do a load, but also sign extend the result.

Since we need to fill our registers by hand when doing MMIO, we also need
to sign extend manually.

This patch implements sign extended MMIO and the LHA(U) instructions.

@@ -300,6 +300,25 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
  		}
  	}

+	if (vcpu->arch.mmio_sign_extend) {
+		switch (run->mmio.len) {
+#ifdef CONFIG_PPC64
+		case 4:
+			if (gpr&  0x80000000)
+				gpr |= 0xffffffff00000000ULL;
+			break;

Wouldn't

  gpr = (s64)(gpr << 32) >> 32;

work?  Not sure if >> is guaranteed to sign extend.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux