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