From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: PATCH 2/6] Consolidate the various functions that read and write guest memory Date: Mon, 30 Jul 2007 11:37:44 +0200 Message-ID: <46ADB168.20209@bull.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0698607149==" 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) --===============0698607149== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFB7CC4C20611E750D66A6192" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFB7CC4C20611E750D66A6192 Content-Type: multipart/mixed; boundary="------------030308090009000807030104" This is a multi-part message in MIME format. --------------030308090009000807030104 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable emulator_read_emulated() uses struct kvm_vcpu instead of x86_emulate_ctxt= to be consistency with emulator_read_std(). Signed-off-by: Laurent Vivier --=20 ------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org -------------- "Software is hard" - Donald Knuth --------------030308090009000807030104 Content-Type: text/plain; name="read_emulated-vcpu" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="read_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:09.000000000 +0200 +++ kvm/drivers/kvm/kvm_main.c 2007-07-30 10:49:22.000000000 +0200 @@ -1037,9 +1037,8 @@ static int emulator_read_emulated(unsigned long addr, 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; =20 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:09.000000000 +020= 0 +++ kvm/drivers/kvm/x86_emulate.c 2007-07-30 10:49:22.000000000 +0200 @@ -782,7 +782,7 @@ src.type =3D OP_MEM; src.ptr =3D (unsigned long *)cr2; if ((rc =3D ops->read_emulated((unsigned long)src.ptr, - &src.val, src.bytes, ctxt)) !=3D 0) + &src.val, src.bytes, ctxt->vcpu)) !=3D 0) goto done; src.orig_val =3D src.val; break; @@ -852,7 +852,7 @@ } if (!(d & Mov) && /* optimisation - avoid slow emulated read */ ((rc =3D ops->read_emulated((unsigned long)dst.ptr, - &dst.val, dst.bytes, ctxt)) !=3D 0)) + &dst.val, dst.bytes, ctxt->vcpu)) !=3D 0)) goto done; break; } @@ -1132,7 +1132,7 @@ _regs[VCPU_REGS_RDI]); if ((rc =3D ops->read_emulated(register_address( override_base ? *override_base : ctxt->ds_base, - _regs[VCPU_REGS_RSI]), &dst.val, dst.bytes, ctxt)) !=3D 0) + _regs[VCPU_REGS_RSI]), &dst.val, dst.bytes, ctxt->vcpu)) !=3D 0)= goto done; register_address_increment(_regs[VCPU_REGS_RSI], (_eflags & EFLG_DF) ? -dst.bytes : dst.bytes); @@ -1154,7 +1154,8 @@ dst.type =3D OP_REG; dst.bytes =3D (d & ByteOp) ? 1 : op_bytes; dst.ptr =3D (unsigned long *)&_regs[VCPU_REGS_RAX]; - if ((rc =3D ops->read_emulated(cr2, &dst.val, dst.bytes, ctxt)) !=3D 0= ) + if ((rc =3D ops->read_emulated(cr2, &dst.val, dst.bytes, + ctxt->vcpu)) !=3D 0) goto done; register_address_increment(_regs[VCPU_REGS_RSI], (_eflags & EFLG_DF) ? -dst.bytes : dst.bytes); @@ -1379,7 +1380,8 @@ case 0xc7: /* Grp9 (cmpxchg8b) */ { u64 old, new; - if ((rc =3D ops->read_emulated(cr2, &old, 8, ctxt)) !=3D 0) + if ((rc =3D ops->read_emulated(cr2, &old, 8, ctxt->vcpu)) + !=3D 0) goto done; if (((u32) (old >> 0) !=3D (u32) _regs[VCPU_REGS_RAX]) || ((u32) (old >> 32) !=3D (u32) _regs[VCPU_REGS_RDX])) { 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:09.000000000 +020= 0 +++ kvm/drivers/kvm/x86_emulate.h 2007-07-30 10:49:22.000000000 +0200 @@ -82,7 +82,7 @@ int (*read_emulated) (unsigned long addr, void *val, unsigned int bytes, - struct x86_emulate_ctxt * ctxt); + struct kvm_vcpu *vcpu); =20 /* * write_emulated: Read bytes from emulated/special memory area. --------------030308090009000807030104-- --------------enigFB7CC4C20611E750D66A6192 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) iD8DBQFGrbFo9Kffa9pFVzwRAhmJAJ9o2xp2746oYUAq1GwZpcPngE/iSgCfYfyR QLNQt+U5HuhLVT1nt+m9b2I= =fn2u -----END PGP SIGNATURE----- --------------enigFB7CC4C20611E750D66A6192-- --===============0698607149== 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/ --===============0698607149== 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 --===============0698607149==--