TianoCore EDK2 master
|
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
Go to the source code of this file.
Data Structures | |
struct | THUMB_INSTRUCTIONS |
Macros | |
#define | LOAD_STORE_FORMAT1 1 |
#define | LOAD_STORE_FORMAT1_H 101 |
#define | LOAD_STORE_FORMAT1_B 111 |
#define | LOAD_STORE_FORMAT2 2 |
#define | LOAD_STORE_FORMAT3 3 |
#define | LOAD_STORE_FORMAT4 4 |
#define | LOAD_STORE_MULTIPLE_FORMAT1 5 |
#define | PUSH_FORMAT 6 |
#define | POP_FORMAT 106 |
#define | IMMED_8 7 |
#define | CONDITIONAL_BRANCH 8 |
#define | UNCONDITIONAL_BRANCH 9 |
#define | UNCONDITIONAL_BRANCH_SHORT 109 |
#define | BRANCH_EXCHANGE 10 |
#define | DATA_FORMAT1 11 |
#define | DATA_FORMAT2 12 |
#define | DATA_FORMAT3 13 |
#define | DATA_FORMAT4 14 |
#define | DATA_FORMAT5 15 |
#define | DATA_FORMAT6_SP 16 |
#define | DATA_FORMAT6_PC 116 |
#define | DATA_FORMAT7 17 |
#define | DATA_FORMAT8 19 |
#define | CPS_FORMAT 20 |
#define | ENDIAN_FORMAT 21 |
#define | DATA_CBZ 22 |
#define | ADR_FORMAT 23 |
#define | IT_BLOCK 24 |
#define | B_T3 200 |
#define | B_T4 201 |
#define | BL_T2 202 |
#define | POP_T2 203 |
#define | POP_T3 204 |
#define | STM_FORMAT 205 |
#define | LDM_REG_IMM12_SIGNED 206 |
#define | LDM_REG_IMM12_LSL 207 |
#define | LDM_REG_IMM8 208 |
#define | LDM_REG_IMM12 209 |
#define | LDM_REG_INDIRECT_LSL 210 |
#define | LDM_REG_IMM8_SIGNED 211 |
#define | LDRD_REG_IMM8 212 |
#define | LDREXB 213 |
#define | LDREXD 214 |
#define | SRS_FORMAT 215 |
#define | RFE_FORMAT 216 |
#define | LDRD_REG_IMM8_SIGNED 217 |
#define | ADD_IMM12 218 |
#define | ADD_IMM5 219 |
#define | ADR_THUMB2 220 |
#define | CMN_THUMB2 221 |
#define | ASR_IMM5 222 |
#define | ASR_3REG 223 |
#define | BFC_THUMB2 224 |
#define | CDP_THUMB2 225 |
#define | THUMB2_NO_ARGS 226 |
#define | THUMB2_2REGS 227 |
#define | ADD_IMM5_2REG 228 |
#define | CPD_THUMB2 229 |
#define | THUMB2_4REGS 230 |
#define | ADD_IMM12_1REG 231 |
#define | THUMB2_IMM16 232 |
#define | MRC_THUMB2 233 |
#define | MRRC_THUMB2 234 |
#define | THUMB2_MRS 235 |
#define | THUMB2_MSR 236 |
Functions | |
CHAR8 * | ThumbMRegList (UINT32 RegBitMask) |
UINT32 | SignExtend32 (IN UINT32 Data, IN UINT32 TopBit) |
UINT32 | PcAlign4 (IN UINT32 Data) |
VOID | DisassembleThumbInstruction (IN UINT16 **OpCodePtrPtr, OUT CHAR8 *Buf, OUT UINTN Size, OUT UINT32 *ItBlock, IN BOOLEAN Extended) |
VOID | DisassembleArmInstruction (IN UINT32 **OpCodePtr, OUT CHAR8 *Buf, OUT UINTN Size, IN BOOLEAN Extended) |
VOID | DisassembleInstruction (IN UINT8 **OpCodePtr, IN BOOLEAN Thumb, IN BOOLEAN Extended, IN OUT UINT32 *ItBlock, OUT CHAR8 *Buf, OUT UINTN Size) |
Variables | |
CHAR8 * | gCondition [] |
CHAR8 * | gReg [] |
THUMB_INSTRUCTIONS | gOpThumb [] |
THUMB_INSTRUCTIONS | gOpThumb2 [] |
CHAR8 * | gShiftType [] |
CHAR8 | mThumbMregListStr [4 *15+1] |
Thumb Disassembler. Still a work in progress.
Wrong output is a bug, so please fix it. Hex output means there is not yet an entry or a decode bug. gOpThumb[] are Thumb 16-bit, and gOpThumb2[] work on the 32-bit 16-bit stream of Thumb2 instruction. Then there are big case statements to print everything out. If you are adding instructions try to reuse existing case entries if possible.
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
Copyright (c) 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ThumbDisassembler.c.
#define ADD_IMM12 218 |
Definition at line 76 of file ThumbDisassembler.c.
#define ADD_IMM12_1REG 231 |
Definition at line 89 of file ThumbDisassembler.c.
#define ADD_IMM5 219 |
Definition at line 77 of file ThumbDisassembler.c.
#define ADD_IMM5_2REG 228 |
Definition at line 86 of file ThumbDisassembler.c.
#define ADR_FORMAT 23 |
Definition at line 54 of file ThumbDisassembler.c.
#define ADR_THUMB2 220 |
Definition at line 78 of file ThumbDisassembler.c.
#define ASR_3REG 223 |
Definition at line 81 of file ThumbDisassembler.c.
#define ASR_IMM5 222 |
Definition at line 80 of file ThumbDisassembler.c.
#define B_T3 200 |
Definition at line 58 of file ThumbDisassembler.c.
#define B_T4 201 |
Definition at line 59 of file ThumbDisassembler.c.
#define BFC_THUMB2 224 |
Definition at line 82 of file ThumbDisassembler.c.
#define BL_T2 202 |
Definition at line 60 of file ThumbDisassembler.c.
#define BRANCH_EXCHANGE 10 |
Definition at line 41 of file ThumbDisassembler.c.
#define CDP_THUMB2 225 |
Definition at line 83 of file ThumbDisassembler.c.
#define CMN_THUMB2 221 |
Definition at line 79 of file ThumbDisassembler.c.
#define CONDITIONAL_BRANCH 8 |
Definition at line 38 of file ThumbDisassembler.c.
#define CPD_THUMB2 229 |
Definition at line 87 of file ThumbDisassembler.c.
#define CPS_FORMAT 20 |
Definition at line 51 of file ThumbDisassembler.c.
#define DATA_CBZ 22 |
Definition at line 53 of file ThumbDisassembler.c.
#define DATA_FORMAT1 11 |
Definition at line 42 of file ThumbDisassembler.c.
#define DATA_FORMAT2 12 |
Definition at line 43 of file ThumbDisassembler.c.
#define DATA_FORMAT3 13 |
Definition at line 44 of file ThumbDisassembler.c.
#define DATA_FORMAT4 14 |
Definition at line 45 of file ThumbDisassembler.c.
#define DATA_FORMAT5 15 |
Definition at line 46 of file ThumbDisassembler.c.
#define DATA_FORMAT6_PC 116 |
Definition at line 48 of file ThumbDisassembler.c.
#define DATA_FORMAT6_SP 16 |
Definition at line 47 of file ThumbDisassembler.c.
#define DATA_FORMAT7 17 |
Definition at line 49 of file ThumbDisassembler.c.
#define DATA_FORMAT8 19 |
Definition at line 50 of file ThumbDisassembler.c.
#define ENDIAN_FORMAT 21 |
Definition at line 52 of file ThumbDisassembler.c.
#define IMMED_8 7 |
Definition at line 37 of file ThumbDisassembler.c.
#define IT_BLOCK 24 |
Definition at line 55 of file ThumbDisassembler.c.
#define LDM_REG_IMM12 209 |
Definition at line 67 of file ThumbDisassembler.c.
#define LDM_REG_IMM12_LSL 207 |
Definition at line 65 of file ThumbDisassembler.c.
#define LDM_REG_IMM12_SIGNED 206 |
Definition at line 64 of file ThumbDisassembler.c.
#define LDM_REG_IMM8 208 |
Definition at line 66 of file ThumbDisassembler.c.
#define LDM_REG_IMM8_SIGNED 211 |
Definition at line 69 of file ThumbDisassembler.c.
#define LDM_REG_INDIRECT_LSL 210 |
Definition at line 68 of file ThumbDisassembler.c.
#define LDRD_REG_IMM8 212 |
Definition at line 70 of file ThumbDisassembler.c.
#define LDRD_REG_IMM8_SIGNED 217 |
Definition at line 75 of file ThumbDisassembler.c.
#define LDREXB 213 |
Definition at line 71 of file ThumbDisassembler.c.
#define LDREXD 214 |
Definition at line 72 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT1 1 |
Definition at line 28 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT1_B 111 |
Definition at line 30 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT1_H 101 |
Definition at line 29 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT2 2 |
Definition at line 31 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT3 3 |
Definition at line 32 of file ThumbDisassembler.c.
#define LOAD_STORE_FORMAT4 4 |
Definition at line 33 of file ThumbDisassembler.c.
#define LOAD_STORE_MULTIPLE_FORMAT1 5 |
Definition at line 34 of file ThumbDisassembler.c.
#define MRC_THUMB2 233 |
Definition at line 91 of file ThumbDisassembler.c.
#define MRRC_THUMB2 234 |
Definition at line 92 of file ThumbDisassembler.c.
#define POP_FORMAT 106 |
Definition at line 36 of file ThumbDisassembler.c.
#define POP_T2 203 |
Definition at line 61 of file ThumbDisassembler.c.
#define POP_T3 204 |
Definition at line 62 of file ThumbDisassembler.c.
#define PUSH_FORMAT 6 |
Definition at line 35 of file ThumbDisassembler.c.
#define RFE_FORMAT 216 |
Definition at line 74 of file ThumbDisassembler.c.
#define SRS_FORMAT 215 |
Definition at line 73 of file ThumbDisassembler.c.
#define STM_FORMAT 205 |
Definition at line 63 of file ThumbDisassembler.c.
#define THUMB2_2REGS 227 |
Definition at line 85 of file ThumbDisassembler.c.
#define THUMB2_4REGS 230 |
Definition at line 88 of file ThumbDisassembler.c.
#define THUMB2_IMM16 232 |
Definition at line 90 of file ThumbDisassembler.c.
#define THUMB2_MRS 235 |
Definition at line 93 of file ThumbDisassembler.c.
#define THUMB2_MSR 236 |
Definition at line 94 of file ThumbDisassembler.c.
#define THUMB2_NO_ARGS 226 |
Definition at line 84 of file ThumbDisassembler.c.
#define UNCONDITIONAL_BRANCH 9 |
Definition at line 39 of file ThumbDisassembler.c.
#define UNCONDITIONAL_BRANCH_SHORT 109 |
Definition at line 40 of file ThumbDisassembler.c.
VOID DisassembleArmInstruction | ( | IN UINT32 ** | OpCodePtr, |
OUT CHAR8 * | Buf, | ||
OUT UINTN | Size, | ||
IN BOOLEAN | Extended | ||
) |
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to point to next instruction.
We cheat and only decode instructions that access memory. If the instruction is not found we dump the instruction in hex.
OpCodePtr | Pointer to pointer of ARM instruction to disassemble. |
Buf | Buffer to sprintf disassembly into. |
Size | Size of Buf in bytes. |
Extended | TRUE dump hex for instruction too. |
Definition at line 154 of file ArmDisassembler.c.
VOID DisassembleInstruction | ( | IN UINT8 ** | OpCodePtr, |
IN BOOLEAN | Thumb, | ||
IN BOOLEAN | Extended, | ||
IN OUT UINT32 * | ItBlock, | ||
OUT CHAR8 * | Buf, | ||
OUT UINTN | Size | ||
) |
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to point to next instruction.
We cheat and only decode instructions that access memory. If the instruction is not found we dump the instruction in hex.
OpCodePtrPtr | Pointer to pointer of ARM Thumb instruction to disassemble. |
Thumb | TRUE for Thumb(2), FALSE for ARM instruction stream |
Extended | TRUE dump hex for instruction too. |
ItBlock | Size of IT Block |
Buf | Buffer to sprintf disassembly into. |
Size | Size of Buf in bytes. |
Definition at line 1059 of file ThumbDisassembler.c.
VOID DisassembleThumbInstruction | ( | IN UINT16 ** | OpCodePtrPtr, |
OUT CHAR8 * | Buf, | ||
OUT UINTN | Size, | ||
OUT UINT32 * | ItBlock, | ||
IN BOOLEAN | Extended | ||
) |
Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to point to next instruction.
We cheat and only decode instructions that access memory. If the instruction is not found we dump the instruction in hex.
OpCodePtrPtr | Pointer to pointer of ARM Thumb instruction to disassemble. |
Buf | Buffer to sprintf disassembly into. |
Size | Size of Buf in bytes. |
Extended | TRUE dump hex for instruction too. |
Definition at line 472 of file ThumbDisassembler.c.
UINT32 PcAlign4 | ( | IN UINT32 | Data | ) |
Definition at line 451 of file ThumbDisassembler.c.
Definition at line 428 of file ThumbDisassembler.c.
CHAR8 * ThumbMRegList | ( | UINT32 | RegBitMask | ) |
Definition at line 384 of file ThumbDisassembler.c.
|
extern |
Definition at line 16 of file ArmDisassembler.c.
THUMB_INSTRUCTIONS gOpThumb[] |
Definition at line 103 of file ThumbDisassembler.c.
THUMB_INSTRUCTIONS gOpThumb2[] |
Definition at line 204 of file ThumbDisassembler.c.
|
extern |
Definition at line 37 of file ArmDisassembler.c.
CHAR8* gShiftType[] |
Definition at line 374 of file ThumbDisassembler.c.
CHAR8 mThumbMregListStr[4 *15+1] |
Definition at line 381 of file ThumbDisassembler.c.