Home | History | Annotate | Download | only in IA32
      1 /** @file
      2   Execute 32-bit code in Protected Mode.
      3 
      4   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php.
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #include <Uefi.h>
     16 #include <FspApi.h>
     17 
     18 typedef
     19 EFI_STATUS
     20 (EFIAPI *FSP_FUNCTION) (
     21   IN VOID *Param1
     22   );
     23 
     24 /**
     25   Wrapper for a thunk  to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
     26   long mode.
     27 
     28   @param[in] Function     The 32bit code entry to be executed.
     29   @param[in] Param1       The first parameter to pass to 32bit code.
     30 
     31   @return EFI_STATUS.
     32 **/
     33 EFI_STATUS
     34 Execute32BitCode (
     35   IN UINT64      Function,
     36   IN UINT64      Param1
     37   )
     38 {
     39   FSP_FUNCTION               EntryFunc;
     40   EFI_STATUS                 Status;
     41 
     42   EntryFunc = (FSP_FUNCTION) (UINTN) (Function);
     43   Status    = EntryFunc ((VOID *)(UINTN)Param1);
     44 
     45   return Status;
     46 }
     47 
     48