Skip to content

Commit

Permalink
x86/efi: Re-disable interrupts after calling firmware services
Browse files Browse the repository at this point in the history
Some firmware appears to enable interrupts during boot service calls,
even if we've explicitly disabled them prior to the call. This is
actually allowed per the UEFI spec because boottime services expect to
be called with interrupts enabled.

So that's fine, we just need to ensure that we disable them again in
efi_enter32() before switching to a 64-bit GDT, otherwise an interrupt
may fire causing a 32-bit IRQ handler to run after we've left
compatibility mode.

Despite efi_enter32() being called both for boottime and runtime
services, this really only affects boottime because the runtime services
callchain is executed with interrupts disabled. See efi_thunk().

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
  • Loading branch information
Matt Fleming committed Mar 4, 2014
1 parent 108d3f4 commit 18c4646
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/platform/efi/efi_stub_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ ENTRY(efi_enter32)
/* We must preserve return value */
movl %eax, %edi

/*
* Some firmware will return with interrupts enabled. Be sure to
* disable them before we switch GDTs.
*/
cli

movl 44(%esp), %eax
movl %eax, 2(%eax)
lgdtl (%eax)
Expand Down

0 comments on commit 18c4646

Please sign in to comment.