]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/IA32/DispatchExecute.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / IntelFsp2WrapperPkg / Library / BaseFspWrapperApiLib / IA32 / DispatchExecute.c
1 /** @file
2 Execute 32-bit code in Protected Mode.
3
4 Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Uefi.h>
10 #include <FspEas.h>
11
12 /**
13 FSP API functions.
14
15 @param[in] Param1 The first parameter to pass to 32bit code.
16 @param[in] Param2 The second parameter to pass to 32bit code.
17
18 @return EFI_STATUS.
19 **/
20 typedef
21 EFI_STATUS
22 (EFIAPI *FSP_FUNCTION)(
23 IN VOID *Param1,
24 IN VOID *Param2
25 );
26
27 /**
28 Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
29 long mode.
30
31 @param[in] Function The 32bit code entry to be executed.
32 @param[in] Param1 The first parameter to pass to 32bit code.
33 @param[in] Param2 The second parameter to pass to 32bit code.
34
35 @return EFI_STATUS.
36 **/
37 EFI_STATUS
38 Execute32BitCode (
39 IN UINT64 Function,
40 IN UINT64 Param1,
41 IN UINT64 Param2
42 )
43 {
44 FSP_FUNCTION EntryFunc;
45 EFI_STATUS Status;
46
47 EntryFunc = (FSP_FUNCTION)(UINTN)(Function);
48 Status = EntryFunc ((VOID *)(UINTN)Param1, (VOID *)(UINTN)Param2);
49
50 return Status;
51 }
52
53 /**
54 Wrapper for a thunk to transition from compatibility mode to long mode to execute 64-bit code and then transit back to
55 compatibility mode.
56
57 @param[in] Function The 64bit code entry to be executed.
58 @param[in] Param1 The first parameter to pass to 64bit code.
59 @param[in] Param2 The second parameter to pass to 64bit code.
60
61 @return EFI_STATUS.
62 **/
63 EFI_STATUS
64 Execute64BitCode (
65 IN UINT64 Function,
66 IN UINT64 Param1,
67 IN UINT64 Param2
68 )
69 {
70 return EFI_UNSUPPORTED;
71 }