diff options
author | Avi Kivity <avi@qumranet.com> | 2007-11-27 12:14:21 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:16 -0500 |
commit | 111de5d60c589bca02b49dce076ca588618e0d1c (patch) | |
tree | 834d68c45a5bffa628d3060371e39e83ce4c1ac7 /drivers/kvm/x86_emulate.c | |
parent | b9fa9d6bc6ac617170c4cf21ca764eb187618c0d (diff) |
KVM: x86 emulator: unify two switches
The rep prefix cleanup left two switch () statements next to each other.
Unify them.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r-- | drivers/kvm/x86_emulate.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 53377f0b202e..499d1ad42bc4 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -1541,31 +1541,6 @@ special_insn: | |||
1541 | case 0x9d: /* popf */ | 1541 | case 0x9d: /* popf */ |
1542 | c->dst.ptr = (unsigned long *) &ctxt->eflags; | 1542 | c->dst.ptr = (unsigned long *) &ctxt->eflags; |
1543 | goto pop_instruction; | 1543 | goto pop_instruction; |
1544 | case 0xc3: /* ret */ | ||
1545 | c->dst.ptr = &c->eip; | ||
1546 | goto pop_instruction; | ||
1547 | case 0xf4: /* hlt */ | ||
1548 | ctxt->vcpu->halt_request = 1; | ||
1549 | goto done; | ||
1550 | case 0xf5: /* cmc */ | ||
1551 | /* complement carry flag from eflags reg */ | ||
1552 | ctxt->eflags ^= EFLG_CF; | ||
1553 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1554 | break; | ||
1555 | case 0xf8: /* clc */ | ||
1556 | ctxt->eflags &= ~EFLG_CF; | ||
1557 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1558 | break; | ||
1559 | case 0xfa: /* cli */ | ||
1560 | ctxt->eflags &= ~X86_EFLAGS_IF; | ||
1561 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1562 | break; | ||
1563 | case 0xfb: /* sti */ | ||
1564 | ctxt->eflags |= X86_EFLAGS_IF; | ||
1565 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1566 | break; | ||
1567 | } | ||
1568 | switch (c->b) { | ||
1569 | case 0xa4 ... 0xa5: /* movs */ | 1544 | case 0xa4 ... 0xa5: /* movs */ |
1570 | c->dst.type = OP_MEM; | 1545 | c->dst.type = OP_MEM; |
1571 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; | 1546 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; |
@@ -1652,6 +1627,9 @@ special_insn: | |||
1652 | case 0xae ... 0xaf: /* scas */ | 1627 | case 0xae ... 0xaf: /* scas */ |
1653 | DPRINTF("Urk! I don't handle SCAS.\n"); | 1628 | DPRINTF("Urk! I don't handle SCAS.\n"); |
1654 | goto cannot_emulate; | 1629 | goto cannot_emulate; |
1630 | case 0xc3: /* ret */ | ||
1631 | c->dst.ptr = &c->eip; | ||
1632 | goto pop_instruction; | ||
1655 | case 0xe8: /* call (near) */ { | 1633 | case 0xe8: /* call (near) */ { |
1656 | long int rel; | 1634 | long int rel; |
1657 | switch (c->op_bytes) { | 1635 | switch (c->op_bytes) { |
@@ -1676,8 +1654,26 @@ special_insn: | |||
1676 | JMP_REL(c->src.val); | 1654 | JMP_REL(c->src.val); |
1677 | c->dst.type = OP_NONE; /* Disable writeback. */ | 1655 | c->dst.type = OP_NONE; /* Disable writeback. */ |
1678 | break; | 1656 | break; |
1679 | 1657 | case 0xf4: /* hlt */ | |
1680 | 1658 | ctxt->vcpu->halt_request = 1; | |
1659 | goto done; | ||
1660 | case 0xf5: /* cmc */ | ||
1661 | /* complement carry flag from eflags reg */ | ||
1662 | ctxt->eflags ^= EFLG_CF; | ||
1663 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1664 | break; | ||
1665 | case 0xf8: /* clc */ | ||
1666 | ctxt->eflags &= ~EFLG_CF; | ||
1667 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1668 | break; | ||
1669 | case 0xfa: /* cli */ | ||
1670 | ctxt->eflags &= ~X86_EFLAGS_IF; | ||
1671 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1672 | break; | ||
1673 | case 0xfb: /* sti */ | ||
1674 | ctxt->eflags |= X86_EFLAGS_IF; | ||
1675 | c->dst.type = OP_NONE; /* Disable writeback. */ | ||
1676 | break; | ||
1681 | } | 1677 | } |
1682 | goto writeback; | 1678 | goto writeback; |
1683 | 1679 | ||