* [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC
@ 2013-05-09 9:32 Paolo Bonzini
[not found] ` <1368091971-5071-3-git-send-email-pbonzini@redhat.com>
2013-05-09 12:01 ` [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC Gleb Natapov
0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-05-09 9:32 UTC (permalink / raw)
To: linux-kernel; +Cc: kvm, gnatapov, j-nomura
These three instructions are not emulated, but can be found in
real mode code.
These are also good for stable, but they conflict before 3.9 and are
not really useful since emulate_invalid_guest_state defaulted to false.
So I'm not marking them for earlier releases.
Paolo Bonzini (3):
KVM: emulator: emulate AAM
KVM: emulator: emulate XLAT
KVM: emulator: emulate SALC
arch/x86/kvm/emulate.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <1368091971-5071-3-git-send-email-pbonzini@redhat.com>]
* Re: [PATCH v2 2/3] KVM: emulator: emulate XLAT [not found] ` <1368091971-5071-3-git-send-email-pbonzini@redhat.com> @ 2013-05-09 10:03 ` Gleb Natapov 2013-05-09 11:40 ` Paolo Bonzini 0 siblings, 1 reply; 4+ messages in thread From: Gleb Natapov @ 2013-05-09 10:03 UTC (permalink / raw) To: Paolo Bonzini; +Cc: linux-kernel, kvm, j-nomura, stable On Thu, May 09, 2013 at 11:32:50AM +0200, Paolo Bonzini wrote: > This is used by SGABIOS, KVM breaks with emulate_invalid_guest_state=1. > It is just a MOV in disguise, with a funny source address. > > Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> > Cc: stable@vger.kernel.org # 3.9 > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > arch/x86/kvm/emulate.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 709ba03..210bb4e 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -60,6 +60,7 @@ > #define OpGS 25ull /* GS */ > #define OpMem8 26ull /* 8-bit zero extended memory operand */ > #define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */ > +#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */ > > #define OpBits 5 /* Width of operand field */ > #define OpMask ((1ull << OpBits) - 1) > @@ -99,6 +100,7 @@ > #define SrcImmUByte (OpImmUByte << SrcShift) > #define SrcImmU (OpImmU << SrcShift) > #define SrcSI (OpSI << SrcShift) > +#define SrcXLat (OpXLat << SrcShift) > #define SrcImmFAddr (OpImmFAddr << SrcShift) > #define SrcMemFAddr (OpMemFAddr << SrcShift) > #define SrcAcc (OpAcc << SrcShift) > @@ -3949,7 +3951,8 @@ static const struct opcode opcode_table[256] = { > G(Src2One | ByteOp, group2), G(Src2One, group2), > G(Src2CL | ByteOp, group2), G(Src2CL, group2), > I(DstAcc | SrcImmUByte | No64, em_aam), > - I(DstAcc | SrcImmUByte | No64, em_aad), N, N, > + I(DstAcc | SrcImmUByte | No64, em_aad), N, > + I(DstAcc | SrcXLat | ByteOp, em_mov), > /* 0xD8 - 0xDF */ > N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, > /* 0xE0 - 0xE7 */ > @@ -4207,6 +4210,17 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, > op->val = 0; > op->count = 1; > break; > + case OpXLat: Sigh, obviously this is not reusable by any other instruction. So many waisted transistor :( > + op->type = OP_MEM; > + op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; > + op->addr.mem.ea = > + register_address(ctxt, > + reg_read(ctxt, VCPU_REGS_RBX) + > + (reg_read(ctxt, VCPU_REGS_RAX) & 0xff)); > + op->addr.mem.seg = seg_override(ctxt); > + op->val = 0; > + op->count = 1; The count is set only for decoding that is used by string instructions. I can drop it while applying. > + break; > case OpImmFAddr: > op->type = OP_IMM; > op->addr.mem.ea = ctxt->_eip; > -- > 1.8.1.4 > -- Gleb. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/3] KVM: emulator: emulate XLAT 2013-05-09 10:03 ` [PATCH v2 2/3] KVM: emulator: emulate XLAT Gleb Natapov @ 2013-05-09 11:40 ` Paolo Bonzini 0 siblings, 0 replies; 4+ messages in thread From: Paolo Bonzini @ 2013-05-09 11:40 UTC (permalink / raw) To: Gleb Natapov; +Cc: linux-kernel, kvm, j-nomura, stable Il 09/05/2013 12:03, Gleb Natapov ha scritto: > On Thu, May 09, 2013 at 11:32:50AM +0200, Paolo Bonzini wrote: >> This is used by SGABIOS, KVM breaks with emulate_invalid_guest_state=1. >> It is just a MOV in disguise, with a funny source address. >> >> Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> >> Cc: stable@vger.kernel.org # 3.9 >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> >> --- >> arch/x86/kvm/emulate.c | 16 +++++++++++++++- >> 1 file changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c >> index 709ba03..210bb4e 100644 >> --- a/arch/x86/kvm/emulate.c >> +++ b/arch/x86/kvm/emulate.c >> @@ -60,6 +60,7 @@ >> #define OpGS 25ull /* GS */ >> #define OpMem8 26ull /* 8-bit zero extended memory operand */ >> #define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */ >> +#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */ >> >> #define OpBits 5 /* Width of operand field */ >> #define OpMask ((1ull << OpBits) - 1) >> @@ -99,6 +100,7 @@ >> #define SrcImmUByte (OpImmUByte << SrcShift) >> #define SrcImmU (OpImmU << SrcShift) >> #define SrcSI (OpSI << SrcShift) >> +#define SrcXLat (OpXLat << SrcShift) >> #define SrcImmFAddr (OpImmFAddr << SrcShift) >> #define SrcMemFAddr (OpMemFAddr << SrcShift) >> #define SrcAcc (OpAcc << SrcShift) >> @@ -3949,7 +3951,8 @@ static const struct opcode opcode_table[256] = { >> G(Src2One | ByteOp, group2), G(Src2One, group2), >> G(Src2CL | ByteOp, group2), G(Src2CL, group2), >> I(DstAcc | SrcImmUByte | No64, em_aam), >> - I(DstAcc | SrcImmUByte | No64, em_aad), N, N, >> + I(DstAcc | SrcImmUByte | No64, em_aad), N, >> + I(DstAcc | SrcXLat | ByteOp, em_mov), >> /* 0xD8 - 0xDF */ >> N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, >> /* 0xE0 - 0xE7 */ >> @@ -4207,6 +4210,17 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, >> op->val = 0; >> op->count = 1; >> break; >> + case OpXLat: > Sigh, obviously this is not reusable by any other instruction. So many > waisted transistor :( And a precious op value too, we only have 3 left. :/ >> + op->type = OP_MEM; >> + op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; >> + op->addr.mem.ea = >> + register_address(ctxt, >> + reg_read(ctxt, VCPU_REGS_RBX) + >> + (reg_read(ctxt, VCPU_REGS_RAX) & 0xff)); >> + op->addr.mem.seg = seg_override(ctxt); >> + op->val = 0; >> + op->count = 1; > The count is set only for decoding that is used by string instructions. > I can drop it while applying. Thanks! Paolo >> + break; >> case OpImmFAddr: >> op->type = OP_IMM; >> op->addr.mem.ea = ctxt->_eip; >> -- >> 1.8.1.4 >> > > -- > Gleb. > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC 2013-05-09 9:32 [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC Paolo Bonzini [not found] ` <1368091971-5071-3-git-send-email-pbonzini@redhat.com> @ 2013-05-09 12:01 ` Gleb Natapov 1 sibling, 0 replies; 4+ messages in thread From: Gleb Natapov @ 2013-05-09 12:01 UTC (permalink / raw) To: Paolo Bonzini; +Cc: linux-kernel, kvm, j-nomura On Thu, May 09, 2013 at 11:32:48AM +0200, Paolo Bonzini wrote: > These three instructions are not emulated, but can be found in > real mode code. > > These are also good for stable, but they conflict before 3.9 and are > not really useful since emulate_invalid_guest_state defaulted to false. > So I'm not marking them for earlier releases. > > Paolo Bonzini (3): > KVM: emulator: emulate AAM > KVM: emulator: emulate XLAT > KVM: emulator: emulate SALC > Applied, thanks. > arch/x86/kvm/emulate.c | 43 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > > -- > 1.8.1.4 -- Gleb. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-09 12:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-09 9:32 [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC Paolo Bonzini
[not found] ` <1368091971-5071-3-git-send-email-pbonzini@redhat.com>
2013-05-09 10:03 ` [PATCH v2 2/3] KVM: emulator: emulate XLAT Gleb Natapov
2013-05-09 11:40 ` Paolo Bonzini
2013-05-09 12:01 ` [PATCH v2 0/3] KVM: emulate AAM, XLAT, SALC Gleb Natapov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox