]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c
Sync up ArmPkg with patch from mailing list. Changed name of BdsLib.h to BdsUnixLib...
[mirror_edk2.git] / ArmPkg / Library / ArmDisassemblerLib / ArmDisassembler.c
index 5b43f5542e83d2b819ba9064a2b31d75aba90645..02f93feaabf2502f709116dd22ce026463338520 100644 (file)
@@ -1,9 +1,9 @@
 /** @file\r
   Default exception handler\r
 \r
-  Copyright (c) 2008-2010, Apple Inc. All rights reserved.\r
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   \r
-  All rights reserved. This program and the accompanying materials\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
@@ -37,11 +37,10 @@ CHAR8 *gCondition[] = {
   "2"\r
 };\r
 \r
-#define COND(_a)  gCondition[(_a) >> 28]\r
+#define COND(_a)  gCondition[((_a) >> 28)]\r
 \r
 CHAR8 *gReg[] = {\r
   "r0",\r
-  "r1",\r
   "r2",\r
   "r3",\r
   "r4",\r
@@ -154,13 +153,15 @@ RotateRight (
   @param  OpCodePtr   Pointer to pointer of ARM instruction to disassemble.  \r
   @param  Buf         Buffer to sprintf disassembly into.\r
   @param  Size        Size of Buf in bytes. \r
+  @param  Extended    TRUE dump hex for instruction too.\r
   \r
 **/\r
 VOID\r
 DisassembleArmInstruction (\r
   IN  UINT32    **OpCodePtr,\r
   OUT CHAR8     *Buf,\r
-  OUT UINTN     Size\r
+  OUT UINTN     Size,\r
+  IN  BOOLEAN   Extended\r
   )\r
 {\r
   UINT32    OpCode = **OpCodePtr;\r
@@ -183,6 +184,13 @@ DisassembleArmInstruction (
   Rd = (OpCode >> 12) & 0xf;\r
   Rm = (OpCode & 0xf);\r
 \r
+\r
+  if (Extended) {\r
+    Index = AsciiSPrint (Buf, Size, "0x%08x   ", OpCode);\r
+    Buf += Index;\r
+    Size -= Index;\r
+  }\r
+\r
   // LDREX, STREX\r
   if ((OpCode  & 0x0fe000f0) == 0x01800090) {\r
     if (L) {\r
@@ -216,7 +224,7 @@ DisassembleArmInstruction (
     if ((OpCode & 0xfd70f000 ) == 0xf550f000) {\r
       Index = AsciiSPrint (Buf, Size, "PLD");\r
     } else {\r
-      Index = AsciiSPrint (Buf, Size, "%a%a%a%a %a, ", L ? "LDR" : "STR", COND (OpCode), BYTE (B), (!& W) ? "T":"", gReg[Rd]); \r
+      Index = AsciiSPrint (Buf, Size, "%a%a%a%a %a, ", L ? "LDR" : "STR", COND (OpCode), BYTE (B), (!(P) && W) ? "T":"", gReg[Rd]); \r
     }\r
     if (P) {\r
       if (!I) {\r