Patchwork kvm: x86: Remove obsolet SS.RPL/DPL aligment

login
register
mail settings
Submitter Jan Kiszka
Date Dec. 27, 2010, 2:57 p.m.
Message ID <4D18A95F.2010601@web.de>
Download mbox | patch
Permalink /patch/76790/
State New
Headers show

Comments

Jan Kiszka - Dec. 27, 2010, 2:57 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

This seems to date back to the days KVM didn't support real mode. The
check is no longer needed and, even worse, is corrupting the guest state
in case SS.RPL != DPL.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 target-i386/kvm.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
Avi Kivity - Dec. 27, 2010, 3:37 p.m.
On 12/27/2010 04:57 PM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> This seems to date back to the days KVM didn't support real mode. The
> check is no longer needed and, even worse, is corrupting the guest state
> in case SS.RPL != DPL.

Applied to uq/master (nice how obsolete code propagates itself); thanks.

Patch

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index b3d7c54..85edacc 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -780,13 +780,6 @@  static int kvm_put_sregs(CPUState *env)
 	    set_seg(&sregs.fs, &env->segs[R_FS]);
 	    set_seg(&sregs.gs, &env->segs[R_GS]);
 	    set_seg(&sregs.ss, &env->segs[R_SS]);
-
-	    if (env->cr[0] & CR0_PE_MASK) {
-		/* force ss cpl to cs cpl */
-		sregs.ss.selector = (sregs.ss.selector & ~3) |
-			(sregs.cs.selector & 3);
-		sregs.ss.dpl = sregs.ss.selector & 3;
-	    }
     }
 
     set_seg(&sregs.tr, &env->tr);