Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248007
b: refs/heads/master
c: 8ea7d6a
h: refs/heads/master
i:
  248005: a6c6861
  248003: dfac1d2
  247999: f73106a
v: v3
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed May 11, 2011
1 parent b1b089f commit c788d86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d09beabd7cd4cf70d982ff54656dc6431df80fa4
refs/heads/master: 8ea7d6aef84e278fcb121acff1bd4c3edaa95b8b
4 changes: 4 additions & 0 deletions trunk/arch/x86/include/asm/kvm_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ struct x86_emulate_ctxt {
#define X86EMUL_MODE_PROT32 4 /* 32-bit protected mode. */
#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */

/* any protected mode */
#define X86EMUL_MODE_PROT (X86EMUL_MODE_PROT16|X86EMUL_MODE_PROT32| \
X86EMUL_MODE_PROT64)

enum x86_intercept_stage {
X86_ICPT_PRE_EXCEPT,
X86_ICPT_POST_EXCEPT,
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#define Prefix (1<<16) /* Instruction varies with 66/f2/f3 prefix */
#define Sse (1<<17) /* SSE Vector instruction */
/* Misc flags */
#define Prot (1<<21) /* instruction generates #UD if not in prot-mode */
#define VendorSpecific (1<<22) /* Vendor specific instruction */
#define NoAccess (1<<23) /* Don't access memory (lea/invlpg/verr etc) */
#define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */
Expand Down Expand Up @@ -3143,6 +3144,12 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
goto done;
}

/* Instruction can only be executed in protected mode */
if ((c->d & Prot) && !(ctxt->mode & X86EMUL_MODE_PROT)) {
rc = emulate_ud(ctxt);
goto done;
}

/* Do instruction specific permission checks */
if (c->check_perm) {
rc = c->check_perm(ctxt);
Expand Down

0 comments on commit c788d86

Please sign in to comment.