Patch: ltr for x86_64 should check the upper descriptor type
The Intel manual states for LTR and 64-Bit Exceptions:
#GP(selector)
If the descriptor type of the upper 8-byte of the 16-byte descriptor is non-zero.
Qemu currently does not check this. The attached patch fixes the bug.
Bernhard Kauer
helper.c renamed from helper.c.orig +4 -1
@@ -1825,8 +1825,11 @@raise_exception_err (EXCP0B_NOSEG , selector &0xfffc );#ifdef TARGET_X86_64 if (env->hflags &HF_LMA_MASK ) { -uint32_t e3; +uint32_t e3, e4; e3 =ldl_kernel (ptr +8 ); + e4 =ldl_kernel (ptr +12 ); +if ((e4 >>DESC_TYPE_SHIFT ) &0xf ) +raise_exception_err (EXCP0D_GPF , selector &0xfffc );load_seg_cache_raw_dt (&env->tr, e1, e2); env->tr.base |= (target_ulong )e3 <<32 ; }else
Does this fix some specific bug you encountered?
J
Quoted 10 lines · Bernhard Kauer
The Intel manual states for LTR and 64-Bit Exceptions:
#GP(selector)
If the descriptor type of the upper 8-byte of the 16-byte descriptor is non-zero.Qemu currently does not check this. The attached patch fixes the bug.
Bernhard Kauer
Quoted 2 lines · Julian Seward
Does this fix some specific bug you encountered?
I have some code here that runs on Qemu but not on real hardware due to this missing check.
Bernhard
Quoted 8 lines · Bernhard Kauer
Quoted 7 lines
The Intel manual states for LTR and 64-Bit Exceptions:
#GP(selector)
If the descriptor type of the upper 8-byte of the 16-byte descriptor is non-zero.Qemu currently does not check this. The attached patch fixes the bug.