[PATCH] x86/hvm: Use system descriptor type names in hvm_task_switch()

Andrew Cooper posted 1 patch 1 month ago
xen/arch/x86/hvm/hvm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH] x86/hvm: Use system descriptor type names in hvm_task_switch()
Posted by Andrew Cooper 1 month ago
... rather than magic numbers.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/hvm/hvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 955fc062a5c7..56bc2857389c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3066,7 +3066,8 @@ void hvm_task_switch(
     if ( tr.g )
         tr.limit = (tr.limit << 12) | 0xfffu;
 
-    if ( tr.type != ((taskswitch_reason == TSW_iret) ? 0xb : 0x9) )
+    if ( tr.type != (taskswitch_reason == TSW_iret
+                     ? SYS_DESC_tss_busy : SYS_DESC_tss_avail) )
     {
         hvm_inject_hw_exception(
             (taskswitch_reason == TSW_iret) ? X86_EXC_TS : X86_EXC_GP,
@@ -3192,7 +3193,7 @@ void hvm_task_switch(
             goto out;
     }
 
-    tr.type = 0xb; /* busy 32-bit tss */
+    tr.type = SYS_DESC_tss_busy;
     hvm_set_segment_register(v, x86_seg_tss, &tr);
 
     v->arch.hvm.guest_cr[0] |= X86_CR0_TS;
-- 
2.39.5


Re: [PATCH] x86/hvm: Use system descriptor type names in hvm_task_switch()
Posted by Jan Beulich 1 month ago
On 20.08.2026 11:17, Andrew Cooper wrote:
> ... rather than magic numbers.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>