TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmDisassembler.c File Reference
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/PrintLib.h>
#include <Library/ArmDisassemblerLib.h>

Go to the source code of this file.

Macros

#define COND(_a)   gCondition[((_a) >> 28)]
 
#define LDM_EXT(_reg, _off)   ((_reg == 13) ? gLdmStack[(_off)] : gLdmAdr[(_off)])
 
#define SIGN(_U)   ((_U) ? "" : "-")
 
#define WRITE(_Write)   ((_Write) ? "!" : "")
 
#define BYTE(_B)   ((_B) ? "B":"")
 
#define USER(_B)   ((_B) ? "^" : "")
 

Functions

CHAR8 * MRegList (UINT32 OpCode)
 
CHAR8 * FieldMask (IN UINT32 Mask)
 
UINT32 RotateRight (IN UINT32 Op, IN UINT32 Shift)
 
VOID DisassembleArmInstruction (IN UINT32 **OpCodePtr, OUT CHAR8 *Buf, OUT UINTN Size, IN BOOLEAN Extended)
 

Variables

CHAR8 * gCondition []
 
CHAR8 * gReg []
 
CHAR8 * gLdmAdr []
 
CHAR8 * gLdmStack []
 
CHAR8 mMregListStr [4 *15+1]
 

Detailed Description

Default exception handler

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 ArmDisassembler.c.

Macro Definition Documentation

◆ BYTE

#define BYTE (   _B)    ((_B) ? "B":"")

Definition at line 74 of file ArmDisassembler.c.

◆ COND

#define COND (   _a)    gCondition[((_a) >> 28)]

Definition at line 35 of file ArmDisassembler.c.

◆ LDM_EXT

#define LDM_EXT (   _reg,
  _off 
)    ((_reg == 13) ? gLdmStack[(_off)] : gLdmAdr[(_off)])

Definition at line 70 of file ArmDisassembler.c.

◆ SIGN

#define SIGN (   _U)    ((_U) ? "" : "-")

Definition at line 72 of file ArmDisassembler.c.

◆ USER

#define USER (   _B)    ((_B) ? "^" : "")

Definition at line 75 of file ArmDisassembler.c.

◆ WRITE

#define WRITE (   _Write)    ((_Write) ? "!" : "")

Definition at line 73 of file ArmDisassembler.c.

Function Documentation

◆ DisassembleArmInstruction()

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.

Parameters
OpCodePtrPointer to pointer of ARM instruction to disassemble.
BufBuffer to sprintf disassembly into.
SizeSize of Buf in bytes.
ExtendedTRUE dump hex for instruction too.

Definition at line 154 of file ArmDisassembler.c.

◆ FieldMask()

CHAR8 * FieldMask ( IN UINT32  Mask)

Definition at line 124 of file ArmDisassembler.c.

◆ MRegList()

CHAR8 * MRegList ( UINT32  OpCode)

Definition at line 80 of file ArmDisassembler.c.

◆ RotateRight()

UINT32 RotateRight ( IN UINT32  Op,
IN UINT32  Shift 
)

Definition at line 132 of file ArmDisassembler.c.

Variable Documentation

◆ gCondition

CHAR8* gCondition[]
Initial value:
= {
"EQ",
"NE",
"CS",
"CC",
"MI",
"PL",
"VS",
"VC",
"HI",
"LS",
"GE",
"LT",
"GT",
"LE",
"",
"2"
}

Definition at line 16 of file ArmDisassembler.c.

◆ gLdmAdr

CHAR8* gLdmAdr[]
Initial value:
= {
"DA",
"IA",
"DB",
"IB"
}

Definition at line 56 of file ArmDisassembler.c.

◆ gLdmStack

CHAR8* gLdmStack[]
Initial value:
= {
"FA",
"FD",
"EA",
"ED"
}

Definition at line 63 of file ArmDisassembler.c.

◆ gReg

CHAR8* gReg[]
Initial value:
= {
"r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"r8",
"r9",
"r10",
"r11",
"r12",
"sp",
"lr",
"pc"
}

Definition at line 37 of file ArmDisassembler.c.

◆ mMregListStr

CHAR8 mMregListStr[4 *15+1]

Definition at line 77 of file ArmDisassembler.c.