otherwise, set the VM->IP to target EBC code directly to avoid another VM\r
be startup which cost time and stack space.\r
\r
- @parm VmPtr Pointer to a VM context.\r
- @parm FuncAddr Callee's address\r
- @parm NewStackPointer New stack pointer after the call\r
- @parm FramePtr New frame pointer after the call\r
- @parm Size The size of call instruction\r
-\r
- @return None.\r
+ @param VmPtr Pointer to a VM context.\r
+ @param FuncAddr Callee's address\r
+ @param NewStackPointer New stack pointer after the call\r
+ @param FramePtr New frame pointer after the call\r
+ @param Size The size of call instruction\r
\r
**/\r
VOID\r
in via a processor register, so we'll need to make a call to get the\r
value.\r
\r
- None. Since we're called from a fixed up thunk (which we want to keep\r
- small), our only so-called argument is the EBC entry point passed in\r
- to us in a processor register.\r
+ This is a thunk function. Microsoft x64 compiler only provide fast_call\r
+ calling convention, so the first four arguments are passed by rcx, rdx,\r
+ r8, and r9, while other arguments are passed in stack.\r
+\r
+ @param Arg1 The 1st argument.\r
+ @param Arg2 The 2nd argument.\r
+ @param Arg3 The 3rd argument.\r
+ @param Arg4 The 4th argument.\r
+ @param Arg5 The 5th argument.\r
+ @param Arg6 The 6th argument.\r
+ @param Arg7 The 7th argument.\r
+ @param Arg8 The 8th argument.\r
+ @param Arg9 The 9th argument.\r
+ @param Arg10 The 10th argument.\r
+ @param Arg11 The 11th argument.\r
+ @param Arg12 The 12th argument.\r
+ @param Arg13 The 13th argument.\r
+ @param Arg14 The 14th argument.\r
+ @param Arg15 The 15th argument.\r
+ @param Arg16 The 16th argument.\r
\r
@return The value returned by the EBC application we're going to run.\r
\r
in via a processor register, so we'll need to make a call to get the\r
value.\r
\r
- @param ImageHandle image handle for the EBC application we're executing\r
- @param SystemTable standard system table passed into an driver's entry point\r
+ @param ImageHandle image handle for the EBC application we're executing\r
+ @param SystemTable standard system table passed into an driver's entry\r
+ point\r
\r
@return The value returned by the EBC application we're going to run.\r
\r
\r
\r
/**\r
- Create an IA32 thunk for the given EBC entry point.\r
+ Create thunks for an EBC image entry point, or an EBC protocol service.\r
\r
- @param ImageHandle Handle of image for which this thunk is being created\r
- @param EbcEntryPoint Address of the EBC code that the thunk is to call\r
- @param Thunk Returned thunk we create here\r
+ @param ImageHandle Image handle for the EBC image. If not null, then\r
+ we're creating a thunk for an image entry point.\r
+ @param EbcEntryPoint Address of the EBC code that the thunk is to call\r
+ @param Thunk Returned thunk we create here\r
+ @param Flags Flags indicating options for creating the thunk\r
\r
- @return Standard EFI status.\r
+ @retval EFI_SUCCESS The thunk was created successfully.\r
+ @retval EFI_INVALID_PARAMETER The parameter of EbcEntryPoint is not 16-bit\r
+ aligned.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory to created the EBC\r
+ Thunk.\r
+ @retval EFI_BUFFER_TOO_SMALL EBC_THUNK_SIZE is not larger enough.\r
\r
**/\r
EFI_STATUS\r
{\r
UINT8 *Ptr;\r
UINT8 *ThunkBase;\r
- UINT32 I;\r
+ UINT32 Index;\r
UINT32 Addr;\r
INT32 Size;\r
INT32 ThunkSize;\r
Ptr++;\r
Size--;\r
Addr = (UINT32) 0xCA112EBC;\r
- for (I = 0; I < sizeof (Addr); I++) {\r
+ for (Index = 0; Index < sizeof (Addr); Index++) {\r
*Ptr = (UINT8) (UINTN) Addr;\r
Addr >>= 8;\r
Ptr++;\r
Ptr++;\r
Size--;\r
Addr = (UINT32) EbcEntryPoint;\r
- for (I = 0; I < sizeof (Addr); I++) {\r
+ for (Index = 0; Index < sizeof (Addr); Index++) {\r
*Ptr = (UINT8) (UINTN) Addr;\r
Addr >>= 8;\r
Ptr++;\r
*Ptr = 0xB9;\r
Ptr++;\r
Size--;\r
- for (I = 0; I < sizeof (Addr); I++) {\r
+ for (Index = 0; Index < sizeof (Addr); Index++) {\r
*Ptr = (UINT8) Addr;\r
Addr >>= 8;\r
Ptr++;\r