mirror of https://github.com/acidanthera/audk.git
Code scrub for EBC module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5568 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
42eedea958
commit
34e4e297bf
|
@ -1,9 +1,7 @@
|
||||||
#/** @file
|
#/** @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
|
||||||
|
@ -57,7 +55,6 @@
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
|
|
@ -49,13 +49,13 @@ UINT64
|
||||||
b14:12 - number of bits in this index assigned to natural units (=a)
|
b14:12 - number of bits in this index assigned to natural units (=a)
|
||||||
ba:11 - constant units = ConstUnits
|
ba:11 - constant units = ConstUnits
|
||||||
b0:a - natural units = NaturalUnits
|
b0:a - natural units = NaturalUnits
|
||||||
|
|
||||||
Given this info, the offset can be computed by:
|
Given this info, the offset can be computed by:
|
||||||
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))
|
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))
|
||||||
|
|
||||||
Max offset is achieved with index = 0x7FFF giving an offset of
|
Max offset is achieved with index = 0x7FFF giving an offset of
|
||||||
0x27B (32-bit machine) or 0x477 (64-bit machine).
|
0x27B (32-bit machine) or 0x477 (64-bit machine).
|
||||||
Min offset is achieved with index =
|
Min offset is achieved with index =
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
@param CodeOffset Offset from IP of the location of the 16-bit index
|
@param CodeOffset Offset from IP of the location of the 16-bit index
|
||||||
|
@ -179,7 +179,7 @@ VmReadMemN (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 8-bit data to memory address.
|
Writes 8-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -189,14 +189,14 @@ VmReadMemN (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -209,7 +209,7 @@ VmWriteMem8 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 16-bit data to memory address.
|
Writes 16-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -219,14 +219,14 @@ VmWriteMem8 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -239,7 +239,7 @@ VmWriteMem16 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 32-bit data to memory address.
|
Writes 32-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -249,14 +249,14 @@ VmWriteMem16 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -440,7 +440,7 @@ ConvertStackAddr (
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
@param IsSignedOp Indicates whether the operand is signed or not.
|
@param IsSignedOp Indicates whether the operand is signed or not.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -472,7 +472,7 @@ ExecuteBREAK (
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
JMP64{cs|cc} Immed64
|
JMP64{cs|cc} Immed64
|
||||||
JMP32{cs|cc} {@}R1 {Immed32|Index32}
|
JMP32{cs|cc} {@}R1 {Immed32|Index32}
|
||||||
|
|
||||||
Encoding:
|
Encoding:
|
||||||
b0.7 - immediate data present
|
b0.7 - immediate data present
|
||||||
b0.6 - 1 = 64 bit immediate data
|
b0.6 - 1 = 64 bit immediate data
|
||||||
|
@ -557,7 +557,7 @@ ExecuteRET (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -574,7 +574,7 @@ ExecuteCMP (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -587,15 +587,15 @@ ExecuteCMPI (
|
||||||
Execute the MOVxx instructions.
|
Execute the MOVxx instructions.
|
||||||
|
|
||||||
Instruction format:
|
Instruction format:
|
||||||
|
|
||||||
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}
|
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}
|
||||||
MOVqq {@}R1 {Index64}, {@}R2 {Index64}
|
MOVqq {@}R1 {Index64}, {@}R2 {Index64}
|
||||||
|
|
||||||
Copies contents of [R2] -> [R1], zero extending where required.
|
Copies contents of [R2] -> [R1], zero extending where required.
|
||||||
|
|
||||||
First character indicates the size of the move.
|
First character indicates the size of the move.
|
||||||
Second character indicates the size of the index(s).
|
Second character indicates the size of the index(s).
|
||||||
|
|
||||||
Invalid to have R1 direct with index.
|
Invalid to have R1 direct with index.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
@ -613,20 +613,20 @@ ExecuteMOVxx (
|
||||||
Execute the EBC MOVI.
|
Execute the EBC MOVI.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
||||||
|
|
||||||
First variable character specifies the move size
|
First variable character specifies the move size
|
||||||
Second variable character specifies size of the immediate data
|
Second variable character specifies size of the immediate data
|
||||||
|
|
||||||
Sign-extend the immediate data to the size of the operation, and zero-extend
|
Sign-extend the immediate data to the size of the operation, and zero-extend
|
||||||
if storing to a register.
|
if storing to a register.
|
||||||
|
|
||||||
Operand1 direct with index/immed is invalid.
|
Operand1 direct with index/immed is invalid.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -640,12 +640,12 @@ ExecuteMOVI (
|
||||||
index value into a register or memory location.
|
index value into a register or memory location.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64
|
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -659,12 +659,12 @@ ExecuteMOVIn (
|
||||||
Dest <- Ip + ImmData
|
Dest <- Ip + ImmData
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -750,7 +750,7 @@ ExecutePOP (
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -772,7 +772,7 @@ ExecuteSignedDataManip (
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -789,7 +789,7 @@ ExecuteUnsignedDataManip (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -806,7 +806,7 @@ ExecuteLOADSP (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -822,15 +822,15 @@ ExecuteSTORESP (
|
||||||
is a register.
|
is a register.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}
|
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}
|
||||||
|
|
||||||
0:7 1=>operand1 index present
|
0:7 1=>operand1 index present
|
||||||
0:6 1=>operand2 index present
|
0:6 1=>operand2 index present
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -846,15 +846,15 @@ ExecuteMOVsnd (
|
||||||
is a register.
|
is a register.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}
|
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}
|
||||||
|
|
||||||
0:7 1=>operand1 index present
|
0:7 1=>operand1 index present
|
||||||
0:6 1=>operand2 index present
|
0:6 1=>operand2 index present
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -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
|
||||||
|
@ -1536,15 +1536,15 @@ Done:
|
||||||
Execute the MOVxx instructions.
|
Execute the MOVxx instructions.
|
||||||
|
|
||||||
Instruction format:
|
Instruction format:
|
||||||
|
|
||||||
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}
|
MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}
|
||||||
MOVqq {@}R1 {Index64}, {@}R2 {Index64}
|
MOVqq {@}R1 {Index64}, {@}R2 {Index64}
|
||||||
|
|
||||||
Copies contents of [R2] -> [R1], zero extending where required.
|
Copies contents of [R2] -> [R1], zero extending where required.
|
||||||
|
|
||||||
First character indicates the size of the move.
|
First character indicates the size of the move.
|
||||||
Second character indicates the size of the index(s).
|
Second character indicates the size of the index(s).
|
||||||
|
|
||||||
Invalid to have R1 direct with index.
|
Invalid to have R1 direct with index.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
@ -1928,7 +1928,7 @@ ExecuteBREAK (
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
JMP64{cs|cc} Immed64
|
JMP64{cs|cc} Immed64
|
||||||
JMP32{cs|cc} {@}R1 {Immed32|Index32}
|
JMP32{cs|cc} {@}R1 {Immed32|Index32}
|
||||||
|
|
||||||
Encoding:
|
Encoding:
|
||||||
b0.7 - immediate data present
|
b0.7 - immediate data present
|
||||||
b0.6 - 1 = 64 bit immediate data
|
b0.6 - 1 = 64 bit immediate data
|
||||||
|
@ -2152,20 +2152,20 @@ ExecuteJMP8 (
|
||||||
Execute the EBC MOVI.
|
Execute the EBC MOVI.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
||||||
|
|
||||||
First variable character specifies the move size
|
First variable character specifies the move size
|
||||||
Second variable character specifies size of the immediate data
|
Second variable character specifies size of the immediate data
|
||||||
|
|
||||||
Sign-extend the immediate data to the size of the operation, and zero-extend
|
Sign-extend the immediate data to the size of the operation, and zero-extend
|
||||||
if storing to a register.
|
if storing to a register.
|
||||||
|
|
||||||
Operand1 direct with index/immed is invalid.
|
Operand1 direct with index/immed is invalid.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -2278,12 +2278,12 @@ ExecuteMOVI (
|
||||||
index value into a register or memory location.
|
index value into a register or memory location.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64
|
MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -2380,12 +2380,12 @@ ExecuteMOVIn (
|
||||||
Dest <- Ip + ImmData
|
Dest <- Ip + ImmData
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -2483,15 +2483,15 @@ ExecuteMOVREL (
|
||||||
is a register.
|
is a register.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}
|
MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}
|
||||||
|
|
||||||
0:7 1=>operand1 index present
|
0:7 1=>operand1 index present
|
||||||
0:6 1=>operand2 index present
|
0:6 1=>operand2 index present
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -2576,15 +2576,15 @@ ExecuteMOVsnw (
|
||||||
is a register.
|
is a register.
|
||||||
|
|
||||||
Instruction syntax:
|
Instruction syntax:
|
||||||
|
|
||||||
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}
|
MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}
|
||||||
|
|
||||||
0:7 1=>operand1 index present
|
0:7 1=>operand1 index present
|
||||||
0:6 1=>operand2 index present
|
0:6 1=>operand2 index present
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -3128,7 +3128,7 @@ ExecuteRET (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -3289,7 +3289,7 @@ ExecuteCMP (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4057,7 +4057,7 @@ ExecuteEXTNDD (
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4087,7 +4087,7 @@ ExecuteSignedDataManip (
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4118,7 +4118,7 @@ ExecuteUnsignedDataManip (
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
@param IsSignedOp Indicates whether the operand is signed or not.
|
@param IsSignedOp Indicates whether the operand is signed or not.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4267,7 +4267,7 @@ ExecuteDataManip (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4321,7 +4321,7 @@ ExecuteLOADSP (
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
@retval EFI_UNSUPPORTED The opcodes/operands is not supported.
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4381,13 +4381,13 @@ ExecuteSTORESP (
|
||||||
b14:12 - number of bits in this index assigned to natural units (=a)
|
b14:12 - number of bits in this index assigned to natural units (=a)
|
||||||
ba:11 - constant units = ConstUnits
|
ba:11 - constant units = ConstUnits
|
||||||
b0:a - natural units = NaturalUnits
|
b0:a - natural units = NaturalUnits
|
||||||
|
|
||||||
Given this info, the offset can be computed by:
|
Given this info, the offset can be computed by:
|
||||||
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))
|
offset = sign_bit * (ConstUnits + NaturalUnits * sizeof(UINTN))
|
||||||
|
|
||||||
Max offset is achieved with index = 0x7FFF giving an offset of
|
Max offset is achieved with index = 0x7FFF giving an offset of
|
||||||
0x27B (32-bit machine) or 0x477 (64-bit machine).
|
0x27B (32-bit machine) or 0x477 (64-bit machine).
|
||||||
Min offset is achieved with index =
|
Min offset is achieved with index =
|
||||||
|
|
||||||
@param VmPtr A pointer to VM context.
|
@param VmPtr A pointer to VM context.
|
||||||
@param CodeOffset Offset from IP of the location of the 16-bit index
|
@param CodeOffset Offset from IP of the location of the 16-bit index
|
||||||
|
@ -4585,7 +4585,7 @@ VmReadIndex64 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 8-bit data to memory address.
|
Writes 8-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -4595,14 +4595,14 @@ VmReadIndex64 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4623,7 +4623,7 @@ VmWriteMem8 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 16-bit data to memory address.
|
Writes 16-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -4633,14 +4633,14 @@ VmWriteMem8 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4686,7 +4686,7 @@ VmWriteMem16 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 32-bit data to memory address.
|
Writes 32-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -4696,14 +4696,14 @@ VmWriteMem16 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4749,7 +4749,7 @@ VmWriteMem32 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 64-bit data to memory address.
|
Writes 64-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -4759,14 +4759,14 @@ VmWriteMem32 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -4814,7 +4814,7 @@ VmWriteMem64 (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes UINTN data to memory address.
|
Writes UINTN data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -4824,14 +4824,14 @@ VmWriteMem64 (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -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;
|
||||||
|
@ -5340,7 +5340,7 @@ VmReadMemN (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the version of the EBC virtual machine.
|
Returns the version of the EBC virtual machine.
|
||||||
|
|
||||||
@return The 64-bit version of EBC virtual machine.
|
@return The 64-bit version of EBC virtual machine.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -245,7 +245,7 @@ EbcExecute (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the version of the EBC virtual machine.
|
Returns the version of the EBC virtual machine.
|
||||||
|
|
||||||
@return The 64-bit version of EBC virtual machine.
|
@return The 64-bit version of EBC virtual machine.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -256,7 +256,7 @@ GetVmVersion (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes UINTN data to memory address.
|
Writes UINTN data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -266,14 +266,14 @@ GetVmVersion (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -286,7 +286,7 @@ VmWriteMemN (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes 64-bit data to memory address.
|
Writes 64-bit data to memory address.
|
||||||
|
|
||||||
This routine is called by the EBC data
|
This routine is called by the EBC data
|
||||||
movement instructions that write to memory. Since these writes
|
movement instructions that write to memory. Since these writes
|
||||||
may be to the stack, which looks like (high address on top) this,
|
may be to the stack, which looks like (high address on top) this,
|
||||||
|
@ -296,14 +296,14 @@ VmWriteMemN (
|
||||||
[EBC stack]
|
[EBC stack]
|
||||||
|
|
||||||
we need to detect all attempts to write to the EBC entry point argument
|
we need to detect all attempts to write to the EBC entry point argument
|
||||||
stack area and adjust the address (which will initially point into the
|
stack area and adjust the address (which will initially point into the
|
||||||
VM stack) to point into the EBC entry point arguments.
|
VM stack) to point into the EBC entry point arguments.
|
||||||
|
|
||||||
@param VmPtr A pointer to a VM context.
|
@param VmPtr A pointer to a VM context.
|
||||||
@param Addr Adddress to write to.
|
@param Addr Adddress to write to.
|
||||||
@param Data Value to write to Addr.
|
@param Data Value to write to Addr.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The instruction is executed successfully.
|
@retval EFI_SUCCESS The instruction is executed successfully.
|
||||||
@retval Other Some error occurs when writing data to the address.
|
@retval Other Some error occurs when writing data to the address.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -89,7 +89,7 @@ EbcCreateThunk (
|
||||||
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
||||||
@param Version Pointer to where to store the returned version
|
@param Version Pointer to where to store the returned version
|
||||||
of the interpreter.
|
of the interpreter.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
@retval EFI_INVALID_PARAMETER Version pointer is NULL.
|
@retval EFI_INVALID_PARAMETER Version pointer is NULL.
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ InitEbcVmTestProtocol (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the EFI_UNSUPPORTED Status.
|
Returns the EFI_UNSUPPORTED Status.
|
||||||
|
|
||||||
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.
|
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -195,11 +195,11 @@ EbcVmTestUnsupported (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Registers a callback function that the EBC interpreter calls to flush the
|
Registers a callback function that the EBC interpreter calls to flush the
|
||||||
processor instruction cache following creation of thunks.
|
processor instruction cache following creation of thunks.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
||||||
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.
|
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -302,7 +302,7 @@ EbcDebugRegisterExceptionCallback (
|
||||||
@param Start StartSpecifies the physical base of the memory
|
@param Start StartSpecifies the physical base of the memory
|
||||||
range to be invalidated.
|
range to be invalidated.
|
||||||
@param Length Specifies the minimum number of bytes in the
|
@param Length Specifies the minimum number of bytes in the
|
||||||
processor's instruction cache to invalidate.
|
processor's instruction cache to invalidate.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -701,7 +701,7 @@ EbcDebugRegisterExceptionCallback (
|
||||||
@param Start StartSpecifies the physical base of the memory
|
@param Start StartSpecifies the physical base of the memory
|
||||||
range to be invalidated.
|
range to be invalidated.
|
||||||
@param Length Specifies the minimum number of bytes in the
|
@param Length Specifies the minimum number of bytes in the
|
||||||
processor's instruction cache to invalidate.
|
processor's instruction cache to invalidate.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ EbcDebugInvalidateInstructionCache (
|
||||||
The VM interpreter calls this function when an exception is detected.
|
The VM interpreter calls this function when an exception is detected.
|
||||||
|
|
||||||
@param ExceptionType Specifies the processor exception detected.
|
@param ExceptionType Specifies the processor exception detected.
|
||||||
@param ExceptionFlags Specifies the exception context.
|
@param ExceptionFlags Specifies the exception context.
|
||||||
@param VmPtr Pointer to a VM context for passing info to the
|
@param VmPtr Pointer to a VM context for passing info to the
|
||||||
EFI debugger.
|
EFI debugger.
|
||||||
|
|
||||||
|
@ -1120,11 +1120,11 @@ EbcAddImageThunk (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Registers a callback function that the EBC interpreter calls to flush the
|
Registers a callback function that the EBC interpreter calls to flush the
|
||||||
processor instruction cache following creation of thunks.
|
processor instruction cache following creation of thunks.
|
||||||
|
|
||||||
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
||||||
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.
|
@param Flush Pointer to a function of type EBC_ICACH_FLUSH.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -1145,7 +1145,7 @@ EbcRegisterICacheFlush (
|
||||||
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
@param This A pointer to the EFI_EBC_PROTOCOL instance.
|
||||||
@param Version Pointer to where to store the returned version
|
@param Version Pointer to where to store the returned version
|
||||||
of the interpreter.
|
of the interpreter.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
@retval EFI_INVALID_PARAMETER Version pointer is NULL.
|
@retval EFI_INVALID_PARAMETER Version pointer is NULL.
|
||||||
|
|
||||||
|
@ -1168,10 +1168,10 @@ EbcGetVersion (
|
||||||
/**
|
/**
|
||||||
Returns the stack index and buffer assosicated with the Handle parameter.
|
Returns the stack index and buffer assosicated with the Handle parameter.
|
||||||
|
|
||||||
@param Handle The EFI handle as the index to the EBC stack.
|
@param Handle The EFI handle as the index to the EBC stack.
|
||||||
@param StackBuffer A pointer to hold the returned stack buffer.
|
@param StackBuffer A pointer to hold the returned stack buffer.
|
||||||
@param BufferIndex A pointer to hold the returned stack index.
|
@param BufferIndex A pointer to hold the returned stack index.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any
|
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any
|
||||||
existing EBC stack.
|
existing EBC stack.
|
||||||
@retval EFI_SUCCESS The stack index and buffer were found and
|
@retval EFI_SUCCESS The stack index and buffer were found and
|
||||||
|
@ -1204,10 +1204,10 @@ GetEBCStack(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns from the EBC stack by stack Index.
|
Returns from the EBC stack by stack Index.
|
||||||
|
|
||||||
@param Index Specifies which EBC stack to return from.
|
@param Index Specifies which EBC stack to return from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -1221,10 +1221,10 @@ ReturnEBCStack(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns from the EBC stack associated with the Handle parameter.
|
Returns from the EBC stack associated with the Handle parameter.
|
||||||
|
|
||||||
@param Handle Specifies the EFI handle to find the EBC stack with.
|
@param Handle Specifies the EFI handle to find the EBC stack with.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -1249,7 +1249,7 @@ ReturnEBCStackByHandle(
|
||||||
/**
|
/**
|
||||||
Allocates memory to hold all the EBC stacks.
|
Allocates memory to hold all the EBC stacks.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The EBC stacks were allocated successfully.
|
@retval EFI_SUCCESS The EBC stacks were allocated successfully.
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.
|
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -1336,7 +1336,7 @@ InitEbcVmTestProtocol (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the EFI_UNSUPPORTED Status.
|
Returns the EFI_UNSUPPORTED Status.
|
||||||
|
|
||||||
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.
|
@return EFI_UNSUPPORTED This function always return EFI_UNSUPPORTED status.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -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
|
||||||
|
@ -132,7 +132,7 @@ EbcAddImageThunk (
|
||||||
The VM interpreter calls this function when an exception is detected.
|
The VM interpreter calls this function when an exception is detected.
|
||||||
|
|
||||||
@param ExceptionType Specifies the processor exception detected.
|
@param ExceptionType Specifies the processor exception detected.
|
||||||
@param ExceptionFlags Specifies the exception context.
|
@param ExceptionFlags Specifies the exception context.
|
||||||
@param VmPtr Pointer to a VM context for passing info to the
|
@param VmPtr Pointer to a VM context for passing info to the
|
||||||
EFI debugger.
|
EFI debugger.
|
||||||
|
|
||||||
|
@ -157,13 +157,13 @@ EbcDebugSignalException (
|
||||||
|
|
||||||
//
|
//
|
||||||
// External low level functions that are native-processor dependent
|
// External low level functions that are native-processor dependent
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
The VM thunk code stuffs an EBC entry point into a processor
|
The VM thunk code stuffs an EBC entry point into a processor
|
||||||
register. Since we can't use inline assembly to get it from
|
register. Since we can't use inline assembly to get it from
|
||||||
the interpreter C code, stuff it into the return value
|
the interpreter C code, stuff it into the return value
|
||||||
register and return.
|
register and return.
|
||||||
|
|
||||||
@return The contents of the register in which the entry point is passed.
|
@return The contents of the register in which the entry point is passed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -191,7 +191,7 @@ EbcLLGetStackPointer (
|
||||||
/**
|
/**
|
||||||
This function is called to execute an EBC CALLEX instruction.
|
This function is called to execute an EBC CALLEX instruction.
|
||||||
This instruction requires that we thunk out to external native
|
This instruction requires that we thunk out to external native
|
||||||
code. For x64, we switch stacks, copy the arguments to the stack
|
code. For x64, we switch stacks, copy the arguments to the stack
|
||||||
and jump to the specified function.
|
and jump to the specified function.
|
||||||
On return, we restore the stack pointer to its original location.
|
On return, we restore the stack pointer to its original location.
|
||||||
Destroys no working registers.
|
Destroys no working registers.
|
||||||
|
@ -251,10 +251,10 @@ EbcLLGetReturnValue (
|
||||||
/**
|
/**
|
||||||
Returns the stack index and buffer assosicated with the Handle parameter.
|
Returns the stack index and buffer assosicated with the Handle parameter.
|
||||||
|
|
||||||
@param Handle The EFI handle as the index to the EBC stack.
|
@param Handle The EFI handle as the index to the EBC stack.
|
||||||
@param StackBuffer A pointer to hold the returned stack buffer.
|
@param StackBuffer A pointer to hold the returned stack buffer.
|
||||||
@param BufferIndex A pointer to hold the returned stack index.
|
@param BufferIndex A pointer to hold the returned stack index.
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any
|
@retval EFI_OUT_OF_RESOURCES The Handle parameter does not correspond to any
|
||||||
existing EBC stack.
|
existing EBC stack.
|
||||||
@retval EFI_SUCCESS The stack index and buffer were found and
|
@retval EFI_SUCCESS The stack index and buffer were found and
|
||||||
|
@ -269,10 +269,10 @@ GetEBCStack(
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns from the EBC stack by stack Index.
|
Returns from the EBC stack by stack Index.
|
||||||
|
|
||||||
@param Index Specifies which EBC stack to return from.
|
@param Index Specifies which EBC stack to return from.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -284,7 +284,7 @@ ReturnEBCStack(
|
||||||
/**
|
/**
|
||||||
Allocates memory to hold all the EBC stacks.
|
Allocates memory to hold all the EBC stacks.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The EBC stacks were allocated successfully.
|
@retval EFI_SUCCESS The EBC stacks were allocated successfully.
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.
|
@retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -305,10 +305,10 @@ FreeEBCStack(
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns from the EBC stack associated with the Handle parameter.
|
Returns from the EBC stack associated with the Handle parameter.
|
||||||
|
|
||||||
@param Handle Specifies the EFI handle to find the EBC stack with.
|
@param Handle Specifies the EFI handle to find the EBC stack with.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -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
|
||||||
);
|
);
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
Loading…
Reference in New Issue