From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: [PATCH 1/2] KVM: x86 emulator: modify 'cmpxchg8b', 'lods', 'stos' to not depend on CR2 Date: Thu, 15 Nov 2007 15:31:50 +0800 Message-ID: <200711151531.50461.sheng.yang@intel.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_mX/OHXsPNerdyTC" To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org 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 --Boundary-00=_mX/OHXsPNerdyTC Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =46rom c7b60a362930679e24df27e6a412cdbdf1a55f69 Mon Sep 17 00:00:00 2001 =46rom: Sheng Yang Date: Thu, 15 Nov 2007 14:52:28 +0800 Subject: [PATCH 1/2] KVM: x86 emulator: modify 'cmpxchg8b', 'lods', 'stos' = to=20 not depend on CR2 The current 'lods' and 'stos' is depending on incoming CR2 rather than deco= de memory address from registers. And 'cmpxchg8b' should be decode memory address too. Signed-off-by: Sheng Yang =2D-- drivers/kvm/x86_emulate.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index dfcbda5..c020010 100644 =2D-- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c @@ -214,7 +214,8 @@ static u16 twobyte_table[256] =3D { 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem16 | ModRM | Mov, /* 0xC0 - 0xCF */ =2D 0, 0, 0, DstMem | SrcReg | ModRM | Mov, 0, 0, 0, ImplicitOps | ModRM, + 0, 0, 0, DstMem | SrcReg | ModRM | Mov, + 0, 0, 0, ImplicitOps | ModRM | MemAbs, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1533,7 +1534,9 @@ special_insn: case 0xaa ... 0xab: /* stos */ c->dst.type =3D OP_MEM; c->dst.bytes =3D (c->d & ByteOp) ? 1 : c->op_bytes; =2D c->dst.ptr =3D (unsigned long *)cr2; + c->dst.ptr =3D (unsigned long *)register_address( + ctxt->es_base, + c->regs[VCPU_REGS_RDI]); c->dst.val =3D c->regs[VCPU_REGS_RAX]; register_address_increment(c->regs[VCPU_REGS_RDI], (ctxt->eflags & EFLG_DF) ? -c->dst.bytes @@ -1543,9 +1546,13 @@ special_insn: c->dst.type =3D OP_REG; c->dst.bytes =3D (c->d & ByteOp) ? 1 : c->op_bytes; c->dst.ptr =3D (unsigned long *)&c->regs[VCPU_REGS_RAX]; =2D if ((rc =3D ops->read_emulated(cr2, &c->dst.val, =2D c->dst.bytes, =2D ctxt->vcpu)) !=3D 0) + if ((rc =3D ops->read_emulated(register_address( + c->override_base ? *c->override_base : + ctxt->ds_base, + c->regs[VCPU_REGS_RSI]), + &c->dst.val, + c->dst.bytes, + ctxt->vcpu)) !=3D 0) goto done; =20 register_address_increment(c->regs[VCPU_REGS_RSI], =2D-=20 1.5.2 --Boundary-00=_mX/OHXsPNerdyTC Content-Type: text/x-diff; charset="utf-8"; name="0001-KVM-x86-emulator-modify-cmpxchg8b-lods-stos.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-KVM-x86-emulator-modify-cmpxchg8b-lods-stos.patch" =46rom c7b60a362930679e24df27e6a412cdbdf1a55f69 Mon Sep 17 00:00:00 2001 =46rom: Sheng Yang Date: Thu, 15 Nov 2007 14:52:28 +0800 Subject: [PATCH 1/2] KVM: x86 emulator: modify 'cmpxchg8b', 'lods', 'stos' = to not depend on CR2 The current 'lods' and 'stos' is depending on incoming CR2 rather than deco= de memory address from registers. And 'cmpxchg8b' should be decode memory address too. Signed-off-by: Sheng Yang =2D-- drivers/kvm/x86_emulate.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index dfcbda5..c020010 100644 =2D-- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c @@ -214,7 +214,8 @@ static u16 twobyte_table[256] =3D { 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem16 | ModRM | Mov, /* 0xC0 - 0xCF */ =2D 0, 0, 0, DstMem | SrcReg | ModRM | Mov, 0, 0, 0, ImplicitOps | ModRM, + 0, 0, 0, DstMem | SrcReg | ModRM | Mov, + 0, 0, 0, ImplicitOps | ModRM | MemAbs, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1533,7 +1534,9 @@ special_insn: case 0xaa ... 0xab: /* stos */ c->dst.type =3D OP_MEM; c->dst.bytes =3D (c->d & ByteOp) ? 1 : c->op_bytes; =2D c->dst.ptr =3D (unsigned long *)cr2; + c->dst.ptr =3D (unsigned long *)register_address( + ctxt->es_base, + c->regs[VCPU_REGS_RDI]); c->dst.val =3D c->regs[VCPU_REGS_RAX]; register_address_increment(c->regs[VCPU_REGS_RDI], (ctxt->eflags & EFLG_DF) ? -c->dst.bytes @@ -1543,9 +1546,13 @@ special_insn: c->dst.type =3D OP_REG; c->dst.bytes =3D (c->d & ByteOp) ? 1 : c->op_bytes; c->dst.ptr =3D (unsigned long *)&c->regs[VCPU_REGS_RAX]; =2D if ((rc =3D ops->read_emulated(cr2, &c->dst.val, =2D c->dst.bytes, =2D ctxt->vcpu)) !=3D 0) + if ((rc =3D ops->read_emulated(register_address( + c->override_base ? *c->override_base : + ctxt->ds_base, + c->regs[VCPU_REGS_RSI]), + &c->dst.val, + c->dst.bytes, + ctxt->vcpu)) !=3D 0) goto done; =20 register_address_increment(c->regs[VCPU_REGS_RSI], =2D-=20 1.5.2 --Boundary-00=_mX/OHXsPNerdyTC 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/ --Boundary-00=_mX/OHXsPNerdyTC 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 --Boundary-00=_mX/OHXsPNerdyTC--