b14:12 - number of bits in this index assigned to natural units (=a)\r
ba:11 - constant units = ConstUnits\r
b0:a - natural units = NaturalUnits\r
- \r
+\r
Given this info, the offset can be computed by:\r
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))\r
\r
Max offset is achieved with index = 0x7FFF giving an offset of\r
0x27B (32-bit machine) or 0x477 (64-bit machine).\r
- Min offset is achieved with index = \r
+ Min offset is achieved with index =\r
\r
@param VmPtr A pointer to VM context.\r
@param CodeOffset Offset from IP of the location of the 16-bit index\r
\r
/**\r
Writes 8-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes 16-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes 32-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
@param VmPtr A pointer to VM context.\r
@param IsSignedOp Indicates whether the operand is signed or not.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
Instruction syntax:\r
JMP64{cs|cc} Immed64\r
JMP32{cs|cc} {@}R1 {Immed32|Index32}\r
- \r
+\r
Encoding:\r
b0.7 - immediate data present\r
b0.6 - 1 = 64 bit immediate data\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
Execute the MOVxx instructions.\r
\r
Instruction format:\r
- \r
+\r
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}\r
MOVqq {@}R1 {Index64}, {@}R2 {Index64}\r
- \r
+\r
Copies contents of [R2] -> [R1], zero extending where required.\r
- \r
+\r
First character indicates the size of the move.\r
Second character indicates the size of the index(s).\r
- \r
+\r
Invalid to have R1 direct with index.\r
\r
@param VmPtr A pointer to a VM context.\r
Execute the EBC MOVI.\r
\r
Instruction syntax:\r
- \r
+\r
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64\r
- \r
+\r
First variable character specifies the move size\r
Second variable character specifies size of the immediate data\r
- \r
+\r
Sign-extend the immediate data to the size of the operation, and zero-extend\r
if storing to a register.\r
- \r
+\r
Operand1 direct with index/immed is invalid.\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
index value into a register or memory location.\r
\r
Instruction syntax:\r
- \r
+\r
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
Dest <- Ip + ImmData\r
\r
Instruction syntax:\r
- \r
+\r
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
is a register.\r
\r
Instruction syntax:\r
- \r
+\r
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}\r
- \r
+\r
0:7 1=>operand1 index present\r
0:6 1=>operand2 index present\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
is a register.\r
\r
Instruction syntax:\r
- \r
+\r
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}\r
- \r
+\r
0:7 1=>operand1 index present\r
0:6 1=>operand2 index present\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
// Once we retrieve the operands for the data manipulation instructions,\r
// call these functions to perform the operation.\r
//\r
-STATIC CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {\r
+CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {\r
ExecuteNOT,\r
ExecuteNEG,\r
ExecuteADD,\r
ExecuteEXTNDD,\r
};\r
\r
-STATIC CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {\r
+CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {\r
{ ExecuteBREAK }, // opcode 0x00\r
{ ExecuteJMP }, // opcode 0x01\r
{ ExecuteJMP8 }, // opcode 0x02\r
//\r
// Length of JMP instructions, depending on upper two bits of opcode.\r
//\r
-STATIC CONST UINT8 mJMPLen[] = { 2, 2, 6, 10 };\r
+CONST UINT8 mJMPLen[] = { 2, 2, 6, 10 };\r
\r
//\r
// Simple Debugger Protocol GUID\r
Execute the MOVxx instructions.\r
\r
Instruction format:\r
- \r
+\r
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}\r
MOVqq {@}R1 {Index64}, {@}R2 {Index64}\r
- \r
+\r
Copies contents of [R2] -> [R1], zero extending where required.\r
- \r
+\r
First character indicates the size of the move.\r
Second character indicates the size of the index(s).\r
- \r
+\r
Invalid to have R1 direct with index.\r
\r
@param VmPtr A pointer to a VM context.\r
Instruction syntax:\r
JMP64{cs|cc} Immed64\r
JMP32{cs|cc} {@}R1 {Immed32|Index32}\r
- \r
+\r
Encoding:\r
b0.7 - immediate data present\r
b0.6 - 1 = 64 bit immediate data\r
Execute the EBC MOVI.\r
\r
Instruction syntax:\r
- \r
+\r
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64\r
- \r
+\r
First variable character specifies the move size\r
Second variable character specifies size of the immediate data\r
- \r
+\r
Sign-extend the immediate data to the size of the operation, and zero-extend\r
if storing to a register.\r
- \r
+\r
Operand1 direct with index/immed is invalid.\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
index value into a register or memory location.\r
\r
Instruction syntax:\r
- \r
+\r
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
Dest <- Ip + ImmData\r
\r
Instruction syntax:\r
- \r
+\r
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
is a register.\r
\r
Instruction syntax:\r
- \r
+\r
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}\r
- \r
+\r
0:7 1=>operand1 index present\r
0:6 1=>operand2 index present\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
is a register.\r
\r
Instruction syntax:\r
- \r
+\r
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}\r
- \r
+\r
0:7 1=>operand1 index present\r
0:6 1=>operand2 index present\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
@param VmPtr A pointer to VM context.\r
@param IsSignedOp Indicates whether the operand is signed or not.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
\r
@param VmPtr A pointer to a VM context.\r
\r
- @retval EFI_UNSUPPORTED The opcodes/operands is not supported. \r
+ @retval EFI_UNSUPPORTED The opcodes/operands is not supported.\r
@retval EFI_SUCCESS The instruction is executed successfully.\r
\r
**/\r
b14:12 - number of bits in this index assigned to natural units (=a)\r
ba:11 - constant units = ConstUnits\r
b0:a - natural units = NaturalUnits\r
- \r
+\r
Given this info, the offset can be computed by:\r
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))\r
\r
Max offset is achieved with index = 0x7FFF giving an offset of\r
0x27B (32-bit machine) or 0x477 (64-bit machine).\r
- Min offset is achieved with index = \r
+ Min offset is achieved with index =\r
\r
@param VmPtr A pointer to VM context.\r
@param CodeOffset Offset from IP of the location of the 16-bit index\r
\r
/**\r
Writes 8-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes 16-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes 32-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes 64-bit data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
\r
/**\r
Writes UINTN data to memory address.\r
- \r
+\r
This routine is called by the EBC data\r
movement instructions that write to memory. Since these writes\r
may be to the stack, which looks like (high address on top) this,\r
[EBC stack]\r
\r
we need to detect all attempts to write to the EBC entry point argument\r
- stack area and adjust the address (which will initially point into the \r
+ stack area and adjust the address (which will initially point into the\r
VM stack) to point into the EBC entry point arguments.\r
\r
@param VmPtr A pointer to a VM context.\r
@param Addr Adddress to write to.\r
@param Data Value to write to Addr.\r
\r
- @retval EFI_SUCCESS The instruction is executed successfully. \r
+ @retval EFI_SUCCESS The instruction is executed successfully.\r
@retval Other Some error occurs when writing data to the address.\r
\r
**/\r
MemoryFence ();\r
Status = VmWriteMem32 (VmPtr, Addr + Index * sizeof (UINT32), (UINT32) Data);\r
MemoryFence ();\r
- Data = (UINTN)RShiftU64 ((UINT64)Data, 32);\r
+ Data = (UINTN) RShiftU64 ((UINT64)Data, 32);\r
}\r
}\r
\r
//\r
// Return unaligned data\r
//\r
- Data = (UINT32) VmReadCode16 (VmPtr, Offset);\r
- Data |= (UINT32) (VmReadCode16 (VmPtr, Offset + 2) << 16);\r
+ Data = (UINT32) VmReadCode16 (VmPtr, Offset);\r
+ Data |= (UINT32)(VmReadCode16 (VmPtr, Offset + 2) << 16);\r
return Data;\r
}\r
\r
Ptr = (UINT8 *) &Data64;\r
Data32 = VmReadCode32 (VmPtr, Offset);\r
*(UINT32 *) Ptr = Data32;\r
- Ptr += sizeof (Data32);\r
+ Ptr += sizeof (Data32);\r
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));\r
*(UINT32 *) Ptr = Data32;\r
return Data64;\r
Ptr = (UINT8 *) &Data64;\r
Data32 = VmReadCode32 (VmPtr, Offset);\r
*(UINT32 *) Ptr = Data32;\r
- Ptr += sizeof (Data32);\r
+ Ptr += sizeof (Data32);\r
Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));\r
*(UINT32 *) Ptr = Data32;\r
return Data64;\r
\r
/**\r
Returns the version of the EBC virtual machine.\r
- \r
+\r
@return The 64-bit version of EBC virtual machine.\r
\r
**/\r
@param This A pointer to the EFI_EBC_PROTOCOL instance.\r
@param Version Pointer to where to store the returned version\r
of the interpreter.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
\r
\r
/**\r
Returns the EFI_UNSUPPORTED Status.\r
- \r
+\r
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.\r
\r
**/\r
\r
/**\r
Registers a callback function that the EBC interpreter calls to flush the\r
- processor instruction cache following creation of thunks. \r
+ processor instruction cache following creation of thunks.\r
\r
@param This A pointer to the EFI_EBC_PROTOCOL instance.\r
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
@param Start StartSpecifies the physical base of the memory\r
range to be invalidated.\r
@param Length Specifies the minimum number of bytes in the\r
- processor's instruction cache to invalidate. \r
+ processor's instruction cache to invalidate.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
// also be global since the execution of an EBC image does not provide\r
// a This pointer.\r
//\r
-STATIC EBC_IMAGE_LIST *mEbcImageList = NULL;\r
+EBC_IMAGE_LIST *mEbcImageList = NULL;\r
\r
//\r
// Callback function to flush the icache after thunk creation\r
//\r
-STATIC EBC_ICACHE_FLUSH mEbcICacheFlush;\r
+EBC_ICACHE_FLUSH mEbcICacheFlush;\r
\r
//\r
// These get set via calls by the debug agent\r
//\r
-STATIC EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;\r
-STATIC EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};\r
-STATIC EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;\r
+EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;\r
+EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};\r
+EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;\r
\r
-STATIC VOID* mStackBuffer[MAX_STACK_NUM];\r
-STATIC EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];\r
-STATIC UINTN mStackNum = 0;\r
+VOID *mStackBuffer[MAX_STACK_NUM];\r
+EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];\r
+UINTN mStackNum = 0;\r
\r
//\r
// Event for Periodic callback\r
//\r
-STATIC EFI_EVENT mEbcPeriodicEvent;\r
-VM_CONTEXT *mVmPtr = NULL;\r
+EFI_EVENT mEbcPeriodicEvent;\r
+VM_CONTEXT *mVmPtr = NULL;\r
\r
\r
/**\r
@param Start StartSpecifies the physical base of the memory\r
range to be invalidated.\r
@param Length Specifies the minimum number of bytes in the\r
- processor's instruction cache to invalidate. \r
+ processor's instruction cache to invalidate.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
The VM interpreter calls this function when an exception is detected.\r
\r
@param ExceptionType Specifies the processor exception detected.\r
- @param ExceptionFlags Specifies the exception context. \r
+ @param ExceptionFlags Specifies the exception context.\r
@param VmPtr Pointer to a VM context for passing info to the\r
EFI debugger.\r
\r
\r
/**\r
Registers a callback function that the EBC interpreter calls to flush the\r
- processor instruction cache following creation of thunks. \r
+ processor instruction cache following creation of thunks.\r
\r
@param This A pointer to the EFI_EBC_PROTOCOL instance.\r
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
@param This A pointer to the EFI_EBC_PROTOCOL instance.\r
@param Version Pointer to where to store the returned version\r
of the interpreter.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
\r
/**\r
Returns the stack index and buffer assosicated with the Handle parameter.\r
\r
- @param Handle The EFI handle as the index to the EBC stack. \r
+ @param Handle The EFI handle as the index to the EBC stack.\r
@param StackBuffer A pointer to hold the returned stack buffer.\r
@param BufferIndex A pointer to hold the returned stack index.\r
- \r
+\r
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any\r
existing EBC stack.\r
@retval EFI_SUCCESS The stack index and buffer were found and\r
}\r
\r
/**\r
- Returns from the EBC stack by stack Index. \r
- \r
+ Returns from the EBC stack by stack Index.\r
+\r
@param Index Specifies which EBC stack to return from.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
}\r
\r
/**\r
- Returns from the EBC stack associated with the Handle parameter. \r
- \r
+ Returns from the EBC stack associated with the Handle parameter.\r
+\r
@param Handle Specifies the EFI handle to find the EBC stack with.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
/**\r
Allocates memory to hold all the EBC stacks.\r
\r
- @retval EFI_SUCCESS The EBC stacks were allocated successfully. \r
+ @retval EFI_SUCCESS The EBC stacks were allocated successfully.\r
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.\r
\r
**/\r
\r
/**\r
Returns the EFI_UNSUPPORTED Status.\r
- \r
+\r
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.\r
\r
**/\r
typedef UINT32 EXCEPTION_FLAGS;\r
\r
typedef struct {\r
- VM_REGISTER R[8]; // General purpose registers.\r
- UINT64 Flags; // Flags register:\r
- // 0 Set to 1 if the result of the last compare was true\r
- // 1 Set to 1 if stepping\r
- // 2..63 Reserved.\r
+ VM_REGISTER R[8]; // General purpose registers.\r
+ UINT64 Flags; // Flags register:\r
+ // 0 Set to 1 if the result of the last compare was true\r
+ // 1 Set to 1 if stepping\r
+ // 2..63 Reserved.\r
VMIP Ip; // Instruction pointer.\r
UINTN LastException; //\r
EXCEPTION_FLAGS ExceptionFlags; // to keep track of exceptions\r
The VM interpreter calls this function when an exception is detected.\r
\r
@param ExceptionType Specifies the processor exception detected.\r
- @param ExceptionFlags Specifies the exception context. \r
+ @param ExceptionFlags Specifies the exception context.\r
@param VmPtr Pointer to a VM context for passing info to the\r
EFI debugger.\r
\r
\r
//\r
// External low level functions that are native-processor dependent\r
-// \r
+//\r
/**\r
- The VM thunk code stuffs an EBC entry point into a processor \r
+ The VM thunk code stuffs an EBC entry point into a processor\r
register. Since we can't use inline assembly to get it from\r
the interpreter C code, stuff it into the return value\r
register and return.\r
- \r
+\r
@return The contents of the register in which the entry point is passed.\r
\r
**/\r
/**\r
This function is called to execute an EBC CALLEX instruction.\r
This instruction requires that we thunk out to external native\r
- code. For x64, we switch stacks, copy the arguments to the stack \r
+ code. For x64, we switch stacks, copy the arguments to the stack\r
and jump to the specified function.\r
On return, we restore the stack pointer to its original location.\r
Destroys no working registers.\r
/**\r
Returns the stack index and buffer assosicated with the Handle parameter.\r
\r
- @param Handle The EFI handle as the index to the EBC stack. \r
+ @param Handle The EFI handle as the index to the EBC stack.\r
@param StackBuffer A pointer to hold the returned stack buffer.\r
@param BufferIndex A pointer to hold the returned stack index.\r
- \r
+\r
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any\r
existing EBC stack.\r
@retval EFI_SUCCESS The stack index and buffer were found and\r
);\r
\r
/**\r
- Returns from the EBC stack by stack Index. \r
- \r
+ Returns from the EBC stack by stack Index.\r
+\r
@param Index Specifies which EBC stack to return from.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
/**\r
Allocates memory to hold all the EBC stacks.\r
\r
- @retval EFI_SUCCESS The EBC stacks were allocated successfully. \r
+ @retval EFI_SUCCESS The EBC stacks were allocated successfully.\r
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.\r
\r
**/\r
);\r
\r
/**\r
- Returns from the EBC stack associated with the Handle parameter. \r
- \r
+ Returns from the EBC stack associated with the Handle parameter.\r
+\r
@param Handle Specifies the EFI handle to find the EBC stack with.\r
- \r
+\r
@retval EFI_SUCCESS The function completed successfully.\r
\r
**/\r
ReturnEBCStackByHandle(\r
IN EFI_HANDLE Handle\r
);\r
+\r
+\r
//\r
// Defines for a simple EBC debugger interface\r
//\r
typedef\r
EFI_STATUS\r
(*EBC_DEBUGGER_SIGNAL_EXCEPTION) (\r
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,\r
- IN VM_CONTEXT * VmPtr,\r
+ IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,\r
+ IN VM_CONTEXT *VmPtr,\r
IN EFI_EXCEPTION_TYPE ExceptionType\r
);\r
\r
typedef\r
VOID\r
(*EBC_DEBUGGER_DEBUG) (\r
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,\r
- IN VM_CONTEXT * VmPtr\r
+ IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,\r
+ IN VM_CONTEXT *VmPtr\r
);\r
\r
typedef\r
UINT32\r
(*EBC_DEBUGGER_DASM) (\r
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,\r
- IN VM_CONTEXT * VmPtr,\r
+ IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,\r
+ IN VM_CONTEXT *VmPtr,\r
IN UINT16 *DasmString OPTIONAL,\r
IN UINT32 DasmStringSize\r
);\r
typedef\r
EFI_STATUS\r
(*EBC_DEBUGGER_CONFIGURE) (\r
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,\r
+ IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,\r
IN UINT32 ConfigId,\r
IN UINTN ConfigValue\r
);\r