x86/vmx: Update DR7 type
PATCH v4 2/3 x86/vmx: Update DR7 type
From: Denis Mukhin <[email protected]>
Convert the DR7 type to unsigned int and fix the accesses where necessary.
[1] https://lore.kernel.org/xen-devel/[email protected]/
--- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -926,7 +926,7 @@ static void vmx_save_dr(struct vcpu *v) v->arch.dr[3 ] =read_debugreg (3 ); v->arch.dr6 =read_debugreg (6 );/* DR7 must be saved as it is used by vmx_restore_dr(). */ -__vmread (GUEST_DR7 , &v->arch.dr7); + v->arch.dr7 =vmread (GUEST_DR7 ); }static void __restore_debug_registers (struct vcpu *v)
xen/arch/x86/include/asm/domain.h +1 -1
@@ -595,7 +595,7 @@ struct arch_vcpu/* Debug registers. */ unsigned long dr[4 ]; -unsigned long dr7;/* Ideally int, but __vmread() needs long. */ +unsigned int dr7;unsigned int dr6;/* other state */
Signature · 1 line
2.34.1
Quoted 7 lines · On 26.04.2025 09:27, [email protected] wrote:
From: Denis Mukhin <[email protected]>
Convert the DR7 type to
unsigned intand fix the accesses where necessary.[1] https://lore.kernel.org/xen-devel/[email protected]/
Signed-off-by Denis Mukhin <[email protected]>
Quoted 17 lines · On 26/04/2025 8:27 am, [email protected] wrote:
From: Denis Mukhin <[email protected]>
Convert the DR7 type to
unsigned intand fix the accesses where necessary.[1] https://lore.kernel.org/xen-devel/[email protected]/
Signed-off-by Denis Mukhin <[email protected]>--- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/hvm/vmx/vmx.c +0
-0
xen/arch/x86/hvm/vmx/vmx.c static void vmx_save_dr(struct vcpu *v) · line 929
Quoted 5 lines
xen/arch/x86/hvm/vmx/vmx.c +1
-1@@ -926,7 +926,7 @@ static void vmx_save_dr(struct vcpu *v) v->arch.dr[3 ] =read_debugreg (3 ); v->arch.dr6 =read_debugreg (6 );/* DR7 must be saved as it is used by vmx_restore_dr(). */ -__vmread (GUEST_DR7 , &v->arch.dr7); + v->arch.dr7 =vmread (GUEST_DR7 );
Two minor points. The = wants lining up for vertical tabulation, and ...
Quoted 8 lines
xen/arch/x86/hvm/vmx/vmx.c +0
-0}static void __restore_debug_registers (struct vcpu *v)xen/arch/x86/include/asm/domain.h +0
-0
xen/arch/x86/include/asm/domain.h struct arch_vcpu · line 599
Quoted 6 lines
xen/arch/x86/include/asm/domain.h +1
-1@@ -595,7 +595,7 @@ struct arch_vcpu/* Debug registers. */ unsigned long dr[4 ]; -unsigned long dr7;/* Ideally int, but __vmread() needs long. */ +unsigned int dr7;unsigned int dr6;
... these fields want switching back around now that dr7 is unsigned int.
We always access in numeric order, and they're only out-of-order for packing reasons.
Can fix on commit.
~Andrew
Quoted 43 lines · Andrew Cooper
Quoted 17 lines · On 26/04/2025 8:27 am, [email protected] wrote:
From: Denis Mukhin <[email protected]>
Convert the DR7 type to
unsigned intand fix the accesses where necessary.[1] https://lore.kernel.org/xen-devel/[email protected]/
Signed-off-by Denis Mukhin <[email protected]>--- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/hvm/vmx/vmx.c +0
-0xen/arch/x86/hvm/vmx/vmx.c static void vmx_save_dr(struct vcpu *v) · line 929
Quoted 5 lines
xen/arch/x86/hvm/vmx/vmx.c +1
-1@@ -926,7 +926,7 @@ static void vmx_save_dr(struct vcpu *v) v->arch.dr[3 ] =read_debugreg (3 ); v->arch.dr6 =read_debugreg (6 );/* DR7 must be saved as it is used by vmx_restore_dr(). */ -__vmread (GUEST_DR7 , &v->arch.dr7); + v->arch.dr7 =vmread (GUEST_DR7 );Two minor points. The = wants lining up for vertical tabulation, and ...
Quoted 8 lines
xen/arch/x86/hvm/vmx/vmx.c +0
-0}static void __restore_debug_registers (struct vcpu *v)xen/arch/x86/include/asm/domain.h +0
-0xen/arch/x86/include/asm/domain.h struct arch_vcpu · line 599
Quoted 6 lines
xen/arch/x86/include/asm/domain.h +1
-1@@ -595,7 +595,7 @@ struct arch_vcpu/* Debug registers. */ unsigned long dr[4 ]; -unsigned long dr7;/* Ideally int, but __vmread() needs long. */ +unsigned int dr7;unsigned int dr6;... these fields want switching back around now that dr7 is unsigned int.
Quoted 4 lines
We always access in numeric order, and they're only out-of-order for packing reasons.
Can fix on commit.
Thanks!
Quoted 2 lines
~Andrew