]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/EbcInt.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcInt.h
index 01ac4412151ce6b8be304b427a3236215c57985d..646e3a613b989bb88971632407016df1b90a3fd3 100644 (file)
@@ -3,43 +3,32 @@
   main interpreter routines.\r
 \r
 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #ifndef _EBC_INT_H_\r
 #define _EBC_INT_H_\r
 \r
-\r
 #include <Uefi.h>\r
 \r
 #include <Protocol/DebugSupport.h>\r
 #include <Protocol/Ebc.h>\r
 #include <Protocol/EbcVmTest.h>\r
 #include <Protocol/EbcSimpleDebugger.h>\r
+#include <Protocol/PeCoffImageEmulator.h>\r
 \r
 #include <Library/BaseLib.h>\r
+#include <Library/CacheMaintenanceLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/PeCoffLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 \r
-extern VM_CONTEXT                    *mVmPtr;\r
+extern VM_CONTEXT  *mVmPtr;\r
 \r
-//\r
-// Bits of exception flags field of VM context\r
-//\r
-#define EXCEPTION_FLAG_FATAL    0x80000000  // can't continue\r
-#define EXCEPTION_FLAG_ERROR    0x40000000  // bad, but try to continue\r
-#define EXCEPTION_FLAG_WARNING  0x20000000  // harmless problem\r
-#define EXCEPTION_FLAG_NONE     0x00000000  // for normal return\r
 //\r
 // Flags passed to the internal create-thunks function.\r
 //\r
@@ -70,10 +59,10 @@ extern VM_CONTEXT                    *mVmPtr;
 **/\r
 EFI_STATUS\r
 EbcCreateThunks (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN VOID                 *EbcEntryPoint,\r
-  OUT VOID                **Thunk,\r
-  IN  UINT32              Flags\r
+  IN EFI_HANDLE  ImageHandle,\r
+  IN VOID        *EbcEntryPoint,\r
+  OUT VOID       **Thunk,\r
+  IN  UINT32     Flags\r
   );\r
 \r
 /**\r
@@ -91,45 +80,24 @@ EbcCreateThunks (
 **/\r
 EFI_STATUS\r
 EbcAddImageThunk (\r
-  IN EFI_HANDLE      ImageHandle,\r
-  IN VOID            *ThunkBuffer,\r
-  IN UINT32          ThunkSize\r
-  );\r
-\r
-//\r
-// The interpreter calls these when an exception is detected,\r
-// or as a periodic callback.\r
-//\r
-/**\r
-  The VM interpreter calls this function when an exception is detected.\r
-\r
-  @param  ExceptionType          Specifies the processor exception detected.\r
-  @param  ExceptionFlags         Specifies the exception context.\r
-  @param  VmPtr                  Pointer to a VM context for passing info to the\r
-                                 EFI debugger.\r
-\r
-  @retval EFI_SUCCESS            This function completed successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EbcDebugSignalException (\r
-  IN EFI_EXCEPTION_TYPE                   ExceptionType,\r
-  IN EXCEPTION_FLAGS                      ExceptionFlags,\r
-  IN VM_CONTEXT                           *VmPtr\r
+  IN EFI_HANDLE  ImageHandle,\r
+  IN VOID        *ThunkBuffer,\r
+  IN UINT32      ThunkSize\r
   );\r
 \r
 //\r
 // Define a constant of how often to call the debugger periodic callback\r
 // function.\r
 //\r
-#define EFI_TIMER_UNIT_1MS            (1000 * 10)\r
-#define EBC_VM_PERIODIC_CALLBACK_RATE (1000 * EFI_TIMER_UNIT_1MS)\r
-#define STACK_POOL_SIZE               (1024 * 1020)\r
-#define MAX_STACK_NUM                 4\r
+#define EFI_TIMER_UNIT_1MS             (1000 * 10)\r
+#define EBC_VM_PERIODIC_CALLBACK_RATE  (1000 * EFI_TIMER_UNIT_1MS)\r
+#define STACK_POOL_SIZE                (1024 * 1020)\r
+#define MAX_STACK_NUM                  4\r
 \r
 //\r
 // External low level functions that are native-processor dependent\r
 //\r
+\r
 /**\r
   The VM thunk code stuffs an EBC entry point into a processor\r
   register. Since we can't use inline assembly to get it from\r
@@ -163,9 +131,9 @@ EbcLLGetEbcEntryPoint (
 INT64\r
 EFIAPI\r
 EbcLLCALLEXNative (\r
-  IN UINTN        CallAddr,\r
-  IN UINTN        EbcSp,\r
-  IN VOID         *FramePtr\r
+  IN UINTN  CallAddr,\r
+  IN UINTN  EbcSp,\r
+  IN VOID   *FramePtr\r
   );\r
 \r
 /**\r
@@ -185,11 +153,11 @@ EbcLLCALLEXNative (
 **/\r
 VOID\r
 EbcLLCALLEX (\r
-  IN VM_CONTEXT   *VmPtr,\r
-  IN UINTN        FuncAddr,\r
-  IN UINTN        NewStackPointer,\r
-  IN VOID         *FramePtr,\r
-  IN UINT8        Size\r
+  IN VM_CONTEXT  *VmPtr,\r
+  IN UINTN       FuncAddr,\r
+  IN UINTN       NewStackPointer,\r
+  IN VOID        *FramePtr,\r
+  IN UINT8       Size\r
   );\r
 \r
 /**\r
@@ -206,10 +174,10 @@ EbcLLCALLEX (
 \r
 **/\r
 EFI_STATUS\r
-GetEBCStack(\r
-  IN  EFI_HANDLE Handle,\r
-  OUT VOID       **StackBuffer,\r
-  OUT UINTN      *BufferIndex\r
+GetEBCStack (\r
+  IN  EFI_HANDLE  Handle,\r
+  OUT VOID        **StackBuffer,\r
+  OUT UINTN       *BufferIndex\r
   );\r
 \r
 /**\r
@@ -221,8 +189,8 @@ GetEBCStack(
 \r
 **/\r
 EFI_STATUS\r
-ReturnEBCStack(\r
-  IN UINTN Index\r
+ReturnEBCStack (\r
+  IN UINTN  Index\r
   );\r
 \r
 /**\r
@@ -244,7 +212,7 @@ InitEBCStack (
 \r
 **/\r
 EFI_STATUS\r
-FreeEBCStack(\r
+FreeEBCStack (\r
   VOID\r
   );\r
 \r
@@ -257,22 +225,34 @@ FreeEBCStack(
 \r
 **/\r
 EFI_STATUS\r
-ReturnEBCStackByHandle(\r
-  IN EFI_HANDLE Handle\r
+ReturnEBCStackByHandle (\r
+  IN EFI_HANDLE  Handle\r
   );\r
 \r
 typedef struct {\r
-  EFI_EBC_PROTOCOL  *This;\r
-  VOID              *EntryPoint;\r
-  EFI_HANDLE        ImageHandle;\r
-  VM_CONTEXT        VmContext;\r
+  EFI_EBC_PROTOCOL    *This;\r
+  VOID                *EntryPoint;\r
+  EFI_HANDLE          ImageHandle;\r
+  VM_CONTEXT          VmContext;\r
 } EFI_EBC_THUNK_DATA;\r
 \r
-#define EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('e', 'b', 'c', 'p')\r
-\r
+#define EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('e', 'b', 'c', 'p')\r
 \r
 #define EBC_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \\r
       CR(a, EBC_PROTOCOL_PRIVATE_DATA, EbcProtocol, EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE)\r
 \r
+/**\r
+  Allocates a buffer of type EfiBootServicesCode.\r
+\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+EbcAllocatePoolForThunk (\r
+  IN UINTN  AllocationSize\r
+  );\r
 \r
 #endif // #ifndef _EBC_INT_H_\r