WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86/EFI: fix interrupt and fault handling during run

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86/EFI: fix interrupt and fault handling during runtime services calls
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Thu, 30 Jun 2011 13:50:40 +0100
Delivery-date: Thu, 30 Jun 2011 05:52:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The missing piece was the setting up of an accessible GDT prior to
switching page tables (and reverting to the original setting after
having established the normal page tables again afterwards).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/xen/arch/x86/efi/runtime.c
+++ b/xen/arch/x86/efi/runtime.c
@@ -43,6 +43,17 @@ unsigned long efi_rs_enter(void)
     /* prevent fixup_page_fault() from doing anything */
     irq_enter();
 
+    if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) )
+    {
+        struct desc_ptr gdt_desc = {
+            .limit = LAST_RESERVED_GDT_BYTE,
+            .base  = (unsigned long)(per_cpu(gdt_table, smp_processor_id()) -
+                                     FIRST_RESERVED_GDT_ENTRY)
+        };
+
+        asm volatile ( "lgdt %0" : : "m" (gdt_desc) );
+    }
+
     write_cr3(virt_to_maddr(efi_l4_pgtable));
 
     return cr3;
@@ -51,6 +62,15 @@ unsigned long efi_rs_enter(void)
 void efi_rs_leave(unsigned long cr3)
 {
     write_cr3(cr3);
+    if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) )
+    {
+        struct desc_ptr gdt_desc = {
+            .limit = LAST_RESERVED_GDT_BYTE,
+            .base  = GDT_VIRT_START(current)
+        };
+
+        asm volatile ( "lgdt %0" : : "m" (gdt_desc) );
+    }
     irq_exit();
     spin_unlock(&efi_rs_lock);
 }



Attachment: x86-EFI-runtime-gdt.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86/EFI: fix interrupt and fault handling during runtime services calls, Jan Beulich <=