Thread (1 message) 1 message, 1 author, 2007-06-18

Re: [PATCH 3/5] KVM: Add paravirt MMU write support

From: Avi Kivity <hidden>
Date: 2007-06-18 08:20:49
Also in: kvm

Anthony Liguori wrote:
+static int kvm_hypercall_mmu_write(struct kvm_vcpu *vcpu, gva_t addr,
+				   unsigned long size, unsigned long a0,
+				   unsigned long a1)
+{
+	gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr);
+	u64 value;
+
+	if (gpa == UNMAPPED_GVA)
+		return -EFAULT;
+	if (size == 1) {
+		if (!emulator_write_phys(vcpu, gpa, &a0, sizeof(a0)))
+			return -EFAULT;
+	} else if (size == 2) {
+		value = (u64)a1 << 32 | a0;
+		if (!emulator_write_phys(vcpu, gpa, &value, sizeof(value)))
+			return -EFAULT;
+	} else
+		return -E2BIG;
+
+	return 0;
+}
Hypercalls should return kvm-specific error codes (defined in 
include/linux/kvm_para.h), not Linux error codes, as they could be used 
in operating systems which have different values for E2BIG and friends.
+static void kvm_pte_clear(struct mm_struct *mm,
+			  unsigned long addr, pte_t *ptep)
+{
+	pte_t pte = {0};
  
Surely there's a nice macro for creating a pte from an int?

Any performance measurement?

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


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help