From b32fecd24743853164e151a84cb0e33da556cc74 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Wed, 3 Feb 2010 03:13:21 +0000 Subject: [PATCH] Added Thumb2 loads and stores to Disassmebler git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9916 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ArmDisassemblerLib/ThumbDisassembler.c | 299 ++++++++++++++---- 1 file changed, 242 insertions(+), 57 deletions(-) diff --git a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c index f06a6bc2c5..a8dd8d8dee 100644 --- a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c +++ b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c @@ -1,5 +1,12 @@ /** @file - Default exception handler + Thumb Dissassembler. 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. @@ -21,6 +28,7 @@ extern CHAR8 *gCondition[]; extern CHAR8 *gReg[]; +// Thumb address modes #define LOAD_STORE_FORMAT1 1 #define LOAD_STORE_FORMAT2 2 #define LOAD_STORE_FORMAT3 3 @@ -44,10 +52,30 @@ extern CHAR8 *gReg[]; #define DATA_FORMAT8 19 #define CPS_FORMAT 20 #define ENDIAN_FORMAT 21 - +#define DATA_CBZ 22 +#define ADR_FORMAT 23 + +// Thumb2 address modes #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 + + typedef struct { @@ -59,9 +87,9 @@ typedef struct { THUMB_INSTRUCTIONS gOpThumb[] = { // Thumb 16-bit instrucitons -// Op Mask Format +// Op Mask Format { "ADC" , 0x4140, 0xffc0, DATA_FORMAT5 }, - + { "ADR", 0xa000, 0xf800, ADR_FORMAT }, // ADR ,