From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: [PATCH 4/6] Consolidate the various functions that read and write guest memory Date: Mon, 30 Jul 2007 11:37:58 +0200 Message-ID: <46ADB176.9020602@bull.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0875069115==" To: kvm-devel Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============0875069115== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigBA8913E82B831049B7FB6DFC" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBA8913E82B831049B7FB6DFC Content-Type: multipart/mixed; boundary="------------010007010307040205080002" This is a multi-part message in MIME format. --------------010007010307040205080002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable emulator_write_emulated() uses struct kvm_vcpu instead of x86_emulate_ctx= t to be called in place of kvm_write_guest(). Signed-off-by: Laurent Vivier --=20 ------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org -------------- "Software is hard" - Donald Knuth --------------010007010307040205080002 Content-Type: text/plain; name="write_emulated-vcpu" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="write_emulated-vcpu" Index: kvm/drivers/kvm/kvm_main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- kvm.orig/drivers/kvm/kvm_main.c 2007-07-30 10:49:39.000000000 +0200 +++ kvm/drivers/kvm/kvm_main.c 2007-07-30 10:50:20.000000000 +0200 @@ -978,7 +978,7 @@ static int emulator_write_std(unsigned long addr, const void *val, unsigned int bytes, - struct x86_emulate_ctxt *ctxt) + struct kvm_vcpu *vcpu) { printk(KERN_ERR "emulator_write_std: addr %lx n %d\n", addr, bytes); @@ -1061,9 +1061,8 @@ static int emulator_write_emulated_onepage(unsigned long addr, const void *val, unsigned int bytes, - struct x86_emulate_ctxt *ctxt) + struct kvm_vcpu *vcpu) { - struct kvm_vcpu *vcpu =3D ctxt->vcpu; struct kvm_io_device *mmio_dev; gpa_t gpa =3D vcpu->mmu.gva_to_gpa(vcpu, addr); =20 @@ -1096,21 +1095,21 @@ static int emulator_write_emulated(unsigned long addr, const void *val, unsigned int bytes, - struct x86_emulate_ctxt *ctxt) + struct kvm_vcpu *vcpu) { /* Crossing a page boundary? */ if (((addr + bytes - 1) ^ addr) & PAGE_MASK) { int rc, now; =20 now =3D -addr & ~PAGE_MASK; - rc =3D emulator_write_emulated_onepage(addr, val, now, ctxt); + rc =3D emulator_write_emulated_onepage(addr, val, now, vcpu); if (rc !=3D X86EMUL_CONTINUE) return rc; addr +=3D now; val +=3D now; bytes -=3D now; } - return emulator_write_emulated_onepage(addr, val, bytes, ctxt); + return emulator_write_emulated_onepage(addr, val, bytes, vcpu); } =20 static int emulator_cmpxchg_emulated(unsigned long addr, @@ -1125,7 +1124,7 @@ reported =3D 1; printk(KERN_WARNING "kvm: emulating exchange as write\n"); } - return emulator_write_emulated(addr, new, bytes, ctxt); + return emulator_write_emulated(addr, new, bytes, ctxt->vcpu); } =20 static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg) Index: kvm/drivers/kvm/x86_emulate.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- kvm.orig/drivers/kvm/x86_emulate.c 2007-07-30 10:49:38.000000000 +020= 0 +++ kvm/drivers/kvm/x86_emulate.c 2007-07-30 10:50:20.000000000 +0200 @@ -1058,7 +1058,7 @@ if ((rc =3D ops->write_std( register_address(ctxt->ss_base, _regs[VCPU_REGS_RSP]), - &dst.val, dst.bytes, ctxt)) !=3D 0) + &dst.val, dst.bytes, ctxt->vcpu)) !=3D 0) goto done; no_wb =3D 1; break; @@ -1097,7 +1097,7 @@ else rc =3D ops->write_emulated((unsigned long)dst.ptr, &dst.val, dst.bytes, - ctxt); + ctxt->vcpu); if (rc !=3D 0) goto done; default: Index: kvm/drivers/kvm/x86_emulate.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- kvm.orig/drivers/kvm/x86_emulate.h 2007-07-30 10:49:38.000000000 +020= 0 +++ kvm/drivers/kvm/x86_emulate.h 2007-07-30 10:50:20.000000000 +0200 @@ -71,7 +71,7 @@ * @bytes: [IN ] Number of bytes to write to memory. */ int (*write_std)(unsigned long addr, const void *val, - unsigned int bytes, struct x86_emulate_ctxt * ctxt); + unsigned int bytes, struct kvm_vcpu *vcpu); =20 /* * read_emulated: Read bytes from emulated/special memory area. @@ -94,7 +94,7 @@ int (*write_emulated) (unsigned long addr, const void *val, unsigned int bytes, - struct x86_emulate_ctxt * ctxt); + struct kvm_vcpu *vcpu); =20 /* * cmpxchg_emulated: Emulate an atomic (LOCKed) CMPXCHG operation on an= --------------010007010307040205080002-- --------------enigBA8913E82B831049B7FB6DFC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.7 (GNU/Linux) iD8DBQFGrbF29Kffa9pFVzwRAgWZAJ9OO8Qp3fVe2GxnFYxG0Wf2gsLV0wCeMXWH HHcW6hDAC6oCvtTSX3jr8DI= =mkLM -----END PGP SIGNATURE----- --------------enigBA8913E82B831049B7FB6DFC-- --===============0875069115== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ --===============0875069115== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============0875069115==--