diff options
author | Jan Beulich <jbeulich@novell.com> | 2011-07-01 20:41:43 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@novell.com> | 2011-07-01 20:41:43 +0100 |
commit | d89149543d5c791af2dc43f59edc2c23b45128f6 (patch) | |
tree | 211d6b9dc1bf03ec1fb44cf42e9922bf46710870 /xen/arch/x86/efi | |
parent | 0bb1c9cd22855b9986c60ace1959ef029c5e0ce0 (diff) | |
download | xen-d89149543d5c791af2dc43f59edc2c23b45128f6.tar.gz xen-d89149543d5c791af2dc43f59edc2c23b45128f6.tar.bz2 xen-d89149543d5c791af2dc43f59edc2c23b45128f6.zip |
x86/EFI: fix interrupt and fault handling during runtime services calls
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@novell.com>
Diffstat (limited to 'xen/arch/x86/efi')
-rw-r--r-- | xen/arch/x86/efi/runtime.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xen/arch/x86/efi/runtime.c b/xen/arch/x86/efi/runtime.c index 8274e22f3e..6286b6a1c8 100644 --- a/xen/arch/x86/efi/runtime.c +++ b/xen/arch/x86/efi/runtime.c @@ -44,6 +44,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; @@ -52,6 +63,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); } |