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:
qhuang8 2008-07-26 07:35:34 +00:00
parent 42eedea958
commit 34e4e297bf
6 changed files with 158 additions and 159 deletions

View File

@ -1,9 +1,7 @@
#/** @file #/** @file
# #
# Component description file for Ebc module.
#
# This module for the EBC virtual machine implementation produces # 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> # Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
@ -59,7 +57,6 @@
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
[LibraryClasses] [LibraryClasses]
MemoryAllocationLib MemoryAllocationLib
UefiBootServicesTableLib UefiBootServicesTableLib

View File

@ -1250,7 +1250,7 @@ ExecuteEXTNDD (
// Once we retrieve the operands for the data manipulation instructions, // Once we retrieve the operands for the data manipulation instructions,
// call these functions to perform the operation. // call these functions to perform the operation.
// //
STATIC CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = { CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
ExecuteNOT, ExecuteNOT,
ExecuteNEG, ExecuteNEG,
ExecuteADD, ExecuteADD,
@ -1272,7 +1272,7 @@ STATIC CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
ExecuteEXTNDD, ExecuteEXTNDD,
}; };
STATIC CONST VM_TABLE_ENTRY mVmOpcodeTable[] = { CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
{ ExecuteBREAK }, // opcode 0x00 { ExecuteBREAK }, // opcode 0x00
{ ExecuteJMP }, // opcode 0x01 { ExecuteJMP }, // opcode 0x01
{ ExecuteJMP8 }, // opcode 0x02 { ExecuteJMP8 }, // opcode 0x02
@ -1336,7 +1336,7 @@ STATIC CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
// //
// Length of JMP instructions, depending on upper two bits of opcode. // 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 // Simple Debugger Protocol GUID
@ -4862,7 +4862,7 @@ VmWriteMemN (
MemoryFence (); MemoryFence ();
Status = VmWriteMem32 (VmPtr, Addr + Index * sizeof (UINT32), (UINT32) Data); Status = VmWriteMem32 (VmPtr, Addr + Index * sizeof (UINT32), (UINT32) Data);
MemoryFence (); MemoryFence ();
Data = (UINTN)RShiftU64 ((UINT64)Data, 32); Data = (UINTN) RShiftU64 ((UINT64)Data, 32);
} }
} }
@ -4969,8 +4969,8 @@ VmReadImmed32 (
// //
// Return unaligned data // Return unaligned data
// //
Data = (UINT32) VmReadCode16 (VmPtr, Offset); Data = (UINT32) VmReadCode16 (VmPtr, Offset);
Data |= (UINT32) (VmReadCode16 (VmPtr, Offset + 2) << 16); Data |= (UINT32)(VmReadCode16 (VmPtr, Offset + 2) << 16);
return Data; return Data;
} }
@ -5011,7 +5011,7 @@ VmReadImmed64 (
Ptr = (UINT8 *) &Data64; Ptr = (UINT8 *) &Data64;
Data32 = VmReadCode32 (VmPtr, Offset); Data32 = VmReadCode32 (VmPtr, Offset);
*(UINT32 *) Ptr = Data32; *(UINT32 *) Ptr = Data32;
Ptr += sizeof (Data32); Ptr += sizeof (Data32);
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32)); Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
*(UINT32 *) Ptr = Data32; *(UINT32 *) Ptr = Data32;
return Data64; return Data64;
@ -5126,7 +5126,7 @@ VmReadCode64 (
Ptr = (UINT8 *) &Data64; Ptr = (UINT8 *) &Data64;
Data32 = VmReadCode32 (VmPtr, Offset); Data32 = VmReadCode32 (VmPtr, Offset);
*(UINT32 *) Ptr = Data32; *(UINT32 *) Ptr = Data32;
Ptr += sizeof (Data32); Ptr += sizeof (Data32);
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32)); Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
*(UINT32 *) Ptr = Data32; *(UINT32 *) Ptr = Data32;
return Data64; return Data64;

View File

@ -322,29 +322,29 @@ EbcDebugInvalidateInstructionCache (
// also be global since the execution of an EBC image does not provide // also be global since the execution of an EBC image does not provide
// a This pointer. // a This pointer.
// //
STATIC EBC_IMAGE_LIST *mEbcImageList = NULL; EBC_IMAGE_LIST *mEbcImageList = NULL;
// //
// Callback function to flush the icache after thunk creation // 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 // These get set via calls by the debug agent
// //
STATIC EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL; EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
STATIC EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL}; EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};
STATIC EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID; EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;
STATIC VOID* mStackBuffer[MAX_STACK_NUM]; VOID *mStackBuffer[MAX_STACK_NUM];
STATIC EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM]; EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];
STATIC UINTN mStackNum = 0; UINTN mStackNum = 0;
// //
// Event for Periodic callback // Event for Periodic callback
// //
STATIC EFI_EVENT mEbcPeriodicEvent; EFI_EVENT mEbcPeriodicEvent;
VM_CONTEXT *mVmPtr = NULL; VM_CONTEXT *mVmPtr = NULL;
/** /**

View File

@ -34,11 +34,11 @@ typedef UINT8 *VMIP; // instruction pointer for the VM
typedef UINT32 EXCEPTION_FLAGS; typedef UINT32 EXCEPTION_FLAGS;
typedef struct { typedef struct {
VM_REGISTER R[8]; // General purpose registers. VM_REGISTER R[8]; // General purpose registers.
UINT64 Flags; // Flags register: UINT64 Flags; // Flags register:
// 0 Set to 1 if the result of the last compare was true // 0 Set to 1 if the result of the last compare was true
// 1 Set to 1 if stepping // 1 Set to 1 if stepping
// 2..63 Reserved. // 2..63 Reserved.
VMIP Ip; // Instruction pointer. VMIP Ip; // Instruction pointer.
UINTN LastException; // UINTN LastException; //
EXCEPTION_FLAGS ExceptionFlags; // to keep track of exceptions EXCEPTION_FLAGS ExceptionFlags; // to keep track of exceptions
@ -316,6 +316,8 @@ EFI_STATUS
ReturnEBCStackByHandle( ReturnEBCStackByHandle(
IN EFI_HANDLE Handle IN EFI_HANDLE Handle
); );
// //
// Defines for a simple EBC debugger interface // Defines for a simple EBC debugger interface
// //
@ -329,23 +331,23 @@ typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCO
typedef typedef
EFI_STATUS EFI_STATUS
(*EBC_DEBUGGER_SIGNAL_EXCEPTION) ( (*EBC_DEBUGGER_SIGNAL_EXCEPTION) (
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This, IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
IN VM_CONTEXT * VmPtr, IN VM_CONTEXT *VmPtr,
IN EFI_EXCEPTION_TYPE ExceptionType IN EFI_EXCEPTION_TYPE ExceptionType
); );
typedef typedef
VOID VOID
(*EBC_DEBUGGER_DEBUG) ( (*EBC_DEBUGGER_DEBUG) (
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This, IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
IN VM_CONTEXT * VmPtr IN VM_CONTEXT *VmPtr
); );
typedef typedef
UINT32 UINT32
(*EBC_DEBUGGER_DASM) ( (*EBC_DEBUGGER_DASM) (
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This, IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
IN VM_CONTEXT * VmPtr, IN VM_CONTEXT *VmPtr,
IN UINT16 *DasmString OPTIONAL, IN UINT16 *DasmString OPTIONAL,
IN UINT32 DasmStringSize IN UINT32 DasmStringSize
); );
@ -359,7 +361,7 @@ UINT32
typedef typedef
EFI_STATUS EFI_STATUS
(*EBC_DEBUGGER_CONFIGURE) ( (*EBC_DEBUGGER_CONFIGURE) (
IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This, IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
IN UINT32 ConfigId, IN UINT32 ConfigId,
IN UINTN ConfigValue IN UINTN ConfigValue
); );

View File

@ -273,7 +273,7 @@ ExecuteEbcImageEntryPoint (
// Initialize the stack pointer for the EBC. Get the current system stack // Initialize the stack pointer for the EBC. Get the current system stack
// pointer and adjust it down by the max needed for the interpreter. // pointer and adjust it down by the max needed for the interpreter.
// //
Addr = EbcLLGetStackPointer (); Addr = EbcLLGetStackPointer ();
Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex); Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {