mirror of https://gitee.com/openkylin/linux.git
KVM: x86 emulator: Use opcode::execute for PUSHA/POPA (60/61)
For this, emulate_pusha/popa() are converted to em_pusha/popa(). Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
c54fe50469
commit
b96a7fad02
|
@ -1473,7 +1473,7 @@ static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emulate_pusha(struct x86_emulate_ctxt *ctxt)
|
static int em_pusha(struct x86_emulate_ctxt *ctxt)
|
||||||
{
|
{
|
||||||
struct decode_cache *c = &ctxt->decode;
|
struct decode_cache *c = &ctxt->decode;
|
||||||
unsigned long old_esp = c->regs[VCPU_REGS_RSP];
|
unsigned long old_esp = c->regs[VCPU_REGS_RSP];
|
||||||
|
@ -1494,8 +1494,7 @@ static int emulate_pusha(struct x86_emulate_ctxt *ctxt)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emulate_popa(struct x86_emulate_ctxt *ctxt,
|
static int em_popa(struct x86_emulate_ctxt *ctxt)
|
||||||
struct x86_emulate_ops *ops)
|
|
||||||
{
|
{
|
||||||
struct decode_cache *c = &ctxt->decode;
|
struct decode_cache *c = &ctxt->decode;
|
||||||
int rc = X86EMUL_CONTINUE;
|
int rc = X86EMUL_CONTINUE;
|
||||||
|
@ -1508,7 +1507,7 @@ static int emulate_popa(struct x86_emulate_ctxt *ctxt,
|
||||||
--reg;
|
--reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = emulate_pop(ctxt, ops, &c->regs[reg], c->op_bytes);
|
rc = emulate_pop(ctxt, ctxt->ops, &c->regs[reg], c->op_bytes);
|
||||||
if (rc != X86EMUL_CONTINUE)
|
if (rc != X86EMUL_CONTINUE)
|
||||||
break;
|
break;
|
||||||
--reg;
|
--reg;
|
||||||
|
@ -3098,7 +3097,8 @@ static struct opcode opcode_table[256] = {
|
||||||
/* 0x58 - 0x5F */
|
/* 0x58 - 0x5F */
|
||||||
X8(I(DstReg | Stack, em_pop)),
|
X8(I(DstReg | Stack, em_pop)),
|
||||||
/* 0x60 - 0x67 */
|
/* 0x60 - 0x67 */
|
||||||
D(ImplicitOps | Stack | No64), D(ImplicitOps | Stack | No64),
|
I(ImplicitOps | Stack | No64, em_pusha),
|
||||||
|
I(ImplicitOps | Stack | No64, em_popa),
|
||||||
N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ ,
|
N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ ,
|
||||||
N, N, N, N,
|
N, N, N, N,
|
||||||
/* 0x68 - 0x6F */
|
/* 0x68 - 0x6F */
|
||||||
|
@ -3823,12 +3823,6 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
|
||||||
case 0x48 ... 0x4f: /* dec r16/r32 */
|
case 0x48 ... 0x4f: /* dec r16/r32 */
|
||||||
emulate_1op("dec", c->dst, ctxt->eflags);
|
emulate_1op("dec", c->dst, ctxt->eflags);
|
||||||
break;
|
break;
|
||||||
case 0x60: /* pusha */
|
|
||||||
rc = emulate_pusha(ctxt);
|
|
||||||
break;
|
|
||||||
case 0x61: /* popa */
|
|
||||||
rc = emulate_popa(ctxt, ops);
|
|
||||||
break;
|
|
||||||
case 0x63: /* movsxd */
|
case 0x63: /* movsxd */
|
||||||
if (ctxt->mode != X86EMUL_MODE_PROT64)
|
if (ctxt->mode != X86EMUL_MODE_PROT64)
|
||||||
goto cannot_emulate;
|
goto cannot_emulate;
|
||||||
|
|
Loading…
Reference in New Issue