summaryrefslogtreecommitdiff
path: root/BeagleBoardPkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'BeagleBoardPkg/Library')
-rw-r--r--BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c28
-rw-r--r--BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf1
2 files changed, 24 insertions, 5 deletions
diff --git a/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c b/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
index b101049cad..6ce3f70f6d 100644
--- a/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
+++ b/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
@@ -25,7 +25,7 @@
#include <Library/UefiLib.h>
#include <Library/PcdLib.h>
#include <Library/EfiFileLib.h>
-
+#include <Library/ArmDisassemblerLib.h>
//PcdEmbeddedFdBaseAddress
@@ -42,11 +42,29 @@
**/
EFI_STATUS
-EblEdk2Cmd (
+EblDisassembler (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
+ UINT8 *Ptr;
+ UINT32 Address;
+ UINT32 Count;
+ CHAR8 Buffer[80];
+
+ if (Argc < 2) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Address = AsciiStrHexToUintn (Argv[1]);
+ Count = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 10;
+
+ Ptr = (UINT8 *)(UINTN)Address;
+ while (Count-- > 0) {
+ DisassembleInstruction (&Ptr, TRUE, TRUE, Buffer, sizeof (Buffer));
+ AsciiPrint ("0x%08x: %a", Address, Buffer);
+ }
+
return EFI_SUCCESS;
}
@@ -54,10 +72,10 @@ EblEdk2Cmd (
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
{
{
- "edk2",
- " filename ; Load FD into memory and boot from it",
+ "disasm address [count]",
+ " disassemble count instructions",
NULL,
- EblEdk2Cmd
+ EblDisassembler
}
};
diff --git a/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf b/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
index 18074438c0..3590351517 100644
--- a/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
+++ b/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
@@ -40,6 +40,7 @@
[LibraryClasses]
BaseLib
DebugLib
+ ArmDisassemblerLib
[Protocols]