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