]> xenbits.xensource.com Git - xen.git/commitdiff
x86: introduce x86_seg_sys
authorJan Beulich <jbeulich@suse.com>
Mon, 30 Sep 2024 08:05:25 +0000 (10:05 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 30 Sep 2024 08:05:25 +0000 (10:05 +0200)
To represent the USER-MSR bitmap access, a new segment type needs
introducing, behaving like x86_seg_none in terms of address treatment,
but behaving like a system segment for page walk purposes (implicit
supervisor-mode access).

While there also add x86_seg_none handling to the test harness'es
read() hook, as will be needed for MSR-LIST support.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/tests/x86_emulator/test_x86_emulator.c
xen/arch/x86/hvm/emulate.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/x86_emulate/x86_emulate.h

index 24343c5d7f6b5d5c9c8f1e750ae36db204725ece..d52c1c53cb01b5dbcf0f9eb653c37d76606e2144 100644 (file)
@@ -593,6 +593,8 @@ static int read(
     default:
         if ( !is_x86_user_segment(seg) )
             return X86EMUL_UNHANDLEABLE;
+    case x86_seg_sys:
+    case x86_seg_none:
         bytes_read += bytes;
         break;
     }
index ecf83795fa585ba988cb8c549a53c944343a034d..aa97ca1cbffd4518351a460691ccecbab07f57f6 100644 (file)
@@ -840,7 +840,7 @@ static int hvmemul_virtual_to_linear(
     int okay;
     unsigned long reps = 1;
 
-    if ( seg == x86_seg_none )
+    if ( seg == x86_seg_none || seg == x86_seg_sys )
     {
         *linear = offset;
         return X86EMUL_OKAY;
index a64eead368e5cdafb093a00227e3e302056ef847..b2e782d596f79ad08fdf8aa43efc4fbd25035d05 100644 (file)
@@ -2599,7 +2599,7 @@ bool hvm_vcpu_virtual_to_linear(
      * It is expected that the access rights of reg are suitable for seg (and
      * that this is enforced at the point that seg is loaded).
      */
-    ASSERT(seg < x86_seg_none);
+    ASSERT(seg < x86_seg_sys);
 
     /* However, check that insn fetches only ever specify CS. */
     ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
index 92bb10c504641bd9a6b8fbaa9a222bae236252b7..e0793b26db6389b81a506b70cf28a35a3501b8fb 100644 (file)
@@ -749,6 +749,7 @@ static void cf_check svm_set_segment_register(
         vmcb->ldtr = *reg;
         break;
 
+    case x86_seg_sys:
     case x86_seg_none:
         ASSERT_UNREACHABLE();
         break;
index e8a0e572284c2db16171487f01e003ce09297140..3e819d41746ed19bae5251cc54f1be3688d6a0e7 100644 (file)
@@ -43,7 +43,8 @@ enum x86_segment {
     x86_seg_ldtr,
     x86_seg_gdtr,
     x86_seg_idtr,
-    /* No Segment: For accesses which are already linear. */
+    /* No Segment: For (system/normal) accesses which are already linear. */
+    x86_seg_sys,
     x86_seg_none
 };