kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] Add decoding of 16bit second immediate argument.
@ 2009-04-05 13:59 Gleb Natapov
  2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Such as segment number in lcall/ljmp

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index d7c9f6f..c015063 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -76,6 +76,7 @@
 #define Src2CL      (1<<29)
 #define Src2ImmByte (2<<29)
 #define Src2One     (3<<29)
+#define Src2Imm16   (4<<29)
 #define Src2Mask    (7<<29)
 
 enum {
@@ -1072,6 +1073,12 @@ done_prefixes:
 		c->src2.bytes = 1;
 		c->src2.val = insn_fetch(u8, 1, c->eip);
 		break;
+	case Src2Imm16:
+		c->src2.type = OP_IMM;
+		c->src2.ptr = (unsigned long *)c->eip;
+		c->src2.bytes = 2;
+		c->src2.val = insn_fetch(u16, 2, c->eip);
+		break;
 	case Src2One:
 		c->src2.bytes = 1;
 		c->src2.val = 1;


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/9] Add lcall decoding.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-11 11:09   ` Avi Kivity
  2009-04-05 13:59 ` [PATCH 3/9] Complete ljmp decoding at decode stage Gleb Natapov
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

No emulation yet.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index c015063..fe0dec2 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -154,7 +154,8 @@ static u32 opcode_table[256] = {
 	/* 0x90 - 0x97 */
 	DstReg, DstReg, DstReg, DstReg,	DstReg, DstReg, DstReg, DstReg,
 	/* 0x98 - 0x9F */
-	0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
+	0, 0, SrcImm | Src2Imm16 | ImplicitOps, 0, ImplicitOps | Stack,
+	ImplicitOps | Stack, 0, 0,
 	/* 0xA0 - 0xA7 */
 	ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs,
 	ByteOp | DstMem | SrcReg | Mov | MemAbs, DstMem | SrcReg | Mov | MemAbs,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/9] Complete ljmp decoding at decode stage.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
  2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-05 13:59 ` [PATCH 4/9] Complete short/near jcc decoding in " Gleb Natapov
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |   25 +++++--------------------
 1 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index fe0dec2..e7e4db1 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -193,7 +193,7 @@ static u32 opcode_table[256] = {
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	/* 0xE8 - 0xEF */
 	ImplicitOps | Stack, SrcImm | ImplicitOps,
-	ImplicitOps, SrcImmByte | ImplicitOps,
+	SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps,
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	/* 0xF0 - 0xF7 */
@@ -1805,30 +1805,15 @@ special_insn:
 	}
 	case 0xe9: /* jmp rel */
 		goto jmp;
-	case 0xea: /* jmp far */ {
-		uint32_t eip;
-		uint16_t sel;
-
-		switch (c->op_bytes) {
-		case 2:
-			eip = insn_fetch(u16, 2, c->eip);
-			break;
-		case 4:
-			eip = insn_fetch(u32, 4, c->eip);
-			break;
-		default:
-			DPRINTF("jmp far: Invalid op_bytes\n");
-			goto cannot_emulate;
-		}
-		sel = insn_fetch(u16, 2, c->eip);
-		if (kvm_load_segment_descriptor(ctxt->vcpu, sel, 9, VCPU_SREG_CS) < 0) {
+	case 0xea: /* jmp far */
+		if (kvm_load_segment_descriptor(ctxt->vcpu, c->src2.val, 9,
+					VCPU_SREG_CS) < 0) {
 			DPRINTF("jmp far: Failed to load CS descriptor\n");
 			goto cannot_emulate;
 		}
 
-		c->eip = eip;
+		c->eip = c->src.val;
 		break;
-	}
 	case 0xeb:
 	      jmp:		/* jmp rel short */
 		jmp_rel(c, c->src.val);


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/9] Complete short/near jcc decoding in decode stage.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
  2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
  2009-04-05 13:59 ` [PATCH 3/9] Complete ljmp decoding at decode stage Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-05 13:59 ` [PATCH 5/9] Complete decoding of call near " Gleb Natapov
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |   50 ++++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index e7e4db1..1790933 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -136,11 +136,15 @@ static u32 opcode_table[256] = {
 	SrcNone  | ByteOp  | ImplicitOps, SrcNone  | ImplicitOps, /* insb, insw/insd */
 	SrcNone  | ByteOp  | ImplicitOps, SrcNone  | ImplicitOps, /* outsb, outsw/outsd */
 	/* 0x70 - 0x77 */
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
 	/* 0x78 - 0x7F */
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+	ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
 	/* 0x80 - 0x87 */
 	Group | Group1_80, Group | Group1_81,
 	Group | Group1_82, Group | Group1_83,
@@ -232,10 +236,12 @@ static u32 twobyte_table[256] = {
 	/* 0x70 - 0x7F */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0x80 - 0x8F */
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
-	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps,
 	/* 0x90 - 0x9F */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0xA0 - 0xA7 */
@@ -1539,13 +1545,10 @@ special_insn:
 			return -1;
 		}
 		return 0;
-	case 0x70 ... 0x7f: /* jcc (short) */ {
-		int rel = insn_fetch(s8, 1, c->eip);
-
+	case 0x70 ... 0x7f: /* jcc (short) */
 		if (test_cc(c->b, ctxt->eflags))
-			jmp_rel(c, rel);
+			jmp_rel(c, c->src.val);
 		break;
-	}
 	case 0x80 ... 0x83:	/* Grp1 */
 		switch (c->modrm_reg) {
 		case 0:
@@ -2031,28 +2034,11 @@ twobyte_insn:
 		if (!test_cc(c->b, ctxt->eflags))
 			c->dst.type = OP_NONE; /* no writeback */
 		break;
-	case 0x80 ... 0x8f: /* jnz rel, etc*/ {
-		long int rel;
-
-		switch (c->op_bytes) {
-		case 2:
-			rel = insn_fetch(s16, 2, c->eip);
-			break;
-		case 4:
-			rel = insn_fetch(s32, 4, c->eip);
-			break;
-		case 8:
-			rel = insn_fetch(s64, 8, c->eip);
-			break;
-		default:
-			DPRINTF("jnz: Invalid op_bytes\n");
-			goto cannot_emulate;
-		}
+	case 0x80 ... 0x8f: /* jnz rel, etc*/
 		if (test_cc(c->b, ctxt->eflags))
-			jmp_rel(c, rel);
+			jmp_rel(c, c->src.val);
 		c->dst.type = OP_NONE;
 		break;
-	}
 	case 0xa3:
 	      bt:		/* bt */
 		c->dst.type = OP_NONE;


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/9] Complete decoding of call near in decode stage.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
                   ` (2 preceding siblings ...)
  2009-04-05 13:59 ` [PATCH 4/9] Complete short/near jcc decoding in " Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-05 13:59 ` [PATCH 6/9] Completely decode in/out at decoding stage Gleb Natapov
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 1790933..3c23af0 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -196,7 +196,7 @@ static u32 opcode_table[256] = {
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	/* 0xE8 - 0xEF */
-	ImplicitOps | Stack, SrcImm | ImplicitOps,
+	SrcImm | ImplicitOps | Stack, SrcImm | ImplicitOps,
 	SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps,
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
 	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
@@ -1789,18 +1789,7 @@ special_insn:
 		io_dir_in = 0;
 		goto do_io;
 	case 0xe8: /* call (near) */ {
-		long int rel;
-		switch (c->op_bytes) {
-		case 2:
-			rel = insn_fetch(s16, 2, c->eip);
-			break;
-		case 4:
-			rel = insn_fetch(s32, 4, c->eip);
-			break;
-		default:
-			DPRINTF("Call: Invalid op_bytes\n");
-			goto cannot_emulate;
-		}
+		long int rel = c->src.val;
 		c->src.val = (unsigned long) c->eip;
 		jmp_rel(c, rel);
 		emulate_push(ctxt);


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/9] Completely decode in/out at decoding stage.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
                   ` (3 preceding siblings ...)
  2009-04-05 13:59 ` [PATCH 5/9] Complete decoding of call near " Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-11 11:08   ` Avi Kivity
  2009-04-05 13:59 ` [PATCH 7/9] Decode soft interrupt instructions Gleb Natapov
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 3c23af0..cf27e62 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -193,8 +193,10 @@ static u32 opcode_table[256] = {
 	0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0xE0 - 0xE7 */
 	0, 0, 0, 0,
-	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
-	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
+	SrcNone | ByteOp | SrcImmByte | ImplicitOps,
+	SrcNone | SrcImmByte | ImplicitOps,
+	SrcNone | ByteOp | SrcImmByte | ImplicitOps,
+	SrcNone | SrcImmByte | ImplicitOps,
 	/* 0xE8 - 0xEF */
 	SrcImm | ImplicitOps | Stack, SrcImm | ImplicitOps,
 	SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps,
@@ -1780,12 +1782,12 @@ special_insn:
 		break;
 	case 0xe4: 	/* inb */
 	case 0xe5: 	/* in */
-		port = insn_fetch(u8, 1, c->eip);
+		port = c->src.val;
 		io_dir_in = 1;
 		goto do_io;
 	case 0xe6: /* outb */
 	case 0xe7: /* out */
-		port = insn_fetch(u8, 1, c->eip);
+		port = c->src.val;
 		io_dir_in = 0;
 		goto do_io;
 	case 0xe8: /* call (near) */ {


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 7/9] Decode soft interrupt instructions.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
                   ` (4 preceding siblings ...)
  2009-04-05 13:59 ` [PATCH 6/9] Completely decode in/out at decoding stage Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-05 13:59 ` [PATCH 8/9] Add new mode of instruction emulation: skip Gleb Natapov
  2009-04-05 13:59 ` [PATCH 9/9] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

Do not emulate them yet.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index cf27e62..fcaad4b 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -184,7 +184,8 @@ static u32 opcode_table[256] = {
 	0, ImplicitOps | Stack, 0, 0,
 	ByteOp | DstMem | SrcImm | ModRM | Mov, DstMem | SrcImm | ModRM | Mov,
 	/* 0xC8 - 0xCF */
-	0, 0, 0, ImplicitOps | Stack, 0, 0, 0, 0,
+	0, 0, 0, ImplicitOps | Stack, ImplicitOps, ImplicitOps | SrcImmByte,
+	ImplicitOps, ImplicitOps,
 	/* 0xD0 - 0xD7 */
 	ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM,
 	ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 8/9] Add new mode of instruction emulation: skip.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
                   ` (5 preceding siblings ...)
  2009-04-05 13:59 ` [PATCH 7/9] Decode soft interrupt instructions Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  2009-04-05 13:59 ` [PATCH 9/9] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

In the new mode instruction is decoded, but not executed. The EIP
is moved to point after the instruction.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/include/asm/kvm_host.h |    1 +
 arch/x86/kvm/x86.c              |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3fc4623..e672ca5 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -565,6 +565,7 @@ enum emulation_result {
 
 #define EMULTYPE_NO_DECODE	    (1 << 0)
 #define EMULTYPE_TRAP_UD	    (1 << 1)
+#define EMULTYPE_SKIP		    (1 << 2)
 int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run,
 			unsigned long cr2, u16 error_code, int emulation_type);
 void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1d9a312..32c7b8f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2411,6 +2411,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
 		}
 	}
 
+	if (emulation_type & EMULTYPE_SKIP) {
+		kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.decode.eip);
+		return EMULATE_DONE;
+	}
+
 	r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
 
 	if (vcpu->arch.pio.string)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 9/9] [AMD] Skip instruction on a task switch only when appropriate.
  2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
                   ` (6 preceding siblings ...)
  2009-04-05 13:59 ` [PATCH 8/9] Add new mode of instruction emulation: skip Gleb Natapov
@ 2009-04-05 13:59 ` Gleb Natapov
  7 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2009-04-05 13:59 UTC (permalink / raw)
  To: avi; +Cc: kvm

If a task switch was initiated because off a task gate in IDT and IDT
was accessed because of an external even the instruction should not
be skipped.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/svm.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3ffb695..053f3c5 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1826,6 +1826,7 @@ static int task_switch_interception(struct vcpu_svm *svm,
 	int reason;
 	int int_type = svm->vmcb->control.exit_int_info &
 		SVM_EXITINTINFO_TYPE_MASK;
+	int int_vec = svm->vmcb->control.exit_int_info & SVM_EVTINJ_VEC_MASK;
 
 	tss_selector = (u16)svm->vmcb->control.exit_info_1;
 
@@ -1841,8 +1842,14 @@ static int task_switch_interception(struct vcpu_svm *svm,
 		reason = TASK_SWITCH_CALL;
 
 
-	if (reason != TASK_SWITCH_GATE || int_type == SVM_EXITINTINFO_TYPE_SOFT)
-		skip_emulated_instruction(&svm->vcpu);
+	if (reason != TASK_SWITCH_GATE ||
+	    int_type == SVM_EXITINTINFO_TYPE_SOFT ||
+	    (int_type == SVM_EXITINTINFO_TYPE_EXEPT &&
+	     (int_vec == OF_VECTOR || int_vec == BP_VECTOR))) {
+		if (emulate_instruction(&svm->vcpu, kvm_run, 0, 0,
+					EMULTYPE_SKIP) != EMULATE_DONE)
+			return 0;
+	}
 
 	return kvm_task_switch(&svm->vcpu, tss_selector, reason);
 }


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/9] Completely decode in/out at decoding stage.
  2009-04-05 13:59 ` [PATCH 6/9] Completely decode in/out at decoding stage Gleb Natapov
@ 2009-04-11 11:08   ` Avi Kivity
  0 siblings, 0 replies; 11+ messages in thread
From: Avi Kivity @ 2009-04-11 11:08 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm

Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>
>  arch/x86/kvm/x86_emulate.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
> index 3c23af0..cf27e62 100644
> --- a/arch/x86/kvm/x86_emulate.c
> +++ b/arch/x86/kvm/x86_emulate.c
> @@ -193,8 +193,10 @@ static u32 opcode_table[256] = {
>  	0, 0, 0, 0, 0, 0, 0, 0,
>  	/* 0xE0 - 0xE7 */
>  	0, 0, 0, 0,
> -	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
> -	SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
> +	SrcNone | ByteOp | SrcImmByte | ImplicitOps,
> +	SrcNone | SrcImmByte | ImplicitOps,
> +	SrcNone | ByteOp | SrcImmByte | ImplicitOps,
> +	SrcNone | SrcImmByte | ImplicitOps,
>   

SrcImmByte sign extends, but you want zero extension here.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/9] Add lcall decoding.
  2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
@ 2009-04-11 11:09   ` Avi Kivity
  0 siblings, 0 replies; 11+ messages in thread
From: Avi Kivity @ 2009-04-11 11:09 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm

Gleb Natapov wrote:
> No emulation yet.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>
>  arch/x86/kvm/x86_emulate.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
> index c015063..fe0dec2 100644
> --- a/arch/x86/kvm/x86_emulate.c
> +++ b/arch/x86/kvm/x86_emulate.c
> @@ -154,7 +154,8 @@ static u32 opcode_table[256] = {
>  	/* 0x90 - 0x97 */
>  	DstReg, DstReg, DstReg, DstReg,	DstReg, DstReg, DstReg, DstReg,
>  	/* 0x98 - 0x9F */
> -	0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
> +	0, 0, SrcImm | Src2Imm16 | ImplicitOps, 0, ImplicitOps | Stack,
> +	ImplicitOps | Stack, 0, 0,
>  	/* 0xA0 - 0xA7 */
>  	ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs,
>  	ByteOp | DstMem | SrcReg | Mov | MemAbs, DstMem | SrcReg | Mov | MemAbs,
>
>   

Please keep 4 or 8 opcodes per line.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-04-11 11:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
2009-04-11 11:09   ` Avi Kivity
2009-04-05 13:59 ` [PATCH 3/9] Complete ljmp decoding at decode stage Gleb Natapov
2009-04-05 13:59 ` [PATCH 4/9] Complete short/near jcc decoding in " Gleb Natapov
2009-04-05 13:59 ` [PATCH 5/9] Complete decoding of call near " Gleb Natapov
2009-04-05 13:59 ` [PATCH 6/9] Completely decode in/out at decoding stage Gleb Natapov
2009-04-11 11:08   ` Avi Kivity
2009-04-05 13:59 ` [PATCH 7/9] Decode soft interrupt instructions Gleb Natapov
2009-04-05 13:59 ` [PATCH 8/9] Add new mode of instruction emulation: skip Gleb Natapov
2009-04-05 13:59 ` [PATCH 9/9] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).