2 Header file for Virtual Machine support. Contains EBC defines that can
3 be of use to a disassembler for the most part. Also provides function
4 prototypes for VM functions.
6 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _EBC_EXECUTE_H_
12 #define _EBC_EXECUTE_H_
15 // Macros to check and set alignment
17 #define ASSERT_ALIGNED(addr, size) ASSERT (!((UINT32) (addr) & (size - 1)))
18 #define IS_ALIGNED(addr, size) !((UINT32) (addr) & (size - 1))
23 #define EBCMSG(s) gST->ConOut->OutputString (gST->ConOut, s)
27 Execute an EBC image from an entry point or from a published protocol.
29 @param VmPtr A pointer to a VM context.
31 @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
32 @retval EFI_SUCCESS All of the instructions are executed successfully.
43 Returns the version of the EBC virtual machine.
45 @return The 64-bit version of EBC virtual machine.
54 Writes UINTN data to memory address.
56 This routine is called by the EBC data
57 movement instructions that write to memory. Since these writes
58 may be to the stack, which looks like (high address on top) this,
60 [EBC entry point arguments]
64 we need to detect all attempts to write to the EBC entry point argument
65 stack area and adjust the address (which will initially point into the
66 VM stack) to point into the EBC entry point arguments.
68 @param VmPtr A pointer to a VM context.
69 @param Addr Address to write to.
70 @param Data Value to write to Addr.
72 @retval EFI_SUCCESS The instruction is executed successfully.
73 @retval Other Some error occurs when writing data to the address.
84 Writes 64-bit data to memory address.
86 This routine is called by the EBC data
87 movement instructions that write to memory. Since these writes
88 may be to the stack, which looks like (high address on top) this,
90 [EBC entry point arguments]
94 we need to detect all attempts to write to the EBC entry point argument
95 stack area and adjust the address (which will initially point into the
96 VM stack) to point into the EBC entry point arguments.
98 @param VmPtr A pointer to a VM context.
99 @param Addr Address to write to.
100 @param Data Value to write to Addr.
102 @retval EFI_SUCCESS The instruction is executed successfully.
103 @retval Other Some error occurs when writing data to the address.
108 IN VM_CONTEXT
*VmPtr
,
114 Given a pointer to a new VM context, execute one or more instructions. This
115 function is only used for test purposes via the EBC VM test protocol.
117 @param This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
118 @param VmPtr A pointer to a VM context.
119 @param InstructionCount A pointer to a UINTN value holding the number of
120 instructions to execute. If it holds value of 0,
121 then the instruction to be executed is 1.
123 @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
124 @retval EFI_SUCCESS All of the instructions are executed successfully.
129 EbcExecuteInstructions (
130 IN EFI_EBC_VM_TEST_PROTOCOL
*This
,
131 IN VM_CONTEXT
*VmPtr
,
132 IN OUT UINTN
*InstructionCount
135 #endif // ifndef _EBC_EXECUTE_H_