mirror of https://github.com/acidanthera/audk.git
Code scrub for EBC module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5568 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
42eedea958
commit
34e4e297bf
|
@ -1,9 +1,7 @@
|
|||
#/** @file
|
||||
#
|
||||
# Component description file for Ebc module.
|
||||
#
|
||||
# This module for the EBC virtual machine implementation produces
|
||||
# EBC and EBC debug support protocols.
|
||||
# EBC and EBC debug support protocols.
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
|
@ -59,7 +57,6 @@
|
|||
MdePkg/MdePkg.dec
|
||||
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
UefiBootServicesTableLib
|
||||
|
|
|
@ -1250,7 +1250,7 @@ ExecuteEXTNDD (
|
|||
// Once we retrieve the operands for the data manipulation instructions,
|
||||
// call these functions to perform the operation.
|
||||
//
|
||||
STATIC CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
|
||||
CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
|
||||
ExecuteNOT,
|
||||
ExecuteNEG,
|
||||
ExecuteADD,
|
||||
|
@ -1272,7 +1272,7 @@ STATIC CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
|
|||
ExecuteEXTNDD,
|
||||
};
|
||||
|
||||
STATIC CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
|
||||
CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
|
||||
{ ExecuteBREAK }, // opcode 0x00
|
||||
{ ExecuteJMP }, // opcode 0x01
|
||||
{ ExecuteJMP8 }, // opcode 0x02
|
||||
|
@ -1336,7 +1336,7 @@ STATIC CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
|
|||
//
|
||||
// Length of JMP instructions, depending on upper two bits of opcode.
|
||||
//
|
||||
STATIC CONST UINT8 mJMPLen[] = { 2, 2, 6, 10 };
|
||||
CONST UINT8 mJMPLen[] = { 2, 2, 6, 10 };
|
||||
|
||||
//
|
||||
// Simple Debugger Protocol GUID
|
||||
|
@ -4862,7 +4862,7 @@ VmWriteMemN (
|
|||
MemoryFence ();
|
||||
Status = VmWriteMem32 (VmPtr, Addr + Index * sizeof (UINT32), (UINT32) Data);
|
||||
MemoryFence ();
|
||||
Data = (UINTN)RShiftU64 ((UINT64)Data, 32);
|
||||
Data = (UINTN) RShiftU64 ((UINT64)Data, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4969,8 +4969,8 @@ VmReadImmed32 (
|
|||
//
|
||||
// Return unaligned data
|
||||
//
|
||||
Data = (UINT32) VmReadCode16 (VmPtr, Offset);
|
||||
Data |= (UINT32) (VmReadCode16 (VmPtr, Offset + 2) << 16);
|
||||
Data = (UINT32) VmReadCode16 (VmPtr, Offset);
|
||||
Data |= (UINT32)(VmReadCode16 (VmPtr, Offset + 2) << 16);
|
||||
return Data;
|
||||
}
|
||||
|
||||
|
@ -5011,7 +5011,7 @@ VmReadImmed64 (
|
|||
Ptr = (UINT8 *) &Data64;
|
||||
Data32 = VmReadCode32 (VmPtr, Offset);
|
||||
*(UINT32 *) Ptr = Data32;
|
||||
Ptr += sizeof (Data32);
|
||||
Ptr += sizeof (Data32);
|
||||
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
|
||||
*(UINT32 *) Ptr = Data32;
|
||||
return Data64;
|
||||
|
@ -5126,7 +5126,7 @@ VmReadCode64 (
|
|||
Ptr = (UINT8 *) &Data64;
|
||||
Data32 = VmReadCode32 (VmPtr, Offset);
|
||||
*(UINT32 *) Ptr = Data32;
|
||||
Ptr += sizeof (Data32);
|
||||
Ptr += sizeof (Data32);
|
||||
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
|
||||
*(UINT32 *) Ptr = Data32;
|
||||
return Data64;
|
||||
|
|
|
@ -322,29 +322,29 @@ EbcDebugInvalidateInstructionCache (
|
|||
// also be global since the execution of an EBC image does not provide
|
||||
// a This pointer.
|
||||
//
|
||||
STATIC EBC_IMAGE_LIST *mEbcImageList = NULL;
|
||||
EBC_IMAGE_LIST *mEbcImageList = NULL;
|
||||
|
||||
//
|
||||
// Callback function to flush the icache after thunk creation
|
||||
//
|
||||
STATIC EBC_ICACHE_FLUSH mEbcICacheFlush;
|
||||
EBC_ICACHE_FLUSH mEbcICacheFlush;
|
||||
|
||||
//
|
||||
// These get set via calls by the debug agent
|
||||
//
|
||||
STATIC EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
|
||||
STATIC EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};
|
||||
STATIC EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;
|
||||
EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
|
||||
EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};
|
||||
EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;
|
||||
|
||||
STATIC VOID* mStackBuffer[MAX_STACK_NUM];
|
||||
STATIC EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];
|
||||
STATIC UINTN mStackNum = 0;
|
||||
VOID *mStackBuffer[MAX_STACK_NUM];
|
||||
EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];
|
||||
UINTN mStackNum = 0;
|
||||
|
||||
//
|
||||
// Event for Periodic callback
|
||||
//
|
||||
STATIC EFI_EVENT mEbcPeriodicEvent;
|
||||
VM_CONTEXT *mVmPtr = NULL;
|
||||
EFI_EVENT mEbcPeriodicEvent;
|
||||
VM_CONTEXT *mVmPtr = NULL;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,11 +34,11 @@ typedef UINT8 *VMIP; // instruction pointer for the VM
|
|||
typedef UINT32 EXCEPTION_FLAGS;
|
||||
|
||||
typedef struct {
|
||||
VM_REGISTER R[8]; // General purpose registers.
|
||||
UINT64 Flags; // Flags register:
|
||||
// 0 Set to 1 if the result of the last compare was true
|
||||
// 1 Set to 1 if stepping
|
||||
// 2..63 Reserved.
|
||||
VM_REGISTER R[8]; // General purpose registers.
|
||||
UINT64 Flags; // Flags register:
|
||||
// 0 Set to 1 if the result of the last compare was true
|
||||
// 1 Set to 1 if stepping
|
||||
// 2..63 Reserved.
|
||||
VMIP Ip; // Instruction pointer.
|
||||
UINTN LastException; //
|
||||
EXCEPTION_FLAGS ExceptionFlags; // to keep track of exceptions
|
||||
|
@ -316,6 +316,8 @@ EFI_STATUS
|
|||
ReturnEBCStackByHandle(
|
||||
IN EFI_HANDLE Handle
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Defines for a simple EBC debugger interface
|
||||
//
|
||||
|
@ -329,23 +331,23 @@ typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCO
|
|||
typedef
|
||||
EFI_STATUS
|
||||
(*EBC_DEBUGGER_SIGNAL_EXCEPTION) (
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
|
||||
IN VM_CONTEXT * VmPtr,
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
|
||||
IN VM_CONTEXT *VmPtr,
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*EBC_DEBUGGER_DEBUG) (
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
|
||||
IN VM_CONTEXT * VmPtr
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
|
||||
IN VM_CONTEXT *VmPtr
|
||||
);
|
||||
|
||||
typedef
|
||||
UINT32
|
||||
(*EBC_DEBUGGER_DASM) (
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
|
||||
IN VM_CONTEXT * VmPtr,
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
|
||||
IN VM_CONTEXT *VmPtr,
|
||||
IN UINT16 *DasmString OPTIONAL,
|
||||
IN UINT32 DasmStringSize
|
||||
);
|
||||
|
@ -359,7 +361,7 @@ UINT32
|
|||
typedef
|
||||
EFI_STATUS
|
||||
(*EBC_DEBUGGER_CONFIGURE) (
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
|
||||
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
|
||||
IN UINT32 ConfigId,
|
||||
IN UINTN ConfigValue
|
||||
);
|
||||
|
|
|
@ -273,7 +273,7 @@ ExecuteEbcImageEntryPoint (
|
|||
// Initialize the stack pointer for the EBC. Get the current system stack
|
||||
// pointer and adjust it down by the max needed for the interpreter.
|
||||
//
|
||||
Addr = EbcLLGetStackPointer ();
|
||||
Addr = EbcLLGetStackPointer ();
|
||||
|
||||
Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
|
Loading…
Reference in New Issue