]> git.proxmox.com Git - mirror_edk2.git/blame - BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
Move ARM disassembler into a library and out of the exception handler. Add a hook...
[mirror_edk2.git] / BeagleBoardPkg / Library / EblCmdLib / EblCmdLib.c
CommitLineData
2ef2b01e
A
1/** @file\r
2 Add custom commands for BeagleBoard development.\r
3\r
4 Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
5 \r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include <PiDxe.h>\r
17#include <Library/ArmLib.h>\r
18#include <Library/CacheMaintenanceLib.h>\r
19#include <Library/EblCmdLib.h>\r
20#include <Library/BaseLib.h>\r
21#include <Library/DebugLib.h>\r
22#include <Library/UefiBootServicesTableLib.h>\r
23#include <Library/UefiRuntimeServicesTableLib.h>\r
24#include <Library/MemoryAllocationLib.h>\r
25#include <Library/UefiLib.h>\r
26#include <Library/PcdLib.h>\r
27#include <Library/EfiFileLib.h>\r
f9f937d2 28#include <Library/ArmDisassemblerLib.h>\r
2ef2b01e 29\r
6f72e28d 30//PcdEmbeddedFdBaseAddress\r
31\r
32/**\r
33 Fill Me In\r
34\r
35 Argv[0] - "%CommandName%"\r
36\r
37 @param Argc Number of command arguments in Argv\r
38 @param Argv Array of strings that represent the parsed command line. \r
39 Argv[0] is the comamnd name\r
40\r
41 @return EFI_SUCCESS\r
42\r
43**/\r
44EFI_STATUS\r
f9f937d2 45EblDisassembler (\r
6f72e28d 46 IN UINTN Argc,\r
47 IN CHAR8 **Argv\r
48 )\r
49{\r
f9f937d2 50 UINT8 *Ptr;\r
51 UINT32 Address;\r
52 UINT32 Count;\r
53 CHAR8 Buffer[80];\r
54 \r
55 if (Argc < 2) {\r
56 return EFI_INVALID_PARAMETER;\r
57 }\r
58 \r
59 Address = AsciiStrHexToUintn (Argv[1]);\r
60 Count = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 10;\r
61\r
62 Ptr = (UINT8 *)(UINTN)Address; \r
63 while (Count-- > 0) {\r
64 DisassembleInstruction (&Ptr, TRUE, TRUE, Buffer, sizeof (Buffer));\r
65 AsciiPrint ("0x%08x: %a", Address, Buffer);\r
66 }\r
67\r
6f72e28d 68 return EFI_SUCCESS;\r
69}\r
70\r
71\r
2ef2b01e
A
72GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =\r
73{\r
6f72e28d 74 {\r
f9f937d2 75 "disasm address [count]",\r
76 " disassemble count instructions",\r
6f72e28d 77 NULL,\r
f9f937d2 78 EblDisassembler\r
6f72e28d 79 }\r
2ef2b01e
A
80};\r
81\r
82\r
83VOID\r
84EblInitializeExternalCmd (\r
85 VOID\r
86 )\r
87{\r
88 EblAddCommands (mLibCmdTemplate, sizeof (mLibCmdTemplate)/sizeof (EBL_COMMAND_TABLE));\r
89 return;\r
90}\r