From f9f937d243c8c9615119be2f2b35821e7de80925 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Mon, 1 Feb 2010 18:59:27 +0000 Subject: Move ARM disassembler into a library and out of the exception handler. Add a hook to call the lib from a platform specific EBL command on BeagleBoard. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9903 6f19259b-4bc3-4df7-8a09-765794883524 --- BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c | 28 +++++++++++++++++++++----- BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'BeagleBoardPkg') 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 #include #include - +#include //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] -- cgit v1.2.3