Skip to contentSkip to conversation

(big) real mode emulation - push reg

PATCH Applied Nitin A Kamble 2 participants 4 messages Aug 16, 2007 – Aug 19, 2007 3 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (big) real mode emulation - push reg

Hi Avi,
Attached is a patch to implement instruction:

	push reg (opcode 0x50 - 0x57)

Please apply or comment.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

commit 7f712b2d8cda67299e17473356050490a5c05be5

Author: Nitin A Kamble <[email protected]>
Date:   Thu Aug 16 19:47:19 2007 -0700

Implementing emulation of instructions:
push reg (opcode 0x50-0x57)

drivers/kvm/x86_emulate.c +16 -1
index cfdbaa5..09ca692 100644
@@ -99,7 +99,8 @@ static u8 opcode_table[256] = {
 	/* 0x40 - 0x4F */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0x50 - 0x57 */
-	0, 0, 0, 0, 0, 0, 0, 0,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	/* 0x58 - 0x5F */
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1247,7 +1248,21 @@ pop_instruction:
 		register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
 		no_wb = 1; /* Disable writeback. */
 		break;
+	case 0x50 ... 0x57:  /* push reg */
+		if (op_bytes == 2)
+			src.val = (u16) _regs[b & 0x7];
+		else
+			src.val = (u32) _regs[b & 0x7];
+		dst.type  = OP_MEM;
+		dst.bytes = op_bytes;
+		dst.val = src.val;
+		register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes);
+		dst.ptr = (void *) register_address(
+			ctxt->ss_base, _regs[VCPU_REGS_RSP]);
+		d |= Mov; /* force writeback */
+		break;
 	}
+
 	goto writeback;
 
 twobyte_insn:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 1187307993.10269.8.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org

#2 lore raw
Quoted 11 lines · Nitin A Kamble

Hi Avi,
Attached is a patch to implement instruction:

	push reg (opcode 0x50 - 0x57)

Please apply or comment.

drivers/kvm/x86_emulate.c +4 -0
+	case 0x50 ... 0x57:  /* push reg */
+		if (op_bytes == 2)
+			src.val = (u16) _regs[b & 0x7];
+		else

drivers/kvm/x86_emulate.c pop_instruction: · line 1264

Quoted 10 lines
drivers/kvm/x86_emulate.c +9 -0
+			src.val = (u32) _regs[b & 0x7];
+		dst.type  = OP_MEM;
+		dst.bytes = op_bytes;
+		dst.val = src.val;
+		register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes);
+		dst.ptr = (void *) register_address(
+			ctxt->ss_base, _regs[VCPU_REGS_RSP]);
+		d |= Mov; /* force writeback */
+		break;
 	}

I don't thing 'd |= Mov' is necessary any more to force writeback. Please check.

Also, please keep opcodes in sorted order.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 46C592B6.8030700-atKUWr5tajBWk0Htik3J/[email protected]

#4 lore raw
Quoted 3 lines · Avi Kivity

I don't thing 'd |= Mov' is necessary any more to force writeback. Please check.

Hi Avi,
You are right, it was a bit stale code.

Quoted 1 line

Also, please keep opcodes in sorted order.

It is now.
Resending the updated "push reg" emulation patch.
Please Apply or comment.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

commit 8e55a4dad9f74ed9d883f1faccd11405d6775344

Author: Nitin A Kamble <[email protected]>
Date:   Fri Aug 17 18:47:18 2007 -0700

Implementing emulation of instructions:
push reg (opcode 0x50-0x57)

drivers/kvm/x86_emulate.c +16 -1
index fed0b2a..4eec909 100644
@@ -99,7 +99,8 @@ static u8 opcode_table[256] = {
 	/* 0x40 - 0x4F */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0x50 - 0x57 */
-	0, 0, 0, 0, 0, 0, 0, 0,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	/* 0x58 - 0x5F */
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1148,6 +1149,19 @@ special_insn:
 	if (twobyte)
 		goto twobyte_special_insn;
 	switch(b) {
+	case 0x50 ... 0x57:  /* push reg */
+		if (op_bytes == 2)
+			src.val = (u16) _regs[b & 0x7];
+		else
+			src.val = (u32) _regs[b & 0x7];
+		dst.type  = OP_MEM;
+		dst.bytes = op_bytes;
+		dst.val = src.val;
+		register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes);
+		dst.ptr = (void *) register_address(
+			ctxt->ss_base, _regs[VCPU_REGS_RSP]);
+		no_wb = 1; /* force writeback */
+		break;
 	case 0x6c:		/* insb */
 	case 0x6d:		/* insw/insd */
 		 if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
@@ -1384,6 +1398,7 @@ btc:		/* btc */
 		dst.val = (d & ByteOp) ? (s8) src.val : (s16) src.val;
 		break;
 	}
+
 	goto writeback;
 
 twobyte_special_insn:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 1187389929.9011.18.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org

Applied
#6 lore raw
Quoted 7 lines · Nitin A Kamble
Quoted 3 lines

Also, please keep opcodes in sorted order.

It is now.
Resending the updated "push reg" emulation patch.
Please Apply or comment.

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/