From: dv Date: Sat, 6 Jan 2024 13:17:20 +0000 (+0000) Subject: vmm(4): reorder segment registers to match SDM. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=205ff0180a066059076bf09dbc263e2a1d56dbf0;p=openbsd vmm(4): reorder segment registers to match SDM. Shuffles around the defines so the segment register indexes match the values used by both Intel and AMD in vm exit information. Simplifies some upcoming changes. ok mlarkin@ --- diff --git a/sys/arch/amd64/amd64/vmm_machdep.c b/sys/arch/amd64/amd64/vmm_machdep.c index 8d8557471e0..eafbcf8fafc 100644 --- a/sys/arch/amd64/amd64/vmm_machdep.c +++ b/sys/arch/amd64/amd64/vmm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm_machdep.c,v 1.12 2023/12/10 21:25:14 dv Exp $ */ +/* $OpenBSD: vmm_machdep.c,v 1.13 2024/01/06 13:17:20 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -213,18 +213,18 @@ const struct { uint64_t arid; uint64_t baseid; } vmm_vmx_sreg_vmcs_fields[] = { + { VMCS_GUEST_IA32_ES_SEL, VMCS_GUEST_IA32_ES_LIMIT, + VMCS_GUEST_IA32_ES_AR, VMCS_GUEST_IA32_ES_BASE }, { VMCS_GUEST_IA32_CS_SEL, VMCS_GUEST_IA32_CS_LIMIT, VMCS_GUEST_IA32_CS_AR, VMCS_GUEST_IA32_CS_BASE }, + { VMCS_GUEST_IA32_SS_SEL, VMCS_GUEST_IA32_SS_LIMIT, + VMCS_GUEST_IA32_SS_AR, VMCS_GUEST_IA32_SS_BASE }, { VMCS_GUEST_IA32_DS_SEL, VMCS_GUEST_IA32_DS_LIMIT, VMCS_GUEST_IA32_DS_AR, VMCS_GUEST_IA32_DS_BASE }, - { VMCS_GUEST_IA32_ES_SEL, VMCS_GUEST_IA32_ES_LIMIT, - VMCS_GUEST_IA32_ES_AR, VMCS_GUEST_IA32_ES_BASE }, { VMCS_GUEST_IA32_FS_SEL, VMCS_GUEST_IA32_FS_LIMIT, VMCS_GUEST_IA32_FS_AR, VMCS_GUEST_IA32_FS_BASE }, { VMCS_GUEST_IA32_GS_SEL, VMCS_GUEST_IA32_GS_LIMIT, VMCS_GUEST_IA32_GS_AR, VMCS_GUEST_IA32_GS_BASE }, - { VMCS_GUEST_IA32_SS_SEL, VMCS_GUEST_IA32_SS_LIMIT, - VMCS_GUEST_IA32_SS_AR, VMCS_GUEST_IA32_SS_BASE }, { VMCS_GUEST_IA32_LDTR_SEL, VMCS_GUEST_IA32_LDTR_LIMIT, VMCS_GUEST_IA32_LDTR_AR, VMCS_GUEST_IA32_LDTR_BASE }, { VMCS_GUEST_IA32_TR_SEL, VMCS_GUEST_IA32_TR_LIMIT, diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 00471432c3e..5f662010e69 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.95 2023/11/28 00:17:48 dv Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.96 2024/01/06 13:17:20 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -397,12 +397,12 @@ struct vcpu_segment_info { #define VCPU_REGS_PDPTE3 9 #define VCPU_REGS_NCRS (VCPU_REGS_PDPTE3 + 1) -#define VCPU_REGS_CS 0 -#define VCPU_REGS_DS 1 -#define VCPU_REGS_ES 2 -#define VCPU_REGS_FS 3 -#define VCPU_REGS_GS 4 -#define VCPU_REGS_SS 5 +#define VCPU_REGS_ES 0 +#define VCPU_REGS_CS 1 +#define VCPU_REGS_SS 2 +#define VCPU_REGS_DS 3 +#define VCPU_REGS_FS 4 +#define VCPU_REGS_GS 5 #define VCPU_REGS_LDTR 6 #define VCPU_REGS_TR 7 #define VCPU_REGS_NSREGS (VCPU_REGS_TR + 1)