aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-10-24KVM: x86 emulator: implement CWD (opcode 99)Avi Kivity1-1/+14
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M, IMM (opcode 69)Avi Kivity1-1/+2
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add Src2Imm decodingAvi Kivity1-0/+4
Needed for 3-operand IMUL. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: consolidate immediate decode into a functionAvi Kivity1-45/+64
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement RDTSC (opcode 0F 31)Avi Kivity1-1/+18
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: remove SrcImplicitAvi Kivity1-2/+1
Useless. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M (opcode 0F AF)Avi Kivity1-3/+10
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement IMUL REG, R/M, imm8 (opcode 6B)Avi Kivity1-1/+11
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement RET imm16 (opcode C2)Avi Kivity1-1/+18
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add SrcImmU16 operand typeAvi Kivity1-3/+9
Used for RET NEAR instructions. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement CALL FAR (FF /3)Avi Kivity1-1/+36
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement DAS (opcode 2F)Avi Kivity1-1/+41
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Use a register for ____emulate_2op() destinationAvi Kivity1-1/+1
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 <[email protected]>
2010-10-24KVM: x86 emulator: pass destination type to ____emulate_2op()Avi Kivity1-6/+6
We'll need it later so we can use a register for the destination. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add LOOP/LOOPcc instruction emulationWei Yongjun1-1/+7
Add LOOP/LOOPcc instruction emulation (opcode 0xe0~0xe2). Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add CBW/CWDE/CDQE instruction emulationWei Yongjun1-1/+8
Add CBW/CWDE/CDQE instruction emulation.(opcode 0x98) Used by FreeBSD's boot loader. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: fix REPZ/REPNZ termination conditionAvi Kivity1-21/+20
EFLAGS.ZF needs to be checked after each iteration, not before. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: implement SCAS (opcodes AE, AF)Avi Kivity1-3/+2
Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: fix INTn emulation not pushing EFLAGS and CSAvi Kivity1-1/+12
emulate_push() only schedules a push; it doesn't actually push anything. Call writeback() to flush out the write. Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: remove dup code of in/out instructionWei Yongjun1-20/+4
Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: change OUT instruction to use dst instead of srcWei Yongjun1-7/+8
Change OUT instruction to use dst instead of src, so we can reuse those code for all out instructions. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: introduce DstImmUByte for dst operand decodeWei Yongjun1-0/+7
Introduce DstImmUByte for dst operand decode, which will be used for out instruction. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: remove useless label from x86_emulate_insn()Wei Yongjun1-5/+1
Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add setcc instruction emulationWei Yongjun1-1/+4
Add setcc instruction emulation (opcode 0x0f 0x90~0x9f) Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86: explain 'no-kvmclock' kernel parameterJiri Kosina1-0/+2
no-kvmclock kernel parameter is missing its explanation in Documentation/kernel-parameters.txt. Add it. Signed-off-by: Jiri Kosina <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add XADD instruction emulationWei Yongjun1-1/+8
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: put register operand write back to a functionWei Yongjun1-32/+23
Introduce function write_register_operand() to write back the register operand. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz()Wei Yongjun1-1/+3
Add kvm_release_page_clean() after is_error_page() to avoid leakage of error page. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: Separate emulation context initialization in a separate functionMohammed Gamal1-29/+25
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: add bsf/bsr instruction emulationWei Yongjun1-2/+26
Add bsf/bsr instruction emulation (opcode 0x0f 0xbc~0xbd) Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Fix emulate_grp3 return valuesMohammed Gamal1-3/+3
This patch lets emulate_grp3() return X86EMUL_* return codes instead of hardcoded ones. Signed-off-by: Mohammed Gamal <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Add unary mul, imul, div, and idiv instructionsMohammed Gamal1-1/+40
This adds unary mul, imul, div, and idiv instructions (group 3 r/m 4-7). Signed-off-by: Mohammed Gamal <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: mask group 8 instruction as BitOpWei Yongjun1-7/+4
Mask group 8 instruction as BitOp, so we can share the code for adjust the source operand. Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: do not adjust the address for immediate sourceWei Yongjun1-1/+1
adjust the dst address for a register source but not adjust the address for an immediate source. Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: fix negative bit offset BitOp instruction emulationWei Yongjun1-6/+18
If bit offset operands is a negative number, BitOp instruction will return wrong value. This patch fix it. Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Add stc instruction (opcode 0xf9)Mohammed Gamal1-1/+4
Signed-off-by: Mohammed Gamal <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: using SrcOne for instruction d0/d1 decodingWei Yongjun1-2/+1
Using SrcOne for instruction d0/d1 decoding. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: disable writeback when decode dest operandWei Yongjun1-17/+6
This patch change to disable writeback when decode dest operand if the dest type is ImplicitOps or not specified. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: use SrcAcc to simplify stos decodingWei Yongjun1-3/+2
Use SrcAcc to simplify stos decoding. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Add into, int, and int3 instructions (opcodes 0xcc-0xce)Mohammed Gamal1-0/+78
This adds support for int instructions to the emulator. Signed-off-by: Mohammed Gamal <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: Allow accessing IDT via emulator opsMohammed Gamal2-0/+7
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: x86 emulator: simplify two-byte opcode checkWei Yongjun1-7/+5
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Move KVM trampolines before __end_interruptsAlexander Graf2-6/+6
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Make long relocations be ulongAlexander Graf2-4/+4
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 <[email protected]> Signed-off-by: Alexander Graf <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Use MSR_DR for external load_upAlexander Graf1-9/+19
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Add book3s_32 tlbie flush accelerationAlexander Graf2-5/+39
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: correctly check gfn_to_pfn() return valueGleb Natapov2-2/+2
On failure gfn_to_pfn returns bad_page so use correct function to check for that. Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Alexander Graf <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: RCU'ify the Book3s MMUAlexander Graf2-19/+61
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Book3S_32 MMU debug compile fixesAlexander Graf1-2/+2
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-10-24KVM: PPC: Add get_pvinfo interface to query hypercall instructionsAlexander Graf3-0/+72
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>