]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmDisassemblerLib: ARMThumb and AArch64 fixes
authorHarry Liebel <Harry.Liebel@arm.com>
Tue, 9 Sep 2014 15:57:18 +0000 (15:57 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Sep 2014 15:57:18 +0000 (15:57 +0000)
- Fix ARM Thumb mask operator. This was flagged by a toolchain as warning
  "use of logical '&&' with constant operand [-Wconstant-logical-operand]"
- AArch64 should not be building the ARM32 disassemblers.
- Add a AArch64 build target. The disassembler is still to be
  implemented.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16069 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/ArmDisassemblerLib/Aarch64Disassembler.c [new file with mode: 0644]
ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c

diff --git a/ArmPkg/Library/ArmDisassemblerLib/Aarch64Disassembler.c b/ArmPkg/Library/ArmDisassemblerLib/Aarch64Disassembler.c
new file mode 100644 (file)
index 0000000..3ecae77
--- /dev/null
@@ -0,0 +1,48 @@
+/** @file\r
+  Default exception handler\r
+\r
+  Copyright (c) 2014, ARM Limited. All rights reserved.\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD\r
+  License which accompanies this distribution.  The full text of the license may\r
+  be found at http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/ArmDisassemblerLib.h>\r
+\r
+/**\r
+  Place a disassembly of of **OpCodePtr into buffer, and update OpCodePtr to\r
+  point to next instruction.\r
+\r
+  @param  OpCodePtrPtr  Pointer to pointer of instruction to disassemble.\r
+  @param  Thumb         TRUE for Thumb(2), FALSE for ARM instruction stream\r
+  @param  Extended      TRUE dump hex for instruction too.\r
+  @param  ItBlock       Size of IT Block\r
+  @param  Buf           Buffer to sprintf disassembly into.\r
+  @param  Size          Size of Buf in bytes.\r
+\r
+**/\r
+VOID\r
+DisassembleInstruction (\r
+  IN  UINT8     **OpCodePtr,\r
+  IN  BOOLEAN   Thumb,\r
+  IN  BOOLEAN   Extended,\r
+  IN OUT UINT32 *ItBlock,\r
+  OUT CHAR8     *Buf,\r
+  OUT UINTN     Size\r
+  )\r
+{\r
+  // Not yet supported for AArch64.\r
+  // Put error in the buffer as we have no return code and the buffer may be\r
+  // printed directly so needs a '\0'.\r
+  AsciiSPrint (Buf, Size, "AArch64 not supported");\r
+  return;\r
+}\r
index 56ba2d2f3978e0a1429ae39137dcc96a0d663664..bb51e308049443c501936f915b21f8f98d9e6b98 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
-# Semihosting  serail port lib\r
+#  ARM Disassembler library\r
 #\r
-# Copyright (c) 2008, Apple Inc. All rights reserved.<BR>\r
+#  Copyright (c) 2008, Apple Inc. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 \r
 [Defines]\r
   INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = SemiHostingSerialPortLib\r
+  BASE_NAME                      = ArmDisassemblerLib\r
   FILE_GUID                      = 7ACEC173-F15D-426C-8F2F-BD86B4183EF1\r
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = ArmDisassemblerLib\r
 \r
 \r
-[Sources.common]\r
+[Sources.ARM]\r
   ArmDisassembler.c\r
   ThumbDisassembler.c\r
 \r
+[Sources.AARCH64]\r
+  Aarch64Disassembler.c\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   ArmPkg/ArmPkg.dec\r
@@ -35,5 +38,3 @@
   PrintLib\r
   DebugLib\r
   PeCoffGetEntryPointLib\r
-\r
-\r
index 108cda9442983b10575ea7a5fd5f6da17a346552..5bad3afcfbf636a0b05305ac4cabeef386f79a11 100644 (file)
@@ -934,7 +934,7 @@ DisassembleThumbInstruction (
 \r
       case CMN_THUMB2:\r
         // CMN <Rn>, #<const>}\r
-        Target = (OpCode32 & 0xff) | ((OpCode >> 4) && 0x700) | ((OpCode & BIT26) == BIT26 ? BIT11 : 0);\r
+        Target = (OpCode32 & 0xff) | ((OpCode >> 4) & 0x700) | ((OpCode & BIT26) == BIT26 ? BIT11 : 0);\r
         AsciiSPrint (&Buf[Offset], Size - Offset, " %a, #0x%x", gReg[Rn], Target);\r
         return;\r
 \r