diff options
Diffstat (limited to 'MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c')
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c | 85 |
1 files changed, 53 insertions, 32 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c index 184c672f16..a31422b62a 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c @@ -27,6 +27,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define STACK_REMAIN_SIZE (1024 * 4)
+/**
+ Begin executing an EBC image.
+ This is used for Ebc Thunk call.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLEbcInterpret (
+ VOID
+ );
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc image entrypoint.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLExecuteEbcImageEntryPoint (
+ VOID
+ );
/**
Pushes a 64 bit unsigned value to the VM stack.
@@ -52,14 +77,13 @@ PushU64 ( /**
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
+ Begin executing an EBC image.
This is a thunk function. Microsoft x64 compiler only provide fast_call
calling convention, so the first four arguments are passed by rcx, rdx,
r8, and r9, while other arguments are passed in stack.
+ @param EntryPoint The entrypoint of EBC code.
@param Arg1 The 1st argument.
@param Arg2 The 2nd argument.
@param Arg3 The 3rd argument.
@@ -83,22 +107,23 @@ PushU64 ( UINT64
EFIAPI
EbcInterpret (
- IN OUT UINTN Arg1,
- IN OUT UINTN Arg2,
- IN OUT UINTN Arg3,
- IN OUT UINTN Arg4,
- IN OUT UINTN Arg5,
- IN OUT UINTN Arg6,
- IN OUT UINTN Arg7,
- IN OUT UINTN Arg8,
- IN OUT UINTN Arg9,
- IN OUT UINTN Arg10,
- IN OUT UINTN Arg11,
- IN OUT UINTN Arg12,
- IN OUT UINTN Arg13,
- IN OUT UINTN Arg14,
- IN OUT UINTN Arg15,
- IN OUT UINTN Arg16
+ IN UINTN EntryPoint,
+ IN UINTN Arg1,
+ IN UINTN Arg2,
+ IN UINTN Arg3,
+ IN UINTN Arg4,
+ IN UINTN Arg5,
+ IN UINTN Arg6,
+ IN UINTN Arg7,
+ IN UINTN Arg8,
+ IN UINTN Arg9,
+ IN UINTN Arg10,
+ IN UINTN Arg11,
+ IN UINTN Arg12,
+ IN UINTN Arg13,
+ IN UINTN Arg14,
+ IN UINTN Arg15,
+ IN UINTN Arg16
)
{
//
@@ -110,11 +135,9 @@ EbcInterpret ( UINTN StackIndex;
//
- // Get the EBC entry point from the processor register.
- // Don't call any function before getting the EBC entry
- // point because this will collab the return register.
+ // Get the EBC entry point
//
- Addr = EbcLLGetEbcEntryPoint ();
+ Addr = EntryPoint;
//
// Now clear out our context
@@ -221,10 +244,9 @@ EbcInterpret ( /**
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
+ Begin executing an EBC image.
+ @param EntryPoint The entrypoint of EBC code.
@param ImageHandle image handle for the EBC application we're executing
@param SystemTable standard system table passed into an driver's entry
point
@@ -235,6 +257,7 @@ EbcInterpret ( UINT64
EFIAPI
ExecuteEbcImageEntryPoint (
+ IN UINTN EntryPoint,
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
@@ -248,11 +271,9 @@ ExecuteEbcImageEntryPoint ( UINTN StackIndex;
//
- // Get the EBC entry point from the processor register. Make sure you don't
- // call any functions before this or you could mess up the register the
- // entry point is passed in.
+ // Get the EBC entry point
//
- Addr = EbcLLGetEbcEntryPoint ();
+ Addr = EntryPoint;
//
// Now clear out our context
@@ -437,9 +458,9 @@ EbcCreateThunks ( // mov r11 123456789abcdef0h => 49 BB F0 DE BC 9A 78 56 34 12
//
if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) {
- Addr = (UINTN) ExecuteEbcImageEntryPoint;
+ Addr = (UINTN) EbcLLExecuteEbcImageEntryPoint;
} else {
- Addr = (UINTN) EbcInterpret;
+ Addr = (UINTN) EbcLLEbcInterpret;
}
//
|