TianoCore EDK2 master
Loading...
Searching...
No Matches
EbcSupport.c File Reference
#include "EbcInt.h"
#include "EbcExecute.h"
#include "EbcDebuggerHook.h"

Go to the source code of this file.

Data Structures

struct  EBC_INSTRUCTION_BUFFER
 

Macros

#define STACK_REMAIN_SIZE   (1024 * 4)
 

Functions

UINT64 EFIAPI EbcLLEbcInterpret (VOID)
 
UINT64 EFIAPI EbcLLExecuteEbcImageEntryPoint (VOID)
 
VOID PushU64 (IN VM_CONTEXT *VmPtr, IN UINT64 Arg)
 
UINT64 EFIAPI EbcInterpret (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 EntryPoint, IN CONST UINTN Args9_16[])
 
UINT64 EFIAPI ExecuteEbcImageEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable, IN UINTN EntryPoint)
 
EFI_STATUS EbcCreateThunks (IN EFI_HANDLE ImageHandle, IN VOID *EbcEntryPoint, OUT VOID **Thunk, IN UINT32 Flags)
 
VOID EbcLLCALLEX (IN VM_CONTEXT *VmPtr, IN UINTN FuncAddr, IN UINTN NewStackPointer, IN VOID *FramePtr, IN UINT8 Size)
 

Variables

CONST EBC_INSTRUCTION_BUFFER mEbcInstructionBufferTemplate
 

Detailed Description

This module contains EBC support routines that are customized based on the target AArch64 processor.

Copyright (c) 2016, Linaro, Ltd. All rights reserved.
Copyright (c) 2015, The Linux Foundation. All rights reserved.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file EbcSupport.c.

Macro Definition Documentation

◆ STACK_REMAIN_SIZE

#define STACK_REMAIN_SIZE   (1024 * 4)

Definition at line 20 of file EbcSupport.c.

Function Documentation

◆ EbcCreateThunks()

EFI_STATUS EbcCreateThunks ( IN EFI_HANDLE  ImageHandle,
IN VOID *  EbcEntryPoint,
OUT VOID **  Thunk,
IN UINT32  Flags 
)

Create thunks for an EBC image entry point, or an EBC protocol service.

Parameters
ImageHandleImage handle for the EBC image. If not null, then we're creating a thunk for an image entry point.
EbcEntryPointAddress of the EBC code that the thunk is to call
ThunkReturned thunk we create here
FlagsFlags indicating options for creating the thunk
Return values
EFI_SUCCESSThe thunk was created successfully.
EFI_INVALID_PARAMETERThe parameter of EbcEntryPoint is not 16-bit aligned.
EFI_OUT_OF_RESOURCESThere is not enough memory to created the EBC Thunk.
EFI_BUFFER_TOO_SMALLEBC_THUNK_SIZE is not larger enough.

Definition at line 362 of file EbcSupport.c.

◆ EbcInterpret()

UINT64 EFIAPI EbcInterpret ( 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  EntryPoint,
IN CONST UINTN  Args9_16[] 
)

Begin executing an EBC image.

This is a thunk function.

Parameters
Arg1The 1st argument.
Arg2The 2nd argument.
Arg3The 3rd argument.
Arg4The 4th argument.
Arg5The 5th argument.
Arg6The 6th argument.
Arg7The 7th argument.
Arg8The 8th argument.
EntryPointThe entrypoint of EBC code.
Args9_16[]Array containing arguments #9 to #16.
Returns
The value returned by the EBC application we're going to run.

Definition at line 102 of file EbcSupport.c.

◆ EbcLLCALLEX()

VOID EbcLLCALLEX ( IN VM_CONTEXT VmPtr,
IN UINTN  FuncAddr,
IN UINTN  NewStackPointer,
IN VOID *  FramePtr,
IN UINT8  Size 
)

This function is called to execute an EBC CALLEX instruction. The function check the callee's content to see whether it is common native code or a thunk to another piece of EBC code. If the callee is common native code, use EbcLLCAllEXASM to manipulate, otherwise, set the VM->IP to target EBC code directly to avoid another VM be startup which cost time and stack space.

Parameters
VmPtrPointer to a VM context.
FuncAddrCallee's address
NewStackPointerNew stack pointer after the call
FramePtrNew frame pointer after the call
SizeThe size of call instruction

Definition at line 436 of file EbcSupport.c.

◆ EbcLLEbcInterpret()

UINT64 EFIAPI EbcLLEbcInterpret ( VOID  )

Begin executing an EBC image. This is used for Ebc Thunk call.

Returns
The value returned by the EBC application we're going to run.

◆ EbcLLExecuteEbcImageEntryPoint()

UINT64 EFIAPI EbcLLExecuteEbcImageEntryPoint ( VOID  )

Begin executing an EBC image. This is used for Ebc image entrypoint.

Returns
The value returned by the EBC application we're going to run.

◆ ExecuteEbcImageEntryPoint()

UINT64 EFIAPI ExecuteEbcImageEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable,
IN UINTN  EntryPoint 
)

Begin executing an EBC image.

Parameters
ImageHandleimage handle for the EBC application we're executing
SystemTablestandard system table passed into an driver's entry point
EntryPointThe entrypoint of EBC code.
Returns
The value returned by the EBC application we're going to run.

Definition at line 246 of file EbcSupport.c.

◆ PushU64()

VOID PushU64 ( IN VM_CONTEXT VmPtr,
IN UINT64  Arg 
)

Pushes a 64 bit unsigned value to the VM stack.

Parameters
VmPtrThe pointer to current VM context.
ArgThe value to be pushed.

Definition at line 67 of file EbcSupport.c.