/** @file
Header file for Virtual Machine support. Contains EBC defines that can
be of use to a disassembler for the most part. Also provides function
prototypes for VM functions.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _EBC_EXECUTE_H_
#define _EBC_EXECUTE_H_
//
//
#define VM_MINOR_VERSION 0
//
// Macros to check and set alignment
//
//
// Define a macro to get the operand. Then we can change it to be either a
// direct read or have it call a function to read memory.
//
//
// Bit masks for opcode encodings
//
//
// operand2.
//
//
// Bit masks for operand encodings
//
//
// Masks for data manipulation instructions
//
//
// For MOV instructions, need a mask for the opcode when immediate
// data applies to R2.
//
//
// if an index is present. Then bits 4 and 5 are used to indicate the width
// of the move.
//
//
// Masks for CALL instruction encodings
//
//
//
//
// Mask for operand of JMP instruction
//
//
// Macros to determine if a given operand is indirect
//
//
// Macros to extract the operands from second byte of instructions
//
//
// Condition masks usually for byte 1 encodings of code
//
//
// Bits in the VM->StopFlags field
//
//
// Masks for working with the VM flags register
//
//
// Macros for operating on the VM flags register
//
//
// Debug macro
//
//
// Define OPCODES
//
//
// #define OPCODE_27 0x27
//
//
// #define OPCODE_34 0x34
//
/**
Execute an EBC image from an entry point or from a published protocol.
@param VmPtr A pointer to a VM context.
@retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
@retval EFI_SUCCESS All of the instructions are executed successfully.
**/
);
/**
Returns the version of the EBC virtual machine.
@return The 64-bit version of EBC virtual machine.
**/
);
/**
Writes UINTN data to memory address.
This routine is called by the EBC data
movement instructions that write to memory. Since these writes
may be to the stack, which looks like (high address on top) this,
[EBC entry point arguments]
[VM stack]
[EBC stack]
we need to detect all attempts to write to the EBC entry point argument
stack area and adjust the address (which will initially point into the
VM stack) to point into the EBC entry point arguments.
@param VmPtr A pointer to a VM context.
@param Addr Address to write to.
@param Data Value to write to Addr.
@retval EFI_SUCCESS The instruction is executed successfully.
@retval Other Some error occurs when writing data to the address.
**/
);
/**
Writes 64-bit data to memory address.
This routine is called by the EBC data
movement instructions that write to memory. Since these writes
may be to the stack, which looks like (high address on top) this,
[EBC entry point arguments]
[VM stack]
[EBC stack]
we need to detect all attempts to write to the EBC entry point argument
stack area and adjust the address (which will initially point into the
VM stack) to point into the EBC entry point arguments.
@param VmPtr A pointer to a VM context.
@param Addr Address to write to.
@param Data Value to write to Addr.
@retval EFI_SUCCESS The instruction is executed successfully.
@retval Other Some error occurs when writing data to the address.
**/
);
/**
Given a pointer to a new VM context, execute one or more instructions. This
function is only used for test purposes via the EBC VM test protocol.
@param This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
@param VmPtr A pointer to a VM context.
@param InstructionCount A pointer to a UINTN value holding the number of
instructions to execute. If it holds value of 0,
then the instruction to be executed is 1.
@retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
@retval EFI_SUCCESS All of the instructions are executed successfully.
**/
);
#endif // ifndef _EBC_EXECUTE_H_