]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/Ebc.h
MdePkg FirmwareManagement.h: Fix typo EFI_SECURITY_VIOLATIO
[mirror_edk2.git] / MdePkg / Include / Protocol / Ebc.h
index 13ece4a22767b710abfeb8878919f0f4c61e52f0..0fcb82bce85b10aa7f2e77e9aedf4350f7edc2f8 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Describes the protocol interface to the EBC interpreter.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
   http://opensource.org/licenses/bsd-license.php                                            \r
     0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r
   }\r
 \r
+//\r
+// Define OPCODES\r
+//\r
+#define OPCODE_BREAK    0x00\r
+#define OPCODE_JMP      0x01\r
+#define OPCODE_JMP8     0x02\r
+#define OPCODE_CALL     0x03\r
+#define OPCODE_RET      0x04\r
+#define OPCODE_CMPEQ    0x05\r
+#define OPCODE_CMPLTE   0x06\r
+#define OPCODE_CMPGTE   0x07\r
+#define OPCODE_CMPULTE  0x08\r
+#define OPCODE_CMPUGTE  0x09\r
+#define OPCODE_NOT      0x0A\r
+#define OPCODE_NEG      0x0B\r
+#define OPCODE_ADD      0x0C\r
+#define OPCODE_SUB      0x0D\r
+#define OPCODE_MUL      0x0E\r
+#define OPCODE_MULU     0x0F\r
+#define OPCODE_DIV      0x10\r
+#define OPCODE_DIVU     0x11\r
+#define OPCODE_MOD      0x12\r
+#define OPCODE_MODU     0x13\r
+#define OPCODE_AND      0x14\r
+#define OPCODE_OR       0x15\r
+#define OPCODE_XOR      0x16\r
+#define OPCODE_SHL      0x17\r
+#define OPCODE_SHR      0x18\r
+#define OPCODE_ASHR     0x19\r
+#define OPCODE_EXTNDB   0x1A\r
+#define OPCODE_EXTNDW   0x1B\r
+#define OPCODE_EXTNDD   0x1C\r
+#define OPCODE_MOVBW    0x1D\r
+#define OPCODE_MOVWW    0x1E\r
+#define OPCODE_MOVDW    0x1F\r
+#define OPCODE_MOVQW    0x20\r
+#define OPCODE_MOVBD    0x21\r
+#define OPCODE_MOVWD    0x22\r
+#define OPCODE_MOVDD    0x23\r
+#define OPCODE_MOVQD    0x24\r
+#define OPCODE_MOVSNW   0x25  // Move signed natural with word index\r
+#define OPCODE_MOVSND   0x26  // Move signed natural with dword index\r
+//\r
+// #define OPCODE_27         0x27\r
+//\r
+#define OPCODE_MOVQQ    0x28  // Does this go away?\r
+#define OPCODE_LOADSP   0x29\r
+#define OPCODE_STORESP  0x2A\r
+#define OPCODE_PUSH     0x2B\r
+#define OPCODE_POP      0x2C\r
+#define OPCODE_CMPIEQ   0x2D\r
+#define OPCODE_CMPILTE  0x2E\r
+#define OPCODE_CMPIGTE  0x2F\r
+#define OPCODE_CMPIULTE 0x30\r
+#define OPCODE_CMPIUGTE 0x31\r
+#define OPCODE_MOVNW    0x32\r
+#define OPCODE_MOVND    0x33\r
+//\r
+// #define OPCODE_34         0x34\r
+//\r
+#define OPCODE_PUSHN  0x35\r
+#define OPCODE_POPN   0x36\r
+#define OPCODE_MOVI   0x37\r
+#define OPCODE_MOVIN  0x38\r
+#define OPCODE_MOVREL 0x39\r
+\r
+//\r
+// Bit masks for opcode encodings\r
+//\r
+#define OPCODE_M_OPCODE       0x3F  // bits of interest for first level decode\r
+#define OPCODE_M_IMMDATA      0x80\r
+#define OPCODE_M_IMMDATA64    0x40\r
+#define OPCODE_M_64BIT        0x40  // for CMP\r
+#define OPCODE_M_RELADDR      0x10  // for CALL instruction\r
+#define OPCODE_M_CMPI32_DATA  0x80  // for CMPI\r
+#define OPCODE_M_CMPI64       0x40  // for CMPI 32 or 64 bit comparison\r
+#define OPERAND_M_MOVIN_N     0x80\r
+#define OPERAND_M_CMPI_INDEX  0x10\r
+\r
+//\r
+// Masks for instructions that encode presence of indexes for operand1 and/or\r
+// operand2.\r
+//\r
+#define OPCODE_M_IMMED_OP1  0x80\r
+#define OPCODE_M_IMMED_OP2  0x40\r
+\r
+//\r
+// Bit masks for operand encodings\r
+//\r
+#define OPERAND_M_INDIRECT1 0x08\r
+#define OPERAND_M_INDIRECT2 0x80\r
+#define OPERAND_M_OP1       0x07\r
+#define OPERAND_M_OP2       0x70\r
+\r
+//\r
+// Masks for data manipulation instructions\r
+//\r
+#define DATAMANIP_M_64      0x40  // 64-bit width operation\r
+#define DATAMANIP_M_IMMDATA 0x80\r
+\r
+//\r
+// For MOV instructions, need a mask for the opcode when immediate\r
+// data applies to R2.\r
+//\r
+#define OPCODE_M_IMMED_OP2  0x40\r
+\r
+//\r
+// The MOVI/MOVIn instructions use bit 6 of operands byte to indicate\r
+// if an index is present. Then bits 4 and 5 are used to indicate the width\r
+// of the move.\r
+//\r
+#define MOVI_M_IMMDATA    0x40\r
+#define MOVI_M_DATAWIDTH  0xC0\r
+#define MOVI_DATAWIDTH16  0x40\r
+#define MOVI_DATAWIDTH32  0x80\r
+#define MOVI_DATAWIDTH64  0xC0\r
+#define MOVI_M_MOVEWIDTH  0x30\r
+#define MOVI_MOVEWIDTH8   0x00\r
+#define MOVI_MOVEWIDTH16  0x10\r
+#define MOVI_MOVEWIDTH32  0x20\r
+#define MOVI_MOVEWIDTH64  0x30\r
+\r
+//\r
+// Masks for CALL instruction encodings\r
+//\r
+#define OPERAND_M_RELATIVE_ADDR 0x10\r
+#define OPERAND_M_NATIVE_CALL   0x20\r
+\r
+//\r
+// Masks for decoding push/pop instructions\r
+//\r
+#define PUSHPOP_M_IMMDATA 0x80  // opcode bit indicating immediate data\r
+#define PUSHPOP_M_64      0x40  // opcode bit indicating 64-bit operation\r
+//\r
+// Mask for operand of JMP instruction\r
+//\r
+#define JMP_M_RELATIVE    0x10\r
+#define JMP_M_CONDITIONAL 0x80\r
+#define JMP_M_CS          0x40\r
+\r
+//\r
+// Macros to determine if a given operand is indirect\r
+//\r
+#define OPERAND1_INDIRECT(op) ((op) & OPERAND_M_INDIRECT1)\r
+#define OPERAND2_INDIRECT(op) ((op) & OPERAND_M_INDIRECT2)\r
+\r
+//\r
+// Macros to extract the operands from second byte of instructions\r
+//\r
+#define OPERAND1_REGNUM(op)       ((op) & OPERAND_M_OP1)\r
+#define OPERAND2_REGNUM(op)       (((op) & OPERAND_M_OP2) >> 4)\r
+\r
+#define OPERAND1_CHAR(op)         ('0' + OPERAND1_REGNUM (op))\r
+#define OPERAND2_CHAR(op)         ('0' + OPERAND2_REGNUM (op))\r
+\r
+//\r
+// Condition masks usually for byte 1 encodings of code\r
+//\r
+#define CONDITION_M_CONDITIONAL 0x80\r
+#define CONDITION_M_CS          0x40\r
+\r
 ///\r
 /// Protocol Guid Name defined in spec.\r
 ///\r
@@ -42,7 +203,7 @@ typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;
   @param  This          A pointer to the EFI_EBC_PROTOCOL instance.\r
   @param  ImageHandle   Handle of image for which the thunk is being created.\r
   @param  EbcEntryPoint Address of the actual EBC entry point or protocol service the thunk should call.\r
-  @param  Thunk         Returned pointer to a created thunk.\r
+  @param  Thunk         Returned pointer to a thunk created.\r
 \r
   @retval EFI_SUCCESS            The function completed successfully.\r
   @retval EFI_INVALID_PARAMETER  Image entry point is not 2-byte aligned.\r
@@ -119,7 +280,7 @@ EFI_STATUS
   returned version is identical to that returned by the EBC BREAK 1 instruction.\r
 \r
   @param  This       A pointer to the EFI_EBC_PROTOCOL instance.  \r
-  @param  Version       Pointer to the location to store the returned version of the interpreter.\r
+  @param  Version    Pointer to where to store the returned version of the interpreter.\r
 \r
   @retval EFI_SUCCESS            The function completed successfully.\r
   @retval EFI_INVALID_PARAMETER  Version pointer is NULL.\r