Improve coding style in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9793 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Console Platform DXE Driver, install Console Device Guids and update Console
|
||||
Environment Variables.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -263,7 +263,7 @@ ConPlatformTextInDriverBindingStart (
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
L"ConIn",
|
||||
DevicePath,
|
||||
CHECK
|
||||
Check
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
IsInConInVariable = TRUE;
|
||||
@@ -289,7 +289,7 @@ ConPlatformTextInDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConInDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -300,7 +300,7 @@ ConPlatformTextInDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConInDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
|
||||
//
|
||||
@@ -399,7 +399,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
L"ConOut",
|
||||
DevicePath,
|
||||
CHECK
|
||||
Check
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
IsInConOutVariable = TRUE;
|
||||
@@ -409,7 +409,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
L"ErrOut",
|
||||
DevicePath,
|
||||
CHECK
|
||||
Check
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
IsInErrOutVariable = TRUE;
|
||||
@@ -435,7 +435,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConOutDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
}
|
||||
//
|
||||
@@ -445,7 +445,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ErrOutDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -456,7 +456,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConOutDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
//
|
||||
// Then append the device path to the ErrOutDev environment variable
|
||||
@@ -464,7 +464,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ErrOutDev",
|
||||
DevicePath,
|
||||
APPEND
|
||||
Append
|
||||
);
|
||||
|
||||
//
|
||||
@@ -554,7 +554,7 @@ ConPlatformTextInDriverBindingStop (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConInDev",
|
||||
DevicePath,
|
||||
DELETE
|
||||
Delete
|
||||
);
|
||||
}
|
||||
|
||||
@@ -625,12 +625,12 @@ ConPlatformTextOutDriverBindingStop (
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ConOutDev",
|
||||
DevicePath,
|
||||
DELETE
|
||||
Delete
|
||||
);
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
L"ErrOutDev",
|
||||
DevicePath,
|
||||
DELETE
|
||||
Delete
|
||||
);
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ ConPlatformUpdateDeviceVariable (
|
||||
//
|
||||
VariableDevicePath = ConPlatformGetVariable (VariableName);
|
||||
|
||||
if (Operation != DELETE) {
|
||||
if (Operation != Delete) {
|
||||
//
|
||||
// Match specified DevicePath in Console Variable.
|
||||
//
|
||||
@@ -912,7 +912,7 @@ ConPlatformUpdateDeviceVariable (
|
||||
FALSE
|
||||
);
|
||||
|
||||
if ((Operation == CHECK) || (!EFI_ERROR (Status))) {
|
||||
if ((Operation == Check) || (!EFI_ERROR (Status))) {
|
||||
//
|
||||
// Branch here includes 2 cases:
|
||||
// 1. Operation is CHECK, simply return Status.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Header file for Console Platfrom DXE Driver.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -47,9 +47,9 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
|
||||
|
||||
|
||||
typedef enum {
|
||||
CHECK,
|
||||
APPEND,
|
||||
DELETE
|
||||
Check,
|
||||
Append,
|
||||
Delete
|
||||
} CONPLATFORM_VAR_OPERATION;
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Generic debug support macros, typedefs and prototypes for IA32/x64.
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
Copyright (c) 2006 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -37,12 +37,17 @@ VOID
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *CALLBACK_FUNC) (
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
IA32_IDT_GATE_DESCRIPTOR OrigDesc;
|
||||
DEBUG_PROC OrigVector;
|
||||
IA32_IDT_GATE_DESCRIPTOR NewDesc;
|
||||
DEBUG_PROC StubEntry;
|
||||
VOID (EFIAPI *RegisteredCallback) ();
|
||||
CALLBACK_FUNC RegisteredCallback;
|
||||
} IDT_ENTRY;
|
||||
|
||||
extern UINT8 InterruptEntryStub[];
|
||||
@@ -258,7 +263,7 @@ GetInterruptHandleFromIdt (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManageIdtEntryTable (
|
||||
VOID (EFIAPI *NewCallback)(),
|
||||
CALLBACK_FUNC NewCallback,
|
||||
EFI_EXCEPTION_TYPE ExceptionType
|
||||
);
|
||||
|
||||
@@ -277,7 +282,7 @@ ManageIdtEntryTable (
|
||||
VOID
|
||||
HookEntry (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN VOID (EFIAPI *NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
);
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
IA32/x64 generic functions to support Debug Support protocol.
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
Copyright (c) 2006 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -78,7 +78,7 @@ WriteIdtGateDescriptor (
|
||||
VOID
|
||||
HookEntry (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN VOID (EFIAPI *NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
)
|
||||
{
|
||||
BOOLEAN OldIntFlagState;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
IA32 specific functions to support Debug Support protocol.
|
||||
|
||||
Copyright (c) 2008 - 2009, Intel Corporation
|
||||
Copyright (c) 2008 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -107,7 +107,7 @@ CreateEntryStub (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManageIdtEntryTable (
|
||||
VOID (EFIAPI *NewCallback)(),
|
||||
CALLBACK_FUNC NewCallback,
|
||||
EFI_EXCEPTION_TYPE ExceptionType
|
||||
)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
IPF specific functions to support Debug Support protocol.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
Copyright (c) 2006 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -23,8 +23,8 @@ BOOLEAN mInHandler = FALSE;
|
||||
#define NUM_IVT_ENTRIES 64
|
||||
|
||||
typedef struct {
|
||||
BUNDLE OrigBundles[NUM_BUNDLES_IN_STUB];
|
||||
VOID (*RegisteredCallback) ();
|
||||
BUNDLE OrigBundles[NUM_BUNDLES_IN_STUB];
|
||||
CALLBACK_FUNC RegisteredCallback;
|
||||
} IVT_ENTRY;
|
||||
|
||||
IVT_ENTRY IvtEntryTable[NUM_IVT_ENTRIES];
|
||||
@@ -183,7 +183,7 @@ EFI_STATUS
|
||||
ManageIvtEntryTable (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN BUNDLE NewBundles[NUM_BUNDLES_IN_STUB],
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
)
|
||||
{
|
||||
BUNDLE *B0Ptr;
|
||||
@@ -257,7 +257,7 @@ VOID
|
||||
HookEntry (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN BUNDLE NewBundles[4],
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
)
|
||||
{
|
||||
BUNDLE *FixupBundle;
|
||||
@@ -285,7 +285,7 @@ HookEntry (
|
||||
// fixup IVT entry so it stores its index and whether or not to chain...
|
||||
//
|
||||
FixupBundle = B0Ptr + 2;
|
||||
FixupBundle->high |= ExceptionType << 36;
|
||||
FixupBundle->High |= ExceptionType << 36;
|
||||
|
||||
InstructionCacheFlush (B0Ptr, 5);
|
||||
IvtEntryTable[ExceptionType].RegisteredCallback = NewCallback;
|
||||
@@ -329,7 +329,7 @@ UnhookEntry (
|
||||
**/
|
||||
VOID
|
||||
ChainExternalInterrupt (
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
)
|
||||
{
|
||||
VOID *Start;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
IPF specific types, macros, and definitions for Debug Support Driver.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -31,10 +31,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define EFI_ISA IsaIpf
|
||||
|
||||
typedef struct {
|
||||
UINT64 low;
|
||||
UINT64 high;
|
||||
UINT64 Low;
|
||||
UINT64 High;
|
||||
} BUNDLE;
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*CALLBACK_FUNC) (
|
||||
);
|
||||
|
||||
/**
|
||||
IPF specific DebugSupport driver initialization.
|
||||
|
||||
@@ -250,7 +255,7 @@ EFI_STATUS
|
||||
ManageIvtEntryTable (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN BUNDLE NewBundles[4],
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -266,7 +271,7 @@ VOID
|
||||
HookEntry (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN BUNDLE NewBundles[4],
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -290,7 +295,7 @@ UnhookEntry (
|
||||
**/
|
||||
VOID
|
||||
ChainExternalInterrupt (
|
||||
IN VOID (*NewCallback) ()
|
||||
IN CALLBACK_FUNC NewCallback
|
||||
);
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
X64 specific functions to support Debug Support protocol.
|
||||
|
||||
Copyright (c) 2008 - 2009, Intel Corporation
|
||||
Copyright (c) 2008 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -108,7 +108,7 @@ CreateEntryStub (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManageIdtEntryTable (
|
||||
VOID (EFIAPI *NewCallback)(),
|
||||
CALLBACK_FUNC NewCallback,
|
||||
EFI_EXCEPTION_TYPE ExceptionType
|
||||
)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Definition for Device Path Utilities driver
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -65,10 +65,19 @@ EFI_DEVICE_PATH_PROTOCOL *
|
||||
IN CHAR16 *DeviceNodeStr
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*DEVICE_PATH_TO_TEXT_FUNC) (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
VOID (*Function) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
DEVICE_PATH_TO_TEXT_FUNC Function;
|
||||
} DEVICE_PATH_TO_TEXT_TABLE;
|
||||
|
||||
typedef struct {
|
||||
@@ -123,9 +132,9 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT32 HID;
|
||||
UINT32 UID;
|
||||
UINT32 CID;
|
||||
UINT32 Hid;
|
||||
UINT32 Uid;
|
||||
UINT32 Cid;
|
||||
CHAR8 HidUidCidStr[3];
|
||||
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Contains code that implements the virtual machine.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -1445,7 +1445,7 @@ EbcExecute (
|
||||
StackCorrupted = 1;
|
||||
}
|
||||
|
||||
VmPtr->FramePtr = (VOID *) ((UINT8 *) (UINTN) VmPtr->R[0] + 8);
|
||||
VmPtr->FramePtr = (VOID *) ((UINT8 *) (UINTN) VmPtr->Gpr[0] + 8);
|
||||
|
||||
//
|
||||
// Try to get the debug support for EBC
|
||||
@@ -1517,7 +1517,7 @@ EbcExecute (
|
||||
EbcDebugSignalException (EXCEPT_EBC_STACK_FAULT, EXCEPTION_FLAG_FATAL, VmPtr);
|
||||
StackCorrupted = 1;
|
||||
}
|
||||
if ((StackCorrupted == 0) && ((UINT64)VmPtr->R[0] <= (UINT64)(UINTN) VmPtr->StackTop)) {
|
||||
if ((StackCorrupted == 0) && ((UINT64)VmPtr->Gpr[0] <= (UINT64)(UINTN) VmPtr->StackTop)) {
|
||||
EbcDebugSignalException (EXCEPT_EBC_STACK_FAULT, EXCEPTION_FLAG_FATAL, VmPtr);
|
||||
StackCorrupted = 1;
|
||||
}
|
||||
@@ -1682,7 +1682,7 @@ ExecuteMOVxx (
|
||||
//
|
||||
// Indirect form @R2. Compute address of operand2
|
||||
//
|
||||
Source = (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index64Op2);
|
||||
Source = (UINTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index64Op2);
|
||||
//
|
||||
// Now get the data from the source. Always 0-extend and let the compiler
|
||||
// sign-extend where required.
|
||||
@@ -1718,7 +1718,7 @@ ExecuteMOVxx (
|
||||
//
|
||||
// Not indirect source: MOVxx {@}Rx, Ry [Index]
|
||||
//
|
||||
Data64 = VmPtr->R[OPERAND2_REGNUM (Operands)] + Index64Op2;
|
||||
Data64 = VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index64Op2;
|
||||
//
|
||||
// Did Operand2 have an index? If so, treat as two signed values since
|
||||
// indexes are signed values.
|
||||
@@ -1754,7 +1754,7 @@ ExecuteMOVxx (
|
||||
//
|
||||
// Reuse the Source variable to now be dest.
|
||||
//
|
||||
Source = (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index64Op1);
|
||||
Source = (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index64Op1);
|
||||
//
|
||||
// Do the write based on the size
|
||||
//
|
||||
@@ -1802,7 +1802,7 @@ ExecuteMOVxx (
|
||||
// Direct storage in register. Clear unused bits and store back to
|
||||
// register.
|
||||
//
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = Data64 & DataMask;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = Data64 & DataMask;
|
||||
}
|
||||
//
|
||||
// Advance the instruction pointer
|
||||
@@ -1851,7 +1851,7 @@ ExecuteBREAK (
|
||||
// 16-8 = Major version
|
||||
// 7-0 = Minor version
|
||||
//
|
||||
VmPtr->R[7] = GetVmVersion ();
|
||||
VmPtr->Gpr[7] = GetVmVersion ();
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -1881,8 +1881,8 @@ ExecuteBREAK (
|
||||
// After we're done, *(UINT64 *)R7 will be the address of the new thunk.
|
||||
//
|
||||
case 5:
|
||||
Offset = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->R[7]);
|
||||
U64EbcEntryPoint = (UINT64) (VmPtr->R[7] + Offset + 4);
|
||||
Offset = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->Gpr[7]);
|
||||
U64EbcEntryPoint = (UINT64) (VmPtr->Gpr[7] + Offset + 4);
|
||||
EbcEntryPoint = (VOID *) (UINTN) U64EbcEntryPoint;
|
||||
|
||||
//
|
||||
@@ -1896,14 +1896,14 @@ ExecuteBREAK (
|
||||
//
|
||||
// Finally replace the EBC entry point memory with the thunk address
|
||||
//
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[7], (UINT64) (UINTN) Thunk);
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[7], (UINT64) (UINTN) Thunk);
|
||||
break;
|
||||
|
||||
//
|
||||
// Compiler setting version per value in R7
|
||||
//
|
||||
case 6:
|
||||
VmPtr->CompilerVersion = (UINT32) VmPtr->R[7];
|
||||
VmPtr->CompilerVersion = (UINT32) VmPtr->Gpr[7];
|
||||
//
|
||||
// Check compiler version against VM version?
|
||||
//
|
||||
@@ -2251,12 +2251,12 @@ ExecuteMOVI (
|
||||
Mask64 = (UINT64)~0;
|
||||
}
|
||||
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = ImmData64 & Mask64;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = ImmData64 & Mask64;
|
||||
} else {
|
||||
//
|
||||
// Get the address then write back based on size of the move
|
||||
//
|
||||
Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
Op1 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH8) {
|
||||
VmWriteMem8 (VmPtr, (UINTN) Op1, (UINT8) ImmData64);
|
||||
} else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH16) {
|
||||
@@ -2361,12 +2361,12 @@ ExecuteMOVIn (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = ImmedIndex64;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = ImmedIndex64;
|
||||
} else {
|
||||
//
|
||||
// Get the address
|
||||
//
|
||||
Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
Op1 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
VmWriteMemN (VmPtr, (UINTN) Op1, (INTN) ImmedIndex64);
|
||||
}
|
||||
//
|
||||
@@ -2460,14 +2460,14 @@ ExecuteMOVREL (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = (VM_REGISTER) Op2;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = (VM_REGISTER) Op2;
|
||||
} else {
|
||||
//
|
||||
// Get the address = [Rx] + Index16
|
||||
// Write back the result. Always a natural size write, since
|
||||
// we're talking addresses here.
|
||||
//
|
||||
Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
Op1 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
VmWriteMemN (VmPtr, (UINTN) Op1, (UINTN) Op2);
|
||||
}
|
||||
//
|
||||
@@ -2551,7 +2551,7 @@ ExecuteMOVsnw (
|
||||
//
|
||||
// Get the data from the source.
|
||||
//
|
||||
Op2 = (INT64) ((INTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Op2Index));
|
||||
Op2 = (INT64) ((INTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index));
|
||||
if (OPERAND2_INDIRECT (Operands)) {
|
||||
Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
|
||||
}
|
||||
@@ -2559,9 +2559,9 @@ ExecuteMOVsnw (
|
||||
// Now write back the result.
|
||||
//
|
||||
if (!OPERAND1_INDIRECT (Operands)) {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
} else {
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
|
||||
}
|
||||
//
|
||||
// Advance the instruction pointer
|
||||
@@ -2644,7 +2644,7 @@ ExecuteMOVsnd (
|
||||
//
|
||||
// Get the data from the source.
|
||||
//
|
||||
Op2 = (INT64) ((INTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Op2Index));
|
||||
Op2 = (INT64) ((INTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index));
|
||||
if (OPERAND2_INDIRECT (Operands)) {
|
||||
Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
|
||||
}
|
||||
@@ -2652,9 +2652,9 @@ ExecuteMOVsnd (
|
||||
// Now write back the result.
|
||||
//
|
||||
if (!OPERAND1_INDIRECT (Operands)) {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
} else {
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
|
||||
}
|
||||
//
|
||||
// Advance the instruction pointer
|
||||
@@ -2710,15 +2710,15 @@ ExecutePUSHn (
|
||||
// Get the data to push
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
DataN = VmReadMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
DataN = VmReadMemN (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
} else {
|
||||
DataN = (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16);
|
||||
DataN = (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16);
|
||||
}
|
||||
//
|
||||
// Adjust the stack down.
|
||||
//
|
||||
VmPtr->R[0] -= sizeof (UINTN);
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], DataN);
|
||||
VmPtr->Gpr[0] -= sizeof (UINTN);
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], DataN);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2770,29 +2770,29 @@ ExecutePUSH (
|
||||
//
|
||||
if ((Opcode & PUSHPOP_M_64) != 0) {
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
Data64 = VmReadMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
Data64 = VmReadMem64 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
} else {
|
||||
Data64 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
Data64 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
}
|
||||
//
|
||||
// Adjust the stack down, then write back the data
|
||||
//
|
||||
VmPtr->R[0] -= sizeof (UINT64);
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], Data64);
|
||||
VmPtr->Gpr[0] -= sizeof (UINT64);
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], Data64);
|
||||
} else {
|
||||
//
|
||||
// 32-bit data
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
Data32 = VmReadMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
Data32 = VmReadMem32 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16));
|
||||
} else {
|
||||
Data32 = (UINT32) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
Data32 = (UINT32) VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16;
|
||||
}
|
||||
//
|
||||
// Adjust the stack down and write the data
|
||||
//
|
||||
VmPtr->R[0] -= sizeof (UINT32);
|
||||
VmWriteMem32 (VmPtr, (UINTN) VmPtr->R[0], Data32);
|
||||
VmPtr->Gpr[0] -= sizeof (UINT32);
|
||||
VmWriteMem32 (VmPtr, (UINTN) VmPtr->Gpr[0], Data32);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -2843,15 +2843,15 @@ ExecutePOPn (
|
||||
//
|
||||
// Read the data off the stack, then adjust the stack pointer
|
||||
//
|
||||
DataN = VmReadMemN (VmPtr, (UINTN) VmPtr->R[0]);
|
||||
VmPtr->R[0] += sizeof (UINTN);
|
||||
DataN = VmReadMemN (VmPtr, (UINTN) VmPtr->Gpr[0]);
|
||||
VmPtr->Gpr[0] += sizeof (UINTN);
|
||||
//
|
||||
// Do the write-back
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), DataN);
|
||||
VmWriteMemN (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16), DataN);
|
||||
} else {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = (INT64) (UINT64) ((UINTN) DataN + Index16);
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = (INT64) (UINT64) ((UINTN) DataN + Index16);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -2907,29 +2907,29 @@ ExecutePOP (
|
||||
//
|
||||
// Read the data off the stack, then adjust the stack pointer
|
||||
//
|
||||
Data64 = VmReadMem64 (VmPtr, (UINTN) VmPtr->R[0]);
|
||||
VmPtr->R[0] += sizeof (UINT64);
|
||||
Data64 = VmReadMem64 (VmPtr, (UINTN) VmPtr->Gpr[0]);
|
||||
VmPtr->Gpr[0] += sizeof (UINT64);
|
||||
//
|
||||
// Do the write-back
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
VmWriteMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), Data64);
|
||||
VmWriteMem64 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16), Data64);
|
||||
} else {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = Data64 + Index16;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = Data64 + Index16;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// 32-bit pop. Read it off the stack and adjust the stack pointer
|
||||
//
|
||||
Data32 = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->R[0]);
|
||||
VmPtr->R[0] += sizeof (UINT32);
|
||||
Data32 = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->Gpr[0]);
|
||||
VmPtr->Gpr[0] += sizeof (UINT32);
|
||||
//
|
||||
// Do the write-back
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
VmWriteMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), Data32);
|
||||
VmWriteMem32 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND1_REGNUM (Operands)] + Index16), Data32);
|
||||
} else {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = (INT64) Data32 + Index16;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = (INT64) Data32 + Index16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3004,11 +3004,11 @@ ExecuteCALL (
|
||||
// put our return address and frame pointer on the VM stack.
|
||||
//
|
||||
if ((Operands & OPERAND_M_NATIVE_CALL) == 0) {
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
|
||||
}
|
||||
//
|
||||
// If 64-bit data, then absolute jump only
|
||||
@@ -3023,7 +3023,7 @@ ExecuteCALL (
|
||||
//
|
||||
// Call external function, get the return value, and advance the IP
|
||||
//
|
||||
EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->R[0], FramePtr, Size);
|
||||
EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->Gpr[0], FramePtr, Size);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
@@ -3032,7 +3032,7 @@ ExecuteCALL (
|
||||
// Compiler should take care of upper bits if 32-bit machine.
|
||||
//
|
||||
if (OPERAND1_REGNUM (Operands) != 0) {
|
||||
Immed64 = (UINT64) (UINTN) VmPtr->R[OPERAND1_REGNUM (Operands)];
|
||||
Immed64 = (UINT64) (UINTN) VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
|
||||
}
|
||||
//
|
||||
// Get final address
|
||||
@@ -3060,13 +3060,13 @@ ExecuteCALL (
|
||||
// Native call. Relative or absolute?
|
||||
//
|
||||
if ((Operands & OPERAND_M_RELATIVE_ADDR) != 0) {
|
||||
EbcLLCALLEX (VmPtr, (UINTN) (Immed64 + VmPtr->Ip + Size), (UINTN) VmPtr->R[0], FramePtr, Size);
|
||||
EbcLLCALLEX (VmPtr, (UINTN) (Immed64 + VmPtr->Ip + Size), (UINTN) VmPtr->Gpr[0], FramePtr, Size);
|
||||
} else {
|
||||
if ((VmPtr->StopFlags & STOPFLAG_BREAK_ON_CALLEX) != 0) {
|
||||
CpuBreakpoint ();
|
||||
}
|
||||
|
||||
EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->R[0], FramePtr, Size);
|
||||
EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->Gpr[0], FramePtr, Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3095,14 +3095,14 @@ ExecuteRET (
|
||||
// If we're at the top of the stack, then simply set the done
|
||||
// flag and return
|
||||
//
|
||||
if (VmPtr->StackRetAddr == (UINT64) VmPtr->R[0]) {
|
||||
if (VmPtr->StackRetAddr == (UINT64) VmPtr->Gpr[0]) {
|
||||
VmPtr->StopFlags |= STOPFLAG_APP_DONE;
|
||||
} else {
|
||||
//
|
||||
// Pull the return address off the VM app's stack and set the IP
|
||||
// to it
|
||||
//
|
||||
if (!IS_ALIGNED ((UINTN) VmPtr->R[0], sizeof (UINT16))) {
|
||||
if (!IS_ALIGNED ((UINTN) VmPtr->Gpr[0], sizeof (UINT16))) {
|
||||
EbcDebugSignalException (
|
||||
EXCEPT_EBC_ALIGNMENT_CHECK,
|
||||
EXCEPTION_FLAG_FATAL,
|
||||
@@ -3112,10 +3112,10 @@ ExecuteRET (
|
||||
//
|
||||
// Restore the IP and frame pointer from the stack
|
||||
//
|
||||
VmPtr->Ip = (VMIP) (UINTN) VmReadMem64 (VmPtr, (UINTN) VmPtr->R[0]);
|
||||
VmPtr->R[0] += 8;
|
||||
VmPtr->FramePtr = (VOID *) VmReadMemN (VmPtr, (UINTN) VmPtr->R[0]);
|
||||
VmPtr->R[0] += 8;
|
||||
VmPtr->Ip = (VMIP) (UINTN) VmReadMem64 (VmPtr, (UINTN) VmPtr->Gpr[0]);
|
||||
VmPtr->Gpr[0] += 8;
|
||||
VmPtr->FramePtr = (VOID *) VmReadMemN (VmPtr, (UINTN) VmPtr->Gpr[0]);
|
||||
VmPtr->Gpr[0] += 8;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -3155,7 +3155,7 @@ ExecuteCMP (
|
||||
//
|
||||
// Get the register data we're going to compare to
|
||||
//
|
||||
Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
|
||||
Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
|
||||
//
|
||||
// Get immediate data
|
||||
//
|
||||
@@ -3176,15 +3176,15 @@ ExecuteCMP (
|
||||
//
|
||||
if (OPERAND2_INDIRECT (Operands)) {
|
||||
if ((Opcode & OPCODE_M_64BIT) != 0) {
|
||||
Op2 = (INT64) VmReadMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16));
|
||||
Op2 = (INT64) VmReadMem64 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16));
|
||||
} else {
|
||||
//
|
||||
// 32-bit operations. 0-extend the values for all cases.
|
||||
//
|
||||
Op2 = (INT64) (UINT64) ((UINT32) VmReadMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16)));
|
||||
Op2 = (INT64) (UINT64) ((UINT32) VmReadMem32 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16)));
|
||||
}
|
||||
} else {
|
||||
Op2 = VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16;
|
||||
Op2 = VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16;
|
||||
}
|
||||
//
|
||||
// Now do the compare
|
||||
@@ -3327,7 +3327,7 @@ ExecuteCMPI (
|
||||
//
|
||||
// Get operand1 data we're going to compare to
|
||||
//
|
||||
Op1 = (INT64) VmPtr->R[OPERAND1_REGNUM (Operands)];
|
||||
Op1 = (INT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
//
|
||||
// Indirect operand1. Fetch 32 or 64-bit value based on compare size.
|
||||
@@ -4165,7 +4165,7 @@ ExecuteDataManip (
|
||||
//
|
||||
// Now get operand2 (source). It's of format {@}R2 {Index16|Immed16}
|
||||
//
|
||||
Op2 = (UINT64) VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16;
|
||||
Op2 = (UINT64) VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16;
|
||||
if (OPERAND2_INDIRECT (Operands)) {
|
||||
//
|
||||
// Indirect form: @R2 Index16. Fetch as 32- or 64-bit data
|
||||
@@ -4195,7 +4195,7 @@ ExecuteDataManip (
|
||||
// Get operand1 (destination and sometimes also an actual operand)
|
||||
// of form {@}R1
|
||||
//
|
||||
Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
|
||||
Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
if ((Opcode & DATAMANIP_M_64) != 0) {
|
||||
Op1 = VmReadMem64 (VmPtr, (UINTN) Op1);
|
||||
@@ -4238,7 +4238,7 @@ ExecuteDataManip (
|
||||
// Write back the result.
|
||||
//
|
||||
if (OPERAND1_INDIRECT (Operands)) {
|
||||
Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
|
||||
Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
|
||||
if ((Opcode & DATAMANIP_M_64) != 0) {
|
||||
VmWriteMem64 (VmPtr, (UINTN) Op1, Op2);
|
||||
} else {
|
||||
@@ -4249,9 +4249,9 @@ ExecuteDataManip (
|
||||
// Storage back to a register. Write back, clearing upper bits (as per
|
||||
// the specification) if 32-bit operation.
|
||||
//
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = Op2;
|
||||
if ((Opcode & DATAMANIP_M_64) == 0) {
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] &= 0xFFFFFFFF;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] &= 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -4298,7 +4298,7 @@ ExecuteLOADSP (
|
||||
// Spec states that this instruction will not modify reserved bits in
|
||||
// the flags register.
|
||||
//
|
||||
VmPtr->Flags = (VmPtr->Flags &~VMFLAGS_ALL_VALID) | (VmPtr->R[OPERAND2_REGNUM (Operands)] & VMFLAGS_ALL_VALID);
|
||||
VmPtr->Flags = (VmPtr->Flags &~VMFLAGS_ALL_VALID) | (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] & VMFLAGS_ALL_VALID);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -4351,14 +4351,14 @@ ExecuteSTORESP (
|
||||
//
|
||||
// Retrieve the value in the flags register, then clear reserved bits
|
||||
//
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = (UINT64) (VmPtr->Flags & VMFLAGS_ALL_VALID);
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = (UINT64) (VmPtr->Flags & VMFLAGS_ALL_VALID);
|
||||
break;
|
||||
|
||||
//
|
||||
// Get IP -- address of following instruction
|
||||
//
|
||||
case 1:
|
||||
VmPtr->R[OPERAND1_REGNUM (Operands)] = (UINT64) (UINTN) VmPtr->Ip + 2;
|
||||
VmPtr->Gpr[OPERAND1_REGNUM (Operands)] = (UINT64) (UINTN) VmPtr->Ip + 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -3,7 +3,7 @@
|
||||
be of use to a disassembler for the most part. Also provides function
|
||||
prototypes for VM functions.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -125,8 +125,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define OPERAND1_CHAR(op) ('0' + OPERAND1_REGNUM (op))
|
||||
#define OPERAND2_CHAR(op) ('0' + OPERAND2_REGNUM (op))
|
||||
|
||||
#define OPERAND1_REGDATA(pvm, op) pvm->R[OPERAND1_REGNUM (op)]
|
||||
#define OPERAND2_REGDATA(pvm, op) pvm->R[OPERAND2_REGNUM (op)]
|
||||
#define OPERAND1_REGDATA(pvm, op) pvm->Gpr[OPERAND1_REGNUM (op)]
|
||||
#define OPERAND2_REGDATA(pvm, op) pvm->Gpr[OPERAND2_REGNUM (op)]
|
||||
|
||||
//
|
||||
// Condition masks usually for byte 1 encodings of code
|
||||
|
@@ -3,7 +3,7 @@
|
||||
Provides auxiliary support routines for the VM. That is, routines
|
||||
that are not particularly related to VM execution of EBC instructions.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -23,16 +23,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
// image handles, with each having a linked list of thunks allocated
|
||||
// to that image handle.
|
||||
//
|
||||
typedef struct _EBC_THUNK_LIST {
|
||||
VOID *ThunkBuffer;
|
||||
struct _EBC_THUNK_LIST *Next;
|
||||
} EBC_THUNK_LIST;
|
||||
typedef struct _EBC_THUNK_LIST EBC_THUNK_LIST;
|
||||
struct _EBC_THUNK_LIST {
|
||||
VOID *ThunkBuffer;
|
||||
EBC_THUNK_LIST *Next;
|
||||
};
|
||||
|
||||
typedef struct _EBC_IMAGE_LIST {
|
||||
struct _EBC_IMAGE_LIST *Next;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EBC_THUNK_LIST *ThunkList;
|
||||
} EBC_IMAGE_LIST;
|
||||
typedef struct _EBC_IMAGE_LIST EBC_IMAGE_LIST;
|
||||
struct _EBC_IMAGE_LIST {
|
||||
EBC_IMAGE_LIST *Next;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EBC_THUNK_LIST *ThunkList;
|
||||
};
|
||||
|
||||
/**
|
||||
This routine is called by the core when an image is being unloaded from
|
||||
@@ -765,14 +767,14 @@ EbcDebugSignalException (
|
||||
//
|
||||
// Initialize the context structure
|
||||
//
|
||||
EbcContext.R0 = VmPtr->R[0];
|
||||
EbcContext.R1 = VmPtr->R[1];
|
||||
EbcContext.R2 = VmPtr->R[2];
|
||||
EbcContext.R3 = VmPtr->R[3];
|
||||
EbcContext.R4 = VmPtr->R[4];
|
||||
EbcContext.R5 = VmPtr->R[5];
|
||||
EbcContext.R6 = VmPtr->R[6];
|
||||
EbcContext.R7 = VmPtr->R[7];
|
||||
EbcContext.R0 = VmPtr->Gpr[0];
|
||||
EbcContext.R1 = VmPtr->Gpr[1];
|
||||
EbcContext.R2 = VmPtr->Gpr[2];
|
||||
EbcContext.R3 = VmPtr->Gpr[3];
|
||||
EbcContext.R4 = VmPtr->Gpr[4];
|
||||
EbcContext.R5 = VmPtr->Gpr[5];
|
||||
EbcContext.R6 = VmPtr->Gpr[6];
|
||||
EbcContext.R7 = VmPtr->Gpr[7];
|
||||
EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
|
||||
EbcContext.Flags = VmPtr->Flags;
|
||||
EbcContext.ControlFlags = 0;
|
||||
@@ -782,14 +784,14 @@ EbcDebugSignalException (
|
||||
//
|
||||
// Restore the context structure and continue to execute
|
||||
//
|
||||
VmPtr->R[0] = EbcContext.R0;
|
||||
VmPtr->R[1] = EbcContext.R1;
|
||||
VmPtr->R[2] = EbcContext.R2;
|
||||
VmPtr->R[3] = EbcContext.R3;
|
||||
VmPtr->R[4] = EbcContext.R4;
|
||||
VmPtr->R[5] = EbcContext.R5;
|
||||
VmPtr->R[6] = EbcContext.R6;
|
||||
VmPtr->R[7] = EbcContext.R7;
|
||||
VmPtr->Gpr[0] = EbcContext.R0;
|
||||
VmPtr->Gpr[1] = EbcContext.R1;
|
||||
VmPtr->Gpr[2] = EbcContext.R2;
|
||||
VmPtr->Gpr[3] = EbcContext.R3;
|
||||
VmPtr->Gpr[4] = EbcContext.R4;
|
||||
VmPtr->Gpr[5] = EbcContext.R5;
|
||||
VmPtr->Gpr[6] = EbcContext.R6;
|
||||
VmPtr->Gpr[7] = EbcContext.R7;
|
||||
VmPtr->Ip = (VMIP)(UINTN)EbcContext.Ip;
|
||||
VmPtr->Flags = EbcContext.Flags;
|
||||
}
|
||||
@@ -935,14 +937,14 @@ EbcDebugPeriodic (
|
||||
//
|
||||
// Initialize the context structure
|
||||
//
|
||||
EbcContext.R0 = VmPtr->R[0];
|
||||
EbcContext.R1 = VmPtr->R[1];
|
||||
EbcContext.R2 = VmPtr->R[2];
|
||||
EbcContext.R3 = VmPtr->R[3];
|
||||
EbcContext.R4 = VmPtr->R[4];
|
||||
EbcContext.R5 = VmPtr->R[5];
|
||||
EbcContext.R6 = VmPtr->R[6];
|
||||
EbcContext.R7 = VmPtr->R[7];
|
||||
EbcContext.R0 = VmPtr->Gpr[0];
|
||||
EbcContext.R1 = VmPtr->Gpr[1];
|
||||
EbcContext.R2 = VmPtr->Gpr[2];
|
||||
EbcContext.R3 = VmPtr->Gpr[3];
|
||||
EbcContext.R4 = VmPtr->Gpr[4];
|
||||
EbcContext.R5 = VmPtr->Gpr[5];
|
||||
EbcContext.R6 = VmPtr->Gpr[6];
|
||||
EbcContext.R7 = VmPtr->Gpr[7];
|
||||
EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
|
||||
EbcContext.Flags = VmPtr->Flags;
|
||||
EbcContext.ControlFlags = 0;
|
||||
@@ -953,14 +955,14 @@ EbcDebugPeriodic (
|
||||
//
|
||||
// Restore the context structure and continue to execute
|
||||
//
|
||||
VmPtr->R[0] = EbcContext.R0;
|
||||
VmPtr->R[1] = EbcContext.R1;
|
||||
VmPtr->R[2] = EbcContext.R2;
|
||||
VmPtr->R[3] = EbcContext.R3;
|
||||
VmPtr->R[4] = EbcContext.R4;
|
||||
VmPtr->R[5] = EbcContext.R5;
|
||||
VmPtr->R[6] = EbcContext.R6;
|
||||
VmPtr->R[7] = EbcContext.R7;
|
||||
VmPtr->Gpr[0] = EbcContext.R0;
|
||||
VmPtr->Gpr[1] = EbcContext.R1;
|
||||
VmPtr->Gpr[2] = EbcContext.R2;
|
||||
VmPtr->Gpr[3] = EbcContext.R3;
|
||||
VmPtr->Gpr[4] = EbcContext.R4;
|
||||
VmPtr->Gpr[5] = EbcContext.R5;
|
||||
VmPtr->Gpr[6] = EbcContext.R6;
|
||||
VmPtr->Gpr[7] = EbcContext.R7;
|
||||
VmPtr->Ip = (VMIP)(UINTN)EbcContext.Ip;
|
||||
VmPtr->Flags = EbcContext.Flags;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Main routines for the EBC interpreter. Includes the initialization and
|
||||
main interpreter routines.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -34,7 +34,7 @@ typedef UINT8 *VMIP; // instruction pointer for the VM
|
||||
typedef UINT32 EXCEPTION_FLAGS;
|
||||
|
||||
typedef struct {
|
||||
VM_REGISTER R[8]; // General purpose registers.
|
||||
VM_REGISTER Gpr[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,7 +2,7 @@
|
||||
This module contains EBC support routines that are customized based on
|
||||
the target processor.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -108,11 +108,11 @@ Action:
|
||||
// put our return address and frame pointer on the VM stack.
|
||||
// Then set the VM's IP to new EBC code.
|
||||
//
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
|
||||
|
||||
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ Action:
|
||||
//
|
||||
// Get return value and advance the IP.
|
||||
//
|
||||
VmPtr->R[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Gpr[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Ip += Size;
|
||||
}
|
||||
}
|
||||
@@ -218,55 +218,55 @@ EbcInterpret (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN)VmContext.R[0];
|
||||
VmContext.R[0] &= ~(sizeof (UINTN) - 1);
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN)VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
//
|
||||
// Put a magic value in the stack gap, then adjust down again
|
||||
//
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// For IA32, this is where we say our return address is
|
||||
//
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg16;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg15;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg14;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg13;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg12;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg11;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg10;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg9;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg8;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg7;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg6;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg5;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg4;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg3;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg2;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg1;
|
||||
VmContext.R[0] -= 16;
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg16;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg15;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg14;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg13;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg12;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg11;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg10;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg9;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg8;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg7;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg6;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg5;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg4;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg3;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg2;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) Arg1;
|
||||
VmContext.Gpr[0] -= 16;
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// We need to keep track of where the EBC stack starts. This way, if the EBC
|
||||
@@ -291,7 +291,7 @@ EbcInterpret (
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
ReturnEBCStack(StackIndex);
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
@@ -360,28 +360,28 @@ ExecuteEbcImageEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN)VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN)VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
//
|
||||
// Put a magic value in the stack gap, then adjust down again
|
||||
//
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// Align the stack on a natural boundary
|
||||
// VmContext.R[0] &= ~(sizeof(UINTN) - 1);
|
||||
// VmContext.Gpr[0] &= ~(sizeof(UINTN) - 1);
|
||||
//
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) SystemTable;
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) ImageHandle;
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) SystemTable;
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) ImageHandle;
|
||||
|
||||
VmContext.R[0] -= 16;
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.Gpr[0] -= 16;
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
//
|
||||
// VM pushes 16-bytes for return address. Simulate that here.
|
||||
//
|
||||
@@ -394,7 +394,7 @@ ExecuteEbcImageEntryPoint (
|
||||
//
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
This module contains EBC support routines that are customized based on
|
||||
the target processor.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -60,8 +60,8 @@ PushU64 (
|
||||
// Advance the VM stack down, and then copy the argument to the stack.
|
||||
// Hope it's aligned.
|
||||
//
|
||||
VmPtr->R[0] -= sizeof (UINT64);
|
||||
*(UINT64 *) VmPtr->R[0] = Arg;
|
||||
VmPtr->Gpr[0] -= sizeof (UINT64);
|
||||
*(UINT64 *) VmPtr->Gpr[0] = Arg;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,14 +176,14 @@ EbcInterpret (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
|
||||
PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);
|
||||
VmContext.StackMagicPtr = (UINTN *) VmContext.R[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
VmContext.StackMagicPtr = (UINTN *) VmContext.Gpr[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
//
|
||||
// Push the EBC arguments on the stack. Does not matter that they may not
|
||||
// all be valid.
|
||||
@@ -211,7 +211,7 @@ EbcInterpret (
|
||||
//
|
||||
PushU64 (&VmContext, 0);
|
||||
PushU64 (&VmContext, 0xDEADBEEFDEADBEEF);
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
//
|
||||
// Begin executing the EBC code
|
||||
//
|
||||
@@ -220,7 +220,7 @@ EbcInterpret (
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
ReturnEBCStack(StackIndex);
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
@@ -283,9 +283,9 @@ ExecuteEbcImageEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
|
||||
//
|
||||
@@ -293,7 +293,7 @@ ExecuteEbcImageEntryPoint (
|
||||
// at the bottom so we can detect stack corruption.
|
||||
//
|
||||
PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// When we thunk to external native code, we copy the last 8 qwords from
|
||||
@@ -304,15 +304,15 @@ ExecuteEbcImageEntryPoint (
|
||||
// Therefore, leave another gap below the magic value. Pick 10 qwords down,
|
||||
// just as a starting point.
|
||||
//
|
||||
VmContext.R[0] -= 10 * sizeof (UINT64);
|
||||
VmContext.Gpr[0] -= 10 * sizeof (UINT64);
|
||||
|
||||
//
|
||||
// Align the stack pointer such that after pushing the system table,
|
||||
// image handle, and return address on the stack, it's aligned on a 16-byte
|
||||
// boundary as required for IPF.
|
||||
//
|
||||
VmContext.R[0] &= (INT64)~0x0f;
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
VmContext.Gpr[0] &= (INT64)~0x0f;
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
//
|
||||
// Simply copy the image handle and system table onto the EBC stack.
|
||||
// Greatly simplifies things by not having to spill the args
|
||||
@@ -327,7 +327,7 @@ ExecuteEbcImageEntryPoint (
|
||||
//
|
||||
PushU64 (&VmContext, (UINT64) 0);
|
||||
PushU64 (&VmContext, (UINT64) 0x1234567887654321);
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// Begin executing the EBC code
|
||||
@@ -338,7 +338,7 @@ ExecuteEbcImageEntryPoint (
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
ReturnEBCStack(StackIndex);
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
@@ -855,11 +855,11 @@ Action:
|
||||
// put our return address and frame pointer on the VM stack.
|
||||
// Then set the VM's IP to new EBC code.
|
||||
//
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (VmPtr->Ip + Size));
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (VmPtr->Ip + Size));
|
||||
|
||||
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
|
||||
} else {
|
||||
@@ -871,7 +871,7 @@ Action:
|
||||
//
|
||||
// Get return value and advance the IP.
|
||||
//
|
||||
VmPtr->R[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Gpr[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Ip += Size;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
This module contains EBC support routines that are customized based on
|
||||
the target x64 processor.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. 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
|
||||
@@ -45,8 +45,8 @@ PushU64 (
|
||||
// Advance the VM stack down, and then copy the argument to the stack.
|
||||
// Hope it's aligned.
|
||||
//
|
||||
VmPtr->R[0] -= sizeof (UINT64);
|
||||
*(UINT64 *) VmPtr->R[0] = Arg;
|
||||
VmPtr->Gpr[0] -= sizeof (UINT64);
|
||||
*(UINT64 *) VmPtr->Gpr[0] = Arg;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,25 +140,25 @@ EbcInterpret (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
//
|
||||
// Align the stack on a natural boundary.
|
||||
//
|
||||
VmContext.R[0] &= ~(sizeof (UINTN) - 1);
|
||||
VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);
|
||||
|
||||
//
|
||||
// Put a magic value in the stack gap, then adjust down again.
|
||||
//
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// The stack upper to LowStackTop is belong to the VM.
|
||||
//
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// For the worst case, assume there are 4 arguments passed in registers, store
|
||||
@@ -191,7 +191,7 @@ EbcInterpret (
|
||||
//
|
||||
// For x64, this is where we say our return address is
|
||||
//
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// We need to keep track of where the EBC stack starts. This way, if the EBC
|
||||
@@ -216,7 +216,7 @@ EbcInterpret (
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
ReturnEBCStack(StackIndex);
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
@@ -280,22 +280,22 @@ ExecuteEbcImageEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
|
||||
VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.R[0];
|
||||
VmContext.R[0] -= sizeof (UINTN);
|
||||
VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
|
||||
VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
|
||||
VmContext.Gpr[0] -= sizeof (UINTN);
|
||||
|
||||
|
||||
//
|
||||
// Put a magic value in the stack gap, then adjust down again
|
||||
//
|
||||
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
|
||||
*(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
|
||||
VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// Align the stack on a natural boundary
|
||||
VmContext.R[0] &= ~(sizeof(UINTN) - 1);
|
||||
VmContext.Gpr[0] &= ~(sizeof(UINTN) - 1);
|
||||
//
|
||||
VmContext.LowStackTop = (UINTN) VmContext.R[0];
|
||||
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// Simply copy the image handle and system table onto the EBC stack.
|
||||
@@ -313,7 +313,7 @@ ExecuteEbcImageEntryPoint (
|
||||
//
|
||||
// For x64, this is where we say our return address is
|
||||
//
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.R[0];
|
||||
VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
|
||||
|
||||
//
|
||||
// Entry function needn't access high stack context, simply
|
||||
@@ -329,7 +329,7 @@ ExecuteEbcImageEntryPoint (
|
||||
// Return the value in R[7] unless there was an error
|
||||
//
|
||||
ReturnEBCStack(StackIndex);
|
||||
return (UINT64) VmContext.R[7];
|
||||
return (UINT64) VmContext.Gpr[7];
|
||||
}
|
||||
|
||||
|
||||
@@ -577,11 +577,11 @@ Action:
|
||||
// put our return address and frame pointer on the VM stack.
|
||||
// Then set the VM's IP to new EBC code.
|
||||
//
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
|
||||
VmPtr->R[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (VmPtr->Ip + Size));
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
|
||||
VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
|
||||
VmPtr->Gpr[0] -= 8;
|
||||
VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (VmPtr->Ip + Size));
|
||||
|
||||
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
|
||||
} else {
|
||||
@@ -593,7 +593,7 @@ Action:
|
||||
//
|
||||
// Get return value and advance the IP.
|
||||
//
|
||||
VmPtr->R[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Gpr[7] = EbcLLGetReturnValue ();
|
||||
VmPtr->Ip += Size;
|
||||
}
|
||||
}
|
||||
|
@@ -316,6 +316,12 @@ typedef struct {
|
||||
#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
|
||||
|
||||
typedef union {
|
||||
EFI_STRING_ID VarName;
|
||||
UINT16 VarOffset;
|
||||
} VAR_STORE_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
@@ -335,10 +341,7 @@ typedef struct {
|
||||
EFI_QUESTION_ID QuestionId; // The value of zero is reserved
|
||||
EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
|
||||
FORMSET_STORAGE *Storage;
|
||||
union {
|
||||
EFI_STRING_ID VarName;
|
||||
UINT16 VarOffset;
|
||||
} VarStoreInfo;
|
||||
VAR_STORE_INFO VarStoreInfo;
|
||||
UINT16 StorageWidth;
|
||||
UINT8 QuestionFlags;
|
||||
CHAR16 *VariableName; // Name/Value or EFI Variable name
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Private structure, MACRO and function definitions for User Interface related functionalities.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. 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
|
||||
@@ -168,14 +168,15 @@ struct _UI_MENU_LIST {
|
||||
|
||||
#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)
|
||||
|
||||
typedef struct _MENU_REFRESH_ENTRY {
|
||||
struct _MENU_REFRESH_ENTRY *Next;
|
||||
typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;
|
||||
struct _MENU_REFRESH_ENTRY {
|
||||
MENU_REFRESH_ENTRY *Next;
|
||||
UI_MENU_OPTION *MenuOption; // Describes the entry needing an update
|
||||
UI_MENU_SELECTION *Selection;
|
||||
UINTN CurrentColumn;
|
||||
UINTN CurrentRow;
|
||||
UINTN CurrentAttribute;
|
||||
} MENU_REFRESH_ENTRY;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
|
Reference in New Issue
Block a user