Index: sys/amd64/vmm/amd/svm.c =================================================================== --- sys/amd64/vmm/amd/svm.c (revision 267030) +++ sys/amd64/vmm/amd/svm.c (working copy) @@ -1304,6 +1304,21 @@ desc->base = seg->base; desc->limit = seg->limit; + /* + * VT-x uses bit 16 (Unusable) to indicate a segment that has been + * loaded with a NULL segment selector. The 'desc->access' field is + * interpreted in the VT-x format by the processor-independent code. + * + * SVM uses the 'P' bit to convey the same information so convert it + * into the VT-x format. For more details refer to section + * "Segment State in the VMCB" in APMv2. + */ + if (type == VM_REG_GUEST_CS && type == VM_REG_GUEST_TR) + desc->access |= 0x80; /* CS and TS always present */ + + if (!(desc->access & 0x80)) + desc->access |= 0x10000; /* Unusable segment */ + return (0); }