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 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _EBC_EXECUTE_H_
18 #define _EBC_EXECUTE_H_
21 // Macros to check and set alignment
23 #define ASSERT_ALIGNED(addr, size) ASSERT (!((UINT32) (addr) & (size - 1)))
24 #define IS_ALIGNED(addr, size) !((UINT32) (addr) & (size - 1))
29 #define EBCMSG(s) gST->ConOut->OutputString (gST->ConOut, s)
33 Execute an EBC image from an entry point or from a published protocol.
35 @param VmPtr A pointer to a VM context.
37 @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
38 @retval EFI_SUCCESS All of the instructions are executed successfully.
49 Returns the version of the EBC virtual machine.
51 @return The 64-bit version of EBC virtual machine.
60 Writes UINTN data to memory address.
62 This routine is called by the EBC data
63 movement instructions that write to memory. Since these writes
64 may be to the stack, which looks like (high address on top) this,
66 [EBC entry point arguments]
70 we need to detect all attempts to write to the EBC entry point argument
71 stack area and adjust the address (which will initially point into the
72 VM stack) to point into the EBC entry point arguments.
74 @param VmPtr A pointer to a VM context.
75 @param Addr Address to write to.
76 @param Data Value to write to Addr.
78 @retval EFI_SUCCESS The instruction is executed successfully.
79 @retval Other Some error occurs when writing data to the address.
90 Writes 64-bit data to memory address.
92 This routine is called by the EBC data
93 movement instructions that write to memory. Since these writes
94 may be to the stack, which looks like (high address on top) this,
96 [EBC entry point arguments]
100 we need to detect all attempts to write to the EBC entry point argument
101 stack area and adjust the address (which will initially point into the
102 VM stack) to point into the EBC entry point arguments.
104 @param VmPtr A pointer to a VM context.
105 @param Addr Address to write to.
106 @param Data Value to write to Addr.
108 @retval EFI_SUCCESS The instruction is executed successfully.
109 @retval Other Some error occurs when writing data to the address.
114 IN VM_CONTEXT
*VmPtr
,
120 Given a pointer to a new VM context, execute one or more instructions. This
121 function is only used for test purposes via the EBC VM test protocol.
123 @param This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
124 @param VmPtr A pointer to a VM context.
125 @param InstructionCount A pointer to a UINTN value holding the number of
126 instructions to execute. If it holds value of 0,
127 then the instruction to be executed is 1.
129 @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
130 @retval EFI_SUCCESS All of the instructions are executed successfully.
135 EbcExecuteInstructions (
136 IN EFI_EBC_VM_TEST_PROTOCOL
*This
,
137 IN VM_CONTEXT
*VmPtr
,
138 IN OUT UINTN
*InstructionCount
141 #endif // ifndef _EBC_EXECUTE_H_