summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M, IMM (opcode 69)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add Src2Imm decodingAvi Kivity
Needed for 3-operand IMUL. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: consolidate immediate decode into a functionAvi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement RDTSC (opcode 0F 31)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: remove SrcImplicitAvi Kivity
Useless. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M (opcode 0F AF)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M, imm8 (opcode 6B)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement RET imm16 (opcode C2)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add SrcImmU16 operand typeAvi Kivity
Used for RET NEAR instructions. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement CALL FAR (FF /3)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement DAS (opcode 2F)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Use a register for ____emulate_2op() destinationAvi Kivity
Most x86 two operand instructions allow the destination to be a memory operand, but IMUL (for example) requires that the destination be a register. Change ____emulate_2op() to take a register for both source and destination so we can invoke IMUL. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: pass destination type to ____emulate_2op()Avi Kivity
We'll need it later so we can use a register for the destination. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add LOOP/LOOPcc instruction emulationWei Yongjun
Add LOOP/LOOPcc instruction emulation (opcode 0xe0~0xe2). Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add CBW/CWDE/CDQE instruction emulationWei Yongjun
Add CBW/CWDE/CDQE instruction emulation.(opcode 0x98) Used by FreeBSD's boot loader. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: fix REPZ/REPNZ termination conditionAvi Kivity
EFLAGS.ZF needs to be checked after each iteration, not before. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: implement SCAS (opcodes AE, AF)Avi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: fix INTn emulation not pushing EFLAGS and CSAvi Kivity
emulate_push() only schedules a push; it doesn't actually push anything. Call writeback() to flush out the write. Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: remove dup code of in/out instructionWei Yongjun
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: change OUT instruction to use dst instead of srcWei Yongjun
Change OUT instruction to use dst instead of src, so we can reuse those code for all out instructions. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: introduce DstImmUByte for dst operand decodeWei Yongjun
Introduce DstImmUByte for dst operand decode, which will be used for out instruction. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: remove useless label from x86_emulate_insn()Wei Yongjun
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add setcc instruction emulationWei Yongjun
Add setcc instruction emulation (opcode 0x0f 0x90~0x9f) Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86: explain 'no-kvmclock' kernel parameterJiri Kosina
no-kvmclock kernel parameter is missing its explanation in Documentation/kernel-parameters.txt. Add it. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add XADD instruction emulationWei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: put register operand write back to a functionWei Yongjun
Introduce function write_register_operand() to write back the register operand. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz()Wei Yongjun
Add kvm_release_page_clean() after is_error_page() to avoid leakage of error page. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: Separate emulation context initialization in a separate functionMohammed Gamal
The code for initializing the emulation context is duplicated at two locations (emulate_instruction() and kvm_task_switch()). Separate it in a separate function and call it from there. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: add bsf/bsr instruction emulationWei Yongjun
Add bsf/bsr instruction emulation (opcode 0x0f 0xbc~0xbd) Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Fix emulate_grp3 return valuesMohammed Gamal
This patch lets emulate_grp3() return X86EMUL_* return codes instead of hardcoded ones. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Add unary mul, imul, div, and idiv instructionsMohammed Gamal
This adds unary mul, imul, div, and idiv instructions (group 3 r/m 4-7). Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: mask group 8 instruction as BitOpWei Yongjun
Mask group 8 instruction as BitOp, so we can share the code for adjust the source operand. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: do not adjust the address for immediate sourceWei Yongjun
adjust the dst address for a register source but not adjust the address for an immediate source. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: fix negative bit offset BitOp instruction emulationWei Yongjun
If bit offset operands is a negative number, BitOp instruction will return wrong value. This patch fix it. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Add stc instruction (opcode 0xf9)Mohammed Gamal
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: using SrcOne for instruction d0/d1 decodingWei Yongjun
Using SrcOne for instruction d0/d1 decoding. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: disable writeback when decode dest operandWei Yongjun
This patch change to disable writeback when decode dest operand if the dest type is ImplicitOps or not specified. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: use SrcAcc to simplify stos decodingWei Yongjun
Use SrcAcc to simplify stos decoding. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Add into, int, and int3 instructions (opcodes 0xcc-0xce)Mohammed Gamal
This adds support for int instructions to the emulator. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: Allow accessing IDT via emulator opsMohammed Gamal
The patch adds a new member get_idt() to x86_emulate_ops. It also adds a function to get the idt in order to be used by the emulator. This is needed for real mode interrupt injection and the emulation of int instructions. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: x86 emulator: simplify two-byte opcode checkWei Yongjun
Two-byte opcode always start with 0x0F and the decode flags of opcode 0xF0 is always 0, so remove dup check. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Move KVM trampolines before __end_interruptsAlexander Graf
When using a relocatable kernel we need to make sure that the trampline code and the interrupt handlers are both copied to low memory. The only way to do this reliably is to put them in the copied section. This patch should make relocated kernels work with KVM. KVM-Stable-Tag Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Make long relocations be ulongAlexander Graf
On Book3S KVM we directly expose some asm pointers to C code as variables. These need to be relocated and thus break on relocatable kernels. To make sure we can at least build, let's mark them as long instead of u32 where 64bit relocations don't work. This fixes the following build error: WARNING: 2 bad relocations^M > c000000000008590 R_PPC64_ADDR32 .text+0x4000000000008460^M > c000000000008594 R_PPC64_ADDR32 .text+0x4000000000008598^M Please keep in mind that actually using KVM on a relocated kernel might still break. This only fixes the compile problem. Reported-by: Subrata Modak <subrata@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Use MSR_DR for external load_upAlexander Graf
Book3S_32 requires MSR_DR to be disabled during load_up_xxx while on Book3S_64 it's supposed to be enabled. I misread the code and disabled it in both cases, potentially breaking the PS3 which has a really small RMA. This patch makes KVM work on the PS3 again. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Add book3s_32 tlbie flush accelerationAlexander Graf
On Book3s_32 the tlbie instruction flushed effective addresses by the mask 0x0ffff000. This is pretty hard to reflect with a hash that hashes ~0xfff, so to speed up that target we should also keep a special hash around for it. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: correctly check gfn_to_pfn() return valueGleb Natapov
On failure gfn_to_pfn returns bad_page so use correct function to check for that. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: RCU'ify the Book3s MMUAlexander Graf
So far we've been running all code without locking of any sort. This wasn't really an issue because I didn't see any parallel access to the shadow MMU code coming. But then I started to implement dirty bitmapping to MOL which has the video code in its own thread, so suddenly we had the dirty bitmap code run in parallel to the shadow mmu code. And with that came trouble. So I went ahead and made the MMU modifying functions as parallelizable as I could think of. I hope I didn't screw up too much RCU logic :-). If you know your way around RCU and locking and what needs to be done when, please take a look at this patch. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Book3S_32 MMU debug compile fixesAlexander Graf
Due to previous changes, the Book3S_32 guest MMU code didn't compile properly when enabling debugging. This patch repairs the broken code paths, making it possible to define DEBUG_MMU and friends again. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Add get_pvinfo interface to query hypercall instructionsAlexander Graf
We need to tell the guest the opcodes that make up a hypercall through interfaces that are controlled by userspace. So we need to add a call for userspace to allow it to query those opcodes so it can pass them on. This is required because the hypercall opcodes can change based on the hypervisor conditions. If we're running in hardware accelerated hypervisor mode, a hypercall looks different from when we're running without hardware acceleration. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-24KVM: PPC: Add Documentation about PV interfaceAlexander Graf
We just introduced a new PV interface that screams for documentation. So here it is - a shiny new and awesome text file describing the internal works of the PPC KVM paravirtual interface. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>