2 EBC VM Test protocol for test purposes.
4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 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_VM_TEST_PROTOCOL_H_
18 #define _EBC_VM_TEST_PROTOCOL_H_
21 // Define a protocol for an EBC VM test interface.
23 #define EFI_EBC_VM_TEST_PROTOCOL_GUID \
25 0xAAEACCFD, 0xF27B, 0x4C17, { 0xB6, 0x10, 0x75, 0xCA, 0x1F, 0x2D, 0xFB, 0x52 } \
29 // Define for forward reference.
31 typedef struct _EFI_EBC_VM_TEST_PROTOCOL EFI_EBC_VM_TEST_PROTOCOL
;
34 /// instruction pointer for the VM
38 typedef INT64 VM_REGISTER
;
39 typedef UINT32 EXCEPTION_FLAGS
;
42 VM_REGISTER Gpr
[8]; ///< General purpose registers.
44 ///< 0 Set to 1 if the result of the last compare was true
45 ///< 1 Set to 1 if stepping
46 UINT64 Flags
; ///< 2..63 Reserved.
47 VMIP Ip
; ///< Instruction pointer.
49 EXCEPTION_FLAGS ExceptionFlags
; ///< to keep track of exceptions
51 UINT32 CompilerVersion
; ///< via break(6)
52 UINTN HighStackBottom
; ///< bottom of the upper stack
53 UINTN LowStackTop
; ///< top of the lower stack
54 UINT64 StackRetAddr
; ///< location of final return address on stack
55 UINTN
*StackMagicPtr
; ///< pointer to magic value on stack to detect corruption
56 EFI_HANDLE ImageHandle
; ///< for this EBC driver
57 EFI_SYSTEM_TABLE
*SystemTable
; ///< for debugging only
58 UINTN LastAddrConverted
; ///< for debug
59 UINTN LastAddrConvertedValue
; ///< for debug
61 VOID
*EntryPoint
; ///< entry point of EBC image
68 Given a pointer to a new VM context, execute one or more instructions. This
69 function is only used for test purposes.
71 @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
72 @param[in] VmPtr A pointer to a VM context.
73 @param[in, out] InstructionCount A pointer to a UINTN value holding the number of
74 instructions to execute. If it holds value of 0,
75 then the instruction to be executed is 1.
77 @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
78 @retval EFI_SUCCESS All of the instructions are executed successfully.
83 (EFIAPI
*EBC_VM_TEST_EXECUTE
) (
84 IN EFI_EBC_VM_TEST_PROTOCOL
*This
,
86 IN OUT UINTN
*InstructionCount
90 Convert AsmText to the instruction. This function is only used for test purposes.
92 @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
93 @param[in] AsmText A pointer to EBC ASM text code.
94 @param[out] Buffer Buffer to store the instruction.
95 @param[out] BufferLen Size of buffer that is requried to store data.
97 @retval EFI_UNSUPPORTED This functionality is unsupported.
98 @retval EFI_SUCCESS Successfully convert AsmText to the instruction.
103 (EFIAPI
*EBC_VM_TEST_ASM
) (
104 IN EFI_EBC_VM_TEST_PROTOCOL
*This
,
107 IN OUT UINTN
*BufferLen
111 Dump the executed instruction. This function is only used for test purposes.
113 @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
114 @param[out] AsmText Contain the disasm text.
115 @param[out] Buffer Buffer to store the instruction.
116 @param[out] BufferLen Size of buffer that is requried to store data.
118 @retval EFI_UNSUPPORTED This functionality is unsupported.
119 @retval EFI_SUCCESS Successfully dump the executed instruction.
124 (EFIAPI
*EBC_VM_TEST_DASM
) (
125 IN EFI_EBC_VM_TEST_PROTOCOL
*This
,
126 IN OUT CHAR16
*AsmText
,
132 // Prototype for the actual EBC test protocol interface
134 struct _EFI_EBC_VM_TEST_PROTOCOL
{
135 EBC_VM_TEST_EXECUTE Execute
;
136 EBC_VM_TEST_ASM Assemble
;
137 EBC_VM_TEST_DASM Disassemble
;
140 extern EFI_GUID gEfiEbcVmTestProtocolGuid
;