Commit 79d5b4c3 authored by Avi Kivity's avatar Avi Kivity

KVM: x86 emulator: allow loading null SS in long mode

Null SS is valid in long mode; allow loading it.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 6d6eede4
...@@ -1324,8 +1324,14 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, ...@@ -1324,8 +1324,14 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
goto load; goto load;
} }
/* NULL selector is not valid for TR, CS and SS */ rpl = selector & 3;
if ((seg == VCPU_SREG_CS || seg == VCPU_SREG_SS || seg == VCPU_SREG_TR) cpl = ctxt->ops->cpl(ctxt);
/* NULL selector is not valid for TR, CS and SS (except for long mode) */
if ((seg == VCPU_SREG_CS
|| (seg == VCPU_SREG_SS
&& (ctxt->mode != X86EMUL_MODE_PROT64 || rpl != cpl))
|| seg == VCPU_SREG_TR)
&& null_selector) && null_selector)
goto exception; goto exception;
...@@ -1352,9 +1358,7 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, ...@@ -1352,9 +1358,7 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
goto exception; goto exception;
} }
rpl = selector & 3;
dpl = seg_desc.dpl; dpl = seg_desc.dpl;
cpl = ctxt->ops->cpl(ctxt);
switch (seg) { switch (seg) {
case VCPU_SREG_SS: case VCPU_SREG_SS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment