ARM Packages: Removed trailing spaces
Trailing spaces create issue/warning when generating/applying patches. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15833 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
committed by
oliviermartin
parent
62d441fb17
commit
3402aac7d9
@@ -25,7 +25,7 @@
|
||||
Argv[0] - "%CommandName%"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
|
@@ -32,7 +32,7 @@ EBL_COMMAND_TABLE *mCmdTable[EBL_MAX_COMMAND_COUNT];
|
||||
|
||||
@param chr one Ascii character
|
||||
|
||||
@return The uppercase value of Ascii character
|
||||
@return The uppercase value of Ascii character
|
||||
|
||||
**/
|
||||
STATIC
|
||||
@@ -55,11 +55,11 @@ AsciiToUpper (
|
||||
FirstString is identical to SecondString, then 0 is returned. Otherwise, the
|
||||
value returned is the first mismatched Unicode character in SecondString
|
||||
subtracted from the first mismatched Unicode character in FirstString.
|
||||
|
||||
@param FirstString Pointer to a Null-terminated ASCII string.
|
||||
|
||||
@param FirstString Pointer to a Null-terminated ASCII string.
|
||||
@param SecondString Pointer to a Null-terminated ASCII string.
|
||||
@param Length Max length to compare.
|
||||
|
||||
|
||||
@retval 0 FirstString is identical to SecondString using case insensitive
|
||||
comparisons.
|
||||
@retval !=0 FirstString is not identical to SecondString using case
|
||||
@@ -85,15 +85,15 @@ AsciiStrniCmp (
|
||||
SecondString++;
|
||||
Length--;
|
||||
}
|
||||
|
||||
|
||||
return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Add a command to the mCmdTable. If there is no free space in the command
|
||||
table ASSERT. The mCmdTable is maintained in alphabetical order and the
|
||||
Add a command to the mCmdTable. If there is no free space in the command
|
||||
table ASSERT. The mCmdTable is maintained in alphabetical order and the
|
||||
new entry is inserted into its sorted position.
|
||||
|
||||
@param Entry Command Entry to add to the CmdTable
|
||||
@@ -124,7 +124,7 @@ EblAddCommand (
|
||||
if (AsciiStriCmp (mCmdTable[Count - 1]->Name, Entry->Name) <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mCmdTable[Count] = mCmdTable[Count - 1];
|
||||
}
|
||||
mCmdTable[Count] = (EBL_COMMAND_TABLE *)Entry;
|
||||
@@ -135,7 +135,7 @@ EblAddCommand (
|
||||
|
||||
|
||||
/**
|
||||
Add an set of commands to the command table. Most commonly used on static
|
||||
Add an set of commands to the command table. Most commonly used on static
|
||||
array of commands.
|
||||
|
||||
@param EntryArray Pointer to array of command entries
|
||||
@@ -167,7 +167,7 @@ EBL_ADD_COMMAND_PROTOCOL gEblAddCommand = {
|
||||
|
||||
|
||||
/**
|
||||
Return the best matching command for the passed in command name. The match
|
||||
Return the best matching command for the passed in command name. The match
|
||||
does not have to be exact, it just needs to be unique. This enables commands
|
||||
to be shortened to the smallest set of starting characters that is unique.
|
||||
|
||||
@@ -193,9 +193,9 @@ EblGetCommand (
|
||||
if (Str != NULL) {
|
||||
// If the command includes a trailing . command extension skip it for the match.
|
||||
// Example: hexdump.4
|
||||
Length = (UINTN)(Str - CommandName);
|
||||
Length = (UINTN)(Str - CommandName);
|
||||
}
|
||||
|
||||
|
||||
for (Index = 0, BestMatchCount = 0, Match = NULL; Index < mCmdTableNextFreeIndex; Index++) {
|
||||
if (AsciiStriCmp (mCmdTable[Index]->Name, CommandName) == 0) {
|
||||
// match a command exactly
|
||||
@@ -226,30 +226,30 @@ CountNewLines (
|
||||
)
|
||||
{
|
||||
UINTN Count;
|
||||
|
||||
|
||||
if (Str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (Count = 0; *Str != '\0'; Str++) {
|
||||
if (Str[Count] == '\n') {
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
List out help information on all the commands or print extended information
|
||||
List out help information on all the commands or print extended information
|
||||
about a specific passed in command.
|
||||
|
||||
Argv[0] - "help"
|
||||
Argv[1] - Command to display help about
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -281,7 +281,7 @@ EblHelpCmd (
|
||||
}
|
||||
}
|
||||
} else if (Argv[1] != NULL) {
|
||||
// Print specific help
|
||||
// Print specific help
|
||||
for (Index = 0, CurrentRow = 0; Index < mCmdTableNextFreeIndex; Index++) {
|
||||
if (AsciiStriCmp (Argv[1], mCmdTable[Index]->Name) == 0) {
|
||||
Ptr = (mCmdTable[Index]->Help == NULL) ? mCmdTable[Index]->HelpSummary : mCmdTable[Index]->Help;
|
||||
@@ -306,7 +306,7 @@ EblHelpCmd (
|
||||
Argv[0] - "exit"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_ABORTED
|
||||
@@ -326,14 +326,14 @@ EblExitCmd (
|
||||
UINT32 DescriptorVersion;
|
||||
UINTN Pages;
|
||||
|
||||
if (Argc > 1) {
|
||||
if (Argc > 1) {
|
||||
if (AsciiStriCmp (Argv[1], "efi") != 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
} else if (Argc == 1) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
MemoryMap = NULL;
|
||||
MemoryMapSize = 0;
|
||||
do {
|
||||
@@ -348,7 +348,7 @@ EblExitCmd (
|
||||
|
||||
Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;
|
||||
MemoryMap = AllocatePages (Pages);
|
||||
|
||||
|
||||
//
|
||||
// Get System MemoryMap
|
||||
//
|
||||
@@ -375,9 +375,9 @@ EblExitCmd (
|
||||
// At this point it is very dangerous to do things EFI as most of EFI is now gone.
|
||||
// This command is useful if you are working with a debugger as it will shutdown
|
||||
// DMA and other things that could break a soft resets.
|
||||
//
|
||||
//
|
||||
CpuDeadLoop ();
|
||||
|
||||
|
||||
// Should never get here, but makes the compiler happy
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
@@ -385,8 +385,8 @@ EblExitCmd (
|
||||
|
||||
/**
|
||||
Update the screen by decrementing the timeout value.
|
||||
This AsciiPrint has to match the AsciiPrint in
|
||||
EblPauseCmd.
|
||||
This AsciiPrint has to match the AsciiPrint in
|
||||
EblPauseCmd.
|
||||
|
||||
@param ElaspedTime Current timeout value remaining
|
||||
|
||||
@@ -410,7 +410,7 @@ EblPauseCallback (
|
||||
Argv[1] - timeout value is decimal seconds
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS Timeout expired with no input
|
||||
@@ -445,7 +445,7 @@ EblPauseCmd (
|
||||
Argv[0] - "break"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -471,7 +471,7 @@ EblBreakPointCmd (
|
||||
Argv[1] - warm or shutdown reset type
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -496,7 +496,7 @@ EblResetCmd (
|
||||
case 's':
|
||||
ResetType = EfiResetShutdown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
|
||||
return EFI_SUCCESS;
|
||||
@@ -511,7 +511,7 @@ EblResetCmd (
|
||||
Argv[1] - on or off
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -524,7 +524,7 @@ EblPageCmd (
|
||||
)
|
||||
{
|
||||
if (Argc <= 1) {
|
||||
// toggle setting
|
||||
// toggle setting
|
||||
gPageBreak = (gPageBreak) ? FALSE : TRUE;
|
||||
} else {
|
||||
// use argv to set the value
|
||||
@@ -581,7 +581,7 @@ GetBytes (
|
||||
}
|
||||
if (Bytes >= 2) {
|
||||
Result = (Result << 8) + *Address++;
|
||||
}
|
||||
}
|
||||
if (Bytes >= 3) {
|
||||
Result = (Result << 8) + *Address++;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ OutputData (
|
||||
AsciiPrint ("%08x: ", Offset);
|
||||
for (Line = 0; (Line < 0x10) && (Address < EndAddress);) {
|
||||
Bytes = EndAddress - Address;
|
||||
|
||||
|
||||
switch (Width) {
|
||||
case 4:
|
||||
if (Bytes >= 4) {
|
||||
@@ -667,7 +667,7 @@ OutputData (
|
||||
Blanks[Spaces] = '\0';
|
||||
|
||||
AsciiPrint(Blanks);
|
||||
|
||||
|
||||
Blanks[Spaces] = ' ';
|
||||
}
|
||||
|
||||
@@ -682,15 +682,15 @@ OutputData (
|
||||
if (Length % Width != 0) {
|
||||
AsciiPrint ("%08x\n", Offset);
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
See if command contains .# where # is a number. Return # as the Width
|
||||
or 1 as the default Width for commands.
|
||||
|
||||
or 1 as the default Width for commands.
|
||||
|
||||
Example hexdump.4 returns a width of 4.
|
||||
|
||||
@param Argv Argv[0] is the command name
|
||||
@@ -706,7 +706,7 @@ WidthFromCommandName (
|
||||
{
|
||||
CHAR8 *Str;
|
||||
UINTN Width;
|
||||
|
||||
|
||||
//Hexdump.2 HexDump.4 mean use a different width
|
||||
Str = AsciiStrStr (Argv, ".");
|
||||
if (Str != NULL) {
|
||||
@@ -728,13 +728,13 @@ WidthFromCommandName (
|
||||
Toggle page break global. This turns on and off prompting to Quit or hit any
|
||||
key to continue when a command is about to scroll the screen with its output
|
||||
|
||||
Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width
|
||||
Argv[1] - Device or File to dump.
|
||||
Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width
|
||||
Argv[1] - Device or File to dump.
|
||||
Argv[2] - Optional offset to start dumping
|
||||
Argv[3] - Optional number of bytes to dump
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -757,7 +757,7 @@ EblHexdumpCmd (
|
||||
if ((Argc < 2) || (Argc > 4)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
Width = WidthFromCommandName (Argv[0], 1);
|
||||
if ((Width != 1) && (Width != 2) && (Width != 4)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -778,13 +778,13 @@ EblHexdumpCmd (
|
||||
// Make sure size includes the part of the file we have skipped
|
||||
Size += Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = EfiSeek (File, Offset, EfiSeekStart);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
for (; Offset + HEXDUMP_CHUNK <= Size; Offset += Chunk) {
|
||||
Chunk = HEXDUMP_CHUNK;
|
||||
Status = EfiRead (File, Location, &Chunk);
|
||||
@@ -801,7 +801,7 @@ EblHexdumpCmd (
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Any left over?
|
||||
if (Offset < Size) {
|
||||
Chunk = Size - Offset;
|
||||
@@ -894,7 +894,7 @@ EblInitializeCmdTable (
|
||||
{
|
||||
|
||||
EblAddCommands (mCmdTemplate, sizeof (mCmdTemplate)/sizeof (EBL_COMMAND_TABLE));
|
||||
|
||||
|
||||
gBS->InstallProtocolInterface (
|
||||
&gExternalCmdHandle,
|
||||
&gEfiEblAddCommandProtocolGuid,
|
||||
|
@@ -40,22 +40,22 @@ GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gFvFileType[] = {
|
||||
|
||||
/**
|
||||
Perform a dir on a device. The device must support Simple File System Protocol
|
||||
or the FV protocol.
|
||||
or the FV protocol.
|
||||
|
||||
Argv[0] - "dir"
|
||||
Argv[1] - Device Name:path. Path is optional
|
||||
Argv[1] - Device Name:path. Path is optional
|
||||
Argv[2] - Optional filename to match on. A leading * means match substring
|
||||
Argv[3] - Optional FV file type
|
||||
|
||||
dir fs1:\efi ; perform a dir on fs1: device in the efi directory
|
||||
dir fs1:\efi *.efi; perform a dir on fs1: device in the efi directory but
|
||||
dir fs1:\efi *.efi; perform a dir on fs1: device in the efi directory but
|
||||
only print out files that contain the string *.efi
|
||||
dir fv1:\ ; perform a dir on fv1: device in the efi directory
|
||||
dir fv1:\ ; perform a dir on fv1: device in the efi directory
|
||||
NOTE: fv devices do not contain subdirs
|
||||
dir fv1:\ * PEIM ; will match all files of type PEIM
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -71,7 +71,7 @@ EblDirCmd (
|
||||
EFI_OPEN_FILE *File;
|
||||
EFI_FILE_INFO *DirInfo;
|
||||
UINTN ReadSize;
|
||||
UINTN CurrentRow;
|
||||
UINTN CurrentRow;
|
||||
CHAR16 *MatchSubString;
|
||||
EFI_STATUS GetNextFileStatus;
|
||||
UINTN Key;
|
||||
@@ -151,11 +151,11 @@ EblDirCmd (
|
||||
do {
|
||||
Type = SearchType;
|
||||
GetNextFileStatus = Fv->GetNextFile (
|
||||
Fv,
|
||||
Fv,
|
||||
&Key,
|
||||
&Type,
|
||||
&NameGuid,
|
||||
&Attributes,
|
||||
&Type,
|
||||
&NameGuid,
|
||||
&Attributes,
|
||||
&Size
|
||||
);
|
||||
if (!EFI_ERROR (GetNextFileStatus)) {
|
||||
@@ -165,7 +165,7 @@ EblDirCmd (
|
||||
Size = 0;
|
||||
Status = Fv->ReadFile (
|
||||
Fv,
|
||||
&NameGuid,
|
||||
&NameGuid,
|
||||
Section,
|
||||
&Size,
|
||||
&Type,
|
||||
@@ -173,10 +173,10 @@ EblDirCmd (
|
||||
&AuthenticationStatus
|
||||
);
|
||||
if (!((Status == EFI_BUFFER_TOO_SMALL) || !EFI_ERROR (Status))) {
|
||||
// EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid
|
||||
// EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid
|
||||
Size = 0;
|
||||
}
|
||||
|
||||
|
||||
TypeStr = (Type <= EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) ? gFvFileType[Type] : "UNKNOWN";
|
||||
|
||||
// read the UI seciton to do a name match.
|
||||
@@ -208,12 +208,12 @@ EblDirCmd (
|
||||
}
|
||||
}
|
||||
} while (!EFI_ERROR (GetNextFileStatus));
|
||||
|
||||
|
||||
if (SearchType == EFI_FV_FILETYPE_ALL) {
|
||||
AsciiPrint ("%,20d bytes in files %,d bytes free\n", TotalSize, File->FvSize - File->FvHeaderSize - TotalSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else if ((File->Type == EfiOpenFileSystem) || (File->Type == EfiOpenBlockIo)) {
|
||||
// Simple File System DIR
|
||||
|
||||
@@ -233,7 +233,7 @@ EblDirCmd (
|
||||
if (UnicodeFileName[0] == '*') {
|
||||
MatchSubString = &UnicodeFileName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File->FsFileHandle->SetPosition (File->FsFileHandle, 0);
|
||||
for (CurrentRow = 0;;) {
|
||||
@@ -247,7 +247,7 @@ EblDirCmd (
|
||||
if (DirInfo == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
// Read the data
|
||||
Status = File->FsFileHandle->Read (File->FsFileHandle, &ReadSize, DirInfo);
|
||||
if ((EFI_ERROR (Status)) || (ReadSize == 0)) {
|
||||
@@ -256,7 +256,7 @@ EblDirCmd (
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (MatchSubString != NULL) {
|
||||
if (StrStr (&DirInfo->FileName[0], MatchSubString) == NULL) {
|
||||
// does not match *name argument, so skip
|
||||
@@ -278,7 +278,7 @@ EblDirCmd (
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
FreePool (DirInfo);
|
||||
}
|
||||
|
||||
@@ -297,10 +297,10 @@ Done:
|
||||
Change the Current Working Directory
|
||||
|
||||
Argv[0] - "cd"
|
||||
Argv[1] - Device Name:path. Path is optional
|
||||
Argv[1] - Device Name:path. Path is optional
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -314,8 +314,8 @@ EblCdCmd (
|
||||
{
|
||||
if (Argc <= 1) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return EfiSetCwd (Argv[1]);
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ VOID
|
||||
EblInitializeDirCmd (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
{
|
||||
if (FeaturePcdGet (PcdEmbeddedDirCmd)) {
|
||||
EblAddCommands (mCmdDirTemplate, sizeof (mCmdDirTemplate)/sizeof (EBL_COMMAND_TABLE));
|
||||
}
|
||||
|
@@ -18,13 +18,13 @@
|
||||
#define __EBL_H__
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadFile.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
#include <Protocol/PxeBaseCode.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadFile.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
#include <Protocol/PxeBaseCode.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/EblAddCommand.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
@@ -190,7 +190,7 @@ OutputData (
|
||||
IN UINTN Width,
|
||||
IN UINTN Offset
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
WidthFromCommandName (
|
||||
IN CHAR8 *Argv,
|
||||
|
@@ -44,43 +44,43 @@
|
||||
Ebl.h
|
||||
Network.c
|
||||
Variable.c
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
UefiLib
|
||||
UefiApplicationEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
IoLib
|
||||
PrintLib
|
||||
PcdLib
|
||||
EfiFileLib
|
||||
DebugLib
|
||||
UefiLib
|
||||
UefiApplicationEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
IoLib
|
||||
PrintLib
|
||||
PcdLib
|
||||
EfiFileLib
|
||||
HobLib
|
||||
BaseLib
|
||||
BaseLib
|
||||
EblCmdLib
|
||||
EblNetworkLib
|
||||
|
||||
[LibraryClasses.ARM]
|
||||
SemihostLib
|
||||
|
||||
[Protocols.common]
|
||||
gEfiFirmwareVolume2ProtocolGuid
|
||||
gEfiFirmwareVolumeBlockProtocolGuid
|
||||
gEfiBlockIoProtocolGuid
|
||||
|
||||
[Protocols.common]
|
||||
gEfiFirmwareVolume2ProtocolGuid
|
||||
gEfiFirmwareVolumeBlockProtocolGuid
|
||||
gEfiBlockIoProtocolGuid
|
||||
gEfiSimpleFileSystemProtocolGuid
|
||||
gEfiLoadFileProtocolGuid
|
||||
gEfiLoadedImageProtocolGuid
|
||||
gEfiPxeBaseCodeProtocolGuid
|
||||
gEfiLoadFileProtocolGuid
|
||||
gEfiLoadedImageProtocolGuid
|
||||
gEfiPxeBaseCodeProtocolGuid
|
||||
gEfiEblAddCommandProtocolGuid
|
||||
gEfiDiskIoProtocolGuid
|
||||
gEfiPciIoProtocolGuid
|
||||
|
@@ -157,23 +157,23 @@ EblPrintLoadFileInfo (
|
||||
|
||||
if (File->DevicePath != NULL) {
|
||||
// Try to print out the MAC address
|
||||
for (DevicePathNode = File->DevicePath;
|
||||
!IsDevicePathEnd (DevicePathNode);
|
||||
for (DevicePathNode = File->DevicePath;
|
||||
!IsDevicePathEnd (DevicePathNode);
|
||||
DevicePathNode = NextDevicePathNode (DevicePathNode)) {
|
||||
|
||||
|
||||
if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePathNode) == MSG_MAC_ADDR_DP)) {
|
||||
MacAddr = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
|
||||
|
||||
|
||||
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
||||
if (MacAddr->IfType == 0x01 || MacAddr->IfType == 0x00) {
|
||||
HwAddressSize = 6;
|
||||
}
|
||||
|
||||
|
||||
AsciiPrint ("MAC ");
|
||||
for (Index = 0; Index < HwAddressSize; Index++) {
|
||||
AsciiPrint ("%02x", MacAddr->MacAddress.Addr[Index] & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ EblPrintLoadFileInfo (
|
||||
|
||||
|
||||
/**
|
||||
Dump information about devices in the system.
|
||||
Dump information about devices in the system.
|
||||
|
||||
fv: PI Firmware Volume
|
||||
fs: EFI Simple File System
|
||||
@@ -195,7 +195,7 @@ EblPrintLoadFileInfo (
|
||||
Argv[0] - "device"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -249,7 +249,7 @@ EblDeviceCmd (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Max = EfiGetDeviceCounts (EfiOpenLoadFile);
|
||||
if (Max != 0) {
|
||||
AsciiPrint ("LoadFile Devices: (usually network)\n");
|
||||
@@ -266,7 +266,7 @@ EblDeviceCmd (
|
||||
|
||||
|
||||
/**
|
||||
Start an EFI image (PE32+ with EFI defined entry point).
|
||||
Start an EFI image (PE32+ with EFI defined entry point).
|
||||
|
||||
Argv[0] - "start"
|
||||
Argv[1] - device name and path
|
||||
@@ -278,7 +278,7 @@ EblDeviceCmd (
|
||||
start LoadFile0: ; load an FV via a PXE boot
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -308,7 +308,7 @@ EblStartCmd (
|
||||
|
||||
File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
|
||||
if (File == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DevicePath = File->DevicePath;
|
||||
@@ -328,7 +328,7 @@ EblStartCmd (
|
||||
|
||||
FreePool (Buffer);
|
||||
}
|
||||
|
||||
|
||||
EfiClose (File);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -337,7 +337,7 @@ EblStartCmd (
|
||||
// We don't pass Argv[0] to the EFI Application (it's name) just the args
|
||||
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&ImageInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
ImageInfo->LoadOptionsSize = (UINT32)AsciiStrSize (Argv[2]);
|
||||
ImageInfo->LoadOptions = AllocatePool (ImageInfo->LoadOptionsSize);
|
||||
AsciiStrCpy (ImageInfo->LoadOptions, Argv[2]);
|
||||
@@ -354,7 +354,7 @@ EblStartCmd (
|
||||
/**
|
||||
Load a Firmware Volume (FV) into memory from a device. This causes drivers in
|
||||
the FV to be dispatched if the dependencies of the drivers are met.
|
||||
|
||||
|
||||
Argv[0] - "loadfv"
|
||||
Argv[1] - device name and path
|
||||
|
||||
@@ -363,7 +363,7 @@ EblStartCmd (
|
||||
loadfv LoadFile0: ; load an FV via a PXE boot
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -388,7 +388,7 @@ EblLoadFvCmd (
|
||||
|
||||
File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
|
||||
if (File == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (File->Type == EfiOpenMemoryBuffer) {
|
||||
@@ -401,25 +401,25 @@ EblLoadFvCmd (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (FvStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Perform an EFI connect to connect devices that follow the EFI driver model.
|
||||
Perform an EFI connect to connect devices that follow the EFI driver model.
|
||||
If it is a PI system also call the dispatcher in case a new FV was made
|
||||
available by one of the connect EFI drivers (this is not a common case).
|
||||
|
||||
|
||||
Argv[0] - "connect"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -451,11 +451,11 @@ EblConnectCmd (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Given we disconnect our console we should go and do a connect now
|
||||
//
|
||||
@@ -537,11 +537,11 @@ CHAR8 *gMemMapType[] = {
|
||||
|
||||
/**
|
||||
Dump out the EFI memory map
|
||||
|
||||
|
||||
Argv[0] - "memmap"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -569,7 +569,7 @@ EblMemMapCmd (
|
||||
ZeroMem (PageCount, sizeof (PageCount));
|
||||
|
||||
AsciiPrint ("EFI Memory Map\n");
|
||||
|
||||
|
||||
// First call is to figure out how big the buffer needs to be
|
||||
MemMapSize = 0;
|
||||
MemMap = NULL;
|
||||
@@ -593,7 +593,7 @@ EblMemMapCmd (
|
||||
MemMap = NEXT_MEMORY_DESCRIPTOR (MemMap, DescriptorSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (Index = 0, TotalMemory = 0; Index < EfiMaxMemoryType; Index++) {
|
||||
if (PageCount[Index] != 0) {
|
||||
AsciiPrint ("\n %a %,7ld Pages (%,14ld)", gMemMapType[Index], PageCount[Index], LShiftU64 (PageCount[Index], 12));
|
||||
@@ -630,27 +630,27 @@ EblMemMapCmd (
|
||||
/**
|
||||
Load a file into memory and optionally jump to it. A load address can be
|
||||
specified or automatically allocated. A quoted command line can optionally
|
||||
be passed into the image.
|
||||
be passed into the image.
|
||||
|
||||
Argv[0] - "go"
|
||||
Argv[1] - Device Name:path for the file to load
|
||||
Argv[2] - Address to load to or '*' if the load address will be allocated
|
||||
Argv[3] - Optional Entry point to the image. Image will be called if present
|
||||
Argv[4] - "" string that will be passed as Argc & Argv to EntryPoint. Needs
|
||||
Argv[4] - "" string that will be passed as Argc & Argv to EntryPoint. Needs
|
||||
to include the command name
|
||||
|
||||
go fv1:\EblCmdX 0x10000 0x10010 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX
|
||||
from FV1 to location 0x10000 and call the entry point at 0x10010 passing
|
||||
go fv1:\EblCmdX 0x10000 0x10010 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX
|
||||
from FV1 to location 0x10000 and call the entry point at 0x10010 passing
|
||||
in "EblCmdX Arg2 Arg3 Arg4" as the arguments.
|
||||
|
||||
go fv0:\EblCmdX * 0x10 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX from FS0
|
||||
go fv0:\EblCmdX * 0x10 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX from FS0
|
||||
to location allocated by this command and call the entry point at offset 0x10
|
||||
passing in "EblCmdX Arg2 Arg3 Arg4" as the arguments.
|
||||
|
||||
go fv1:\EblCmdX 0x10000; Load EblCmdX to address 0x10000 and return
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -669,7 +669,7 @@ EblGoCmd (
|
||||
EBL_COMMMAND EntryPoint;
|
||||
UINTN EntryPointArgc;
|
||||
CHAR8 *EntryPointArgv[MAX_ARGS];
|
||||
|
||||
|
||||
|
||||
if (Argc <= 2) {
|
||||
// device name and laod address are required
|
||||
@@ -686,7 +686,7 @@ EblGoCmd (
|
||||
if (Argv[2][0] == '*') {
|
||||
// * Means allocate the buffer
|
||||
Status = EfiReadAllocatePool (File, &Address, &Size);
|
||||
|
||||
|
||||
// EntryPoint is relative to the start of the image
|
||||
EntryPoint = (EBL_COMMMAND)((UINTN)EntryPoint + (UINTN)Address);
|
||||
|
||||
@@ -709,7 +709,7 @@ EblGoCmd (
|
||||
EntryPointArgc = 1;
|
||||
EntryPointArgv[0] = File->FileName;
|
||||
}
|
||||
|
||||
|
||||
Status = EntryPoint (EntryPointArgc, EntryPointArgv);
|
||||
}
|
||||
}
|
||||
@@ -741,7 +741,7 @@ EblFileCopyCmd (
|
||||
if (Argc < 3) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
DestFileName = Argv[2];
|
||||
FileNameLen = AsciiStrLen (DestFileName);
|
||||
|
||||
@@ -788,7 +788,7 @@ EblFileCopyCmd (
|
||||
AsciiPrint("Source file open error.\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
Destination = EfiOpen(DestFileName, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
||||
if (Destination == NULL) {
|
||||
AsciiPrint("Destination file open error.\n");
|
||||
@@ -799,12 +799,12 @@ EblFileCopyCmd (
|
||||
if (Buffer == NULL) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
Size = EfiTell(Source, NULL);
|
||||
|
||||
for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size; Offset += Chunk) {
|
||||
Chunk = FILE_COPY_CHUNK;
|
||||
|
||||
|
||||
Status = EfiRead(Source, Buffer, &Chunk);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Read file error %r\n", Status);
|
||||
@@ -815,13 +815,13 @@ EblFileCopyCmd (
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Write file error %r\n", Status);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Any left over?
|
||||
if (Offset < Size) {
|
||||
Chunk = Size - Offset;
|
||||
|
||||
|
||||
Status = EfiRead(Source, Buffer, &Chunk);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Read file error %r\n", Status);
|
||||
@@ -832,7 +832,7 @@ EblFileCopyCmd (
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Write file error %r\n", Status);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -854,11 +854,11 @@ Exit:
|
||||
FreePool (DestFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Buffer != NULL) {
|
||||
FreePool(Buffer);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -877,17 +877,17 @@ EblFileDiffCmd (
|
||||
UINTN Size2;
|
||||
UINTN Offset;
|
||||
UINTN Chunk = FILE_COPY_CHUNK;
|
||||
|
||||
|
||||
if (Argc != 3) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
File1 = EfiOpen(Argv[1], EFI_FILE_MODE_READ, 0);
|
||||
if (File1 == NULL) {
|
||||
AsciiPrint("File 1 open error.\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
File2 = EfiOpen(Argv[2], EFI_FILE_MODE_READ, 0);
|
||||
if (File2 == NULL) {
|
||||
AsciiPrint("File 2 open error.\n");
|
||||
@@ -906,15 +906,15 @@ EblFileDiffCmd (
|
||||
if (Buffer1 == NULL) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
Buffer2 = AllocatePool(FILE_COPY_CHUNK);
|
||||
if (Buffer2 == NULL) {
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size1; Offset += Chunk) {
|
||||
Chunk = FILE_COPY_CHUNK;
|
||||
|
||||
|
||||
Status = EfiRead(File1, Buffer1, &Chunk);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("File 1 read error\n");
|
||||
@@ -926,17 +926,17 @@ EblFileDiffCmd (
|
||||
AsciiPrint("File 2 read error\n");
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {
|
||||
AsciiPrint("Files differ.\n");
|
||||
goto Exit;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Any left over?
|
||||
if (Offset < Size1) {
|
||||
Chunk = Size1 - Offset;
|
||||
|
||||
|
||||
Status = EfiRead(File1, Buffer1, &Chunk);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("File 1 read error\n");
|
||||
@@ -947,9 +947,9 @@ EblFileDiffCmd (
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("File 2 read error\n");
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {
|
||||
AsciiPrint("Files differ.\n");
|
||||
} else {
|
||||
@@ -963,22 +963,22 @@ Exit:
|
||||
AsciiPrint("File 1 close error %r\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (File2 != NULL) {
|
||||
Status = EfiClose(File2);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("File 2 close error %r\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Buffer1 != NULL) {
|
||||
FreePool(Buffer1);
|
||||
}
|
||||
|
||||
|
||||
if (Buffer2 != NULL) {
|
||||
FreePool(Buffer2);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -998,25 +998,25 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDeviceTemplate[] =
|
||||
},
|
||||
{
|
||||
"go",
|
||||
" dev:path loadaddress entrypoint args; load to given address and jump in",
|
||||
" dev:path loadaddress entrypoint args; load to given address and jump in",
|
||||
NULL,
|
||||
EblGoCmd
|
||||
},
|
||||
{
|
||||
"loadfv",
|
||||
" devname; Load PI FV from device",
|
||||
" devname; Load PI FV from device",
|
||||
NULL,
|
||||
EblLoadFvCmd
|
||||
},
|
||||
{
|
||||
"start",
|
||||
" path; EFI Boot Device:filepath. fs1:\\EFI\\BOOT.EFI",
|
||||
" path; EFI Boot Device:filepath. fs1:\\EFI\\BOOT.EFI",
|
||||
NULL,
|
||||
EblStartCmd
|
||||
},
|
||||
{
|
||||
"memmap",
|
||||
"; dump EFI memory map",
|
||||
"; dump EFI memory map",
|
||||
NULL,
|
||||
EblMemMapCmd
|
||||
},
|
||||
|
@@ -87,7 +87,7 @@
|
||||
**/
|
||||
|
||||
#include "Ebl.h"
|
||||
// BugBug: Autogen does not allow this to be included currently
|
||||
// BugBug: Autogen does not allow this to be included currently
|
||||
//#include <EdkModulePkg/Include/EdkDxe.h>
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED char *mHobResourceType[] = {
|
||||
@@ -109,7 +109,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED char *mHobResourceType[] = {
|
||||
Argv[0] - "hob"
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -129,9 +129,9 @@ EblHobCmd (
|
||||
CurrentRow = 0;
|
||||
for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
|
||||
if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {
|
||||
AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx Bottom %lx\n",
|
||||
Hob.HandoffInformationTable->Version,
|
||||
Hob.HandoffInformationTable->BootMode,
|
||||
AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx Bottom %lx\n",
|
||||
Hob.HandoffInformationTable->Version,
|
||||
Hob.HandoffInformationTable->BootMode,
|
||||
Hob.HandoffInformationTable->EfiMemoryTop,
|
||||
Hob.HandoffInformationTable->EfiMemoryBottom
|
||||
);
|
||||
@@ -140,7 +140,7 @@ EblHobCmd (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
AsciiPrint (" Free Top %lx Free Bottom %lx End Of HOB %lx\n",
|
||||
AsciiPrint (" Free Top %lx Free Bottom %lx End Of HOB %lx\n",
|
||||
Hob.HandoffInformationTable->EfiFreeMemoryTop,
|
||||
Hob.HandoffInformationTable->EfiFreeMemoryBottom,
|
||||
Hob.HandoffInformationTable->EfiEndOfHobList
|
||||
@@ -149,9 +149,9 @@ EblHobCmd (
|
||||
} else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
|
||||
// mod(%) on array index is just to prevent buffer overrun
|
||||
AsciiPrint ("Mem Alloc HOB %a %g %08lx:%lx\n",
|
||||
(Hob.MemoryAllocation->AllocDescriptor.MemoryType < EfiMaxMemoryType) ? gMemMapType[Hob.MemoryAllocation->AllocDescriptor.MemoryType] : "ILLEGAL TYPE",
|
||||
&Hob.MemoryAllocation->AllocDescriptor.Name,
|
||||
Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress,
|
||||
(Hob.MemoryAllocation->AllocDescriptor.MemoryType < EfiMaxMemoryType) ? gMemMapType[Hob.MemoryAllocation->AllocDescriptor.MemoryType] : "ILLEGAL TYPE",
|
||||
&Hob.MemoryAllocation->AllocDescriptor.Name,
|
||||
Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress,
|
||||
Hob.MemoryAllocation->AllocDescriptor.MemoryLength
|
||||
);
|
||||
if (CompareGuid (&gEfiHobMemoryAllocModuleGuid, &Hob.MemoryAllocation->AllocDescriptor.Name)) {
|
||||
@@ -163,9 +163,9 @@ EblHobCmd (
|
||||
} else if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
|
||||
AsciiPrint ("Resource HOB %a %g %08lx:%lx\n Attributes: %08x\n",
|
||||
(Hob.ResourceDescriptor->ResourceType < EFI_RESOURCE_MAX_MEMORY_TYPE) ? mHobResourceType[Hob.ResourceDescriptor->ResourceType] : mHobResourceType[EFI_RESOURCE_MAX_MEMORY_TYPE],
|
||||
&Hob.ResourceDescriptor->Owner,
|
||||
Hob.ResourceDescriptor->PhysicalStart,
|
||||
Hob.ResourceDescriptor->ResourceLength,
|
||||
&Hob.ResourceDescriptor->Owner,
|
||||
Hob.ResourceDescriptor->PhysicalStart,
|
||||
Hob.ResourceDescriptor->ResourceLength,
|
||||
Hob.ResourceDescriptor->ResourceAttribute
|
||||
);
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
@@ -179,16 +179,16 @@ EblHobCmd (
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
AsciiPrint (" %a 0x%08x\n",
|
||||
(EfiMemoryTypeInformation->Type < EfiMaxMemoryType) ? gMemMapType[EfiMemoryTypeInformation->Type] : "END ",
|
||||
AsciiPrint (" %a 0x%08x\n",
|
||||
(EfiMemoryTypeInformation->Type < EfiMaxMemoryType) ? gMemMapType[EfiMemoryTypeInformation->Type] : "END ",
|
||||
EfiMemoryTypeInformation->NumberOfPages
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {
|
||||
AsciiPrint ("FV HOB %08lx:%08lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->Length);
|
||||
AsciiPrint ("FV HOB %08lx:%08lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->Length);
|
||||
} else if (Hob.Header->HobType == EFI_HOB_TYPE_CPU) {
|
||||
AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob.Cpu->SizeOfMemorySpace, Hob.Cpu->SizeOfIoSpace);
|
||||
AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob.Cpu->SizeOfMemorySpace, Hob.Cpu->SizeOfIoSpace);
|
||||
} else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_POOL) {
|
||||
AsciiPrint ("Mem Pool HOB:\n");
|
||||
/* Not in PI
|
||||
@@ -199,7 +199,7 @@ EblHobCmd (
|
||||
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
Module Name: HwDebug.c
|
||||
|
||||
Commands useful for debugging hardware.
|
||||
Commands useful for debugging hardware.
|
||||
|
||||
**/
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
md 0x123445678 ; Dump 0x20 1 byte quantities starting at 0x123445678
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -63,7 +63,7 @@ EblMdCmd (
|
||||
OutputData (Address, Length, Width, (UINTN)Address);
|
||||
|
||||
Address += Length;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ EblMdCmd (
|
||||
mf 0x123445678 ; Start at 0x123445678 and write 00 (4 byte) to the next 1 byte
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -119,7 +119,7 @@ EblMfillCmd (
|
||||
MmioWrite8 (Address, (UINT8)Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ CHAR8 *gPciSerialClassCodes[] = {
|
||||
Argv[3] - func
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -195,13 +195,13 @@ EblPciCmd (
|
||||
CHAR8 *Str;
|
||||
UINTN ThisBus;
|
||||
|
||||
|
||||
|
||||
BusArg = (Argc > 1) ? AsciiStrDecimalToUintn (Argv[1]) : 0;
|
||||
DevArg = (Argc > 2) ? AsciiStrDecimalToUintn (Argv[2]) : 0;
|
||||
FuncArg = (Argc > 3) ? AsciiStrDecimalToUintn (Argv[3]) : 0;
|
||||
|
||||
Header = &PciHeader;
|
||||
|
||||
|
||||
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiPrint ("No PCI devices found in the system\n");
|
||||
@@ -224,7 +224,7 @@ EblPciCmd (
|
||||
Status = Pci->Pci.Read (Pci, EfiPciIoWidthUint32, 0, sizeof (PciHeader)/sizeof (UINT32), &PciHeader);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Hdr = &PciHeader.Bridge.Hdr;
|
||||
|
||||
|
||||
if (Hdr->ClassCode[2] < sizeof (gPciDevClass)/sizeof (VOID *)) {
|
||||
Str = gPciDevClass[Hdr->ClassCode[2]];
|
||||
if (Hdr->ClassCode[2] == PCI_CLASS_SERIAL) {
|
||||
@@ -239,7 +239,7 @@ EblPciCmd (
|
||||
AsciiPrint (" 0x%04x 0x%04x %a 0x%02x", Hdr->VendorId, Hdr->DeviceId, Str, Hdr->ClassCode[1]);
|
||||
}
|
||||
if (Seg != 0) {
|
||||
// Only print Segment if it is non zero. If you only have one PCI segment it is
|
||||
// Only print Segment if it is non zero. If you only have one PCI segment it is
|
||||
// redundent to print it out
|
||||
AsciiPrint (" Seg:%d", Seg);
|
||||
}
|
||||
@@ -254,20 +254,20 @@ EblPciCmd (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Pci->GetLocation (Pci, &Seg, &Bus, &Dev, &Func);
|
||||
if ((Bus == BusArg) && (Dev == DevArg) && (Func == FuncArg)) {
|
||||
// Only print Segment if it is non zero. If you only have one PCI segment it is
|
||||
// Only print Segment if it is non zero. If you only have one PCI segment it is
|
||||
// redundant to print it out
|
||||
if (Seg != 0) {
|
||||
AsciiPrint ("Seg:%d ", Seg);
|
||||
}
|
||||
AsciiPrint ("Bus:%d Dev:%d Func:%d ", Bus, Dev, Func);
|
||||
|
||||
|
||||
Status = Pci->Pci.Read (Pci, EfiPciIoWidthUint32, 0, sizeof (PciHeader)/sizeof (UINT32), Header);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Hdr = &PciHeader.Bridge.Hdr;
|
||||
if (IS_PCI_BRIDGE (&PciHeader.Bridge)) {
|
||||
Bridge = &PciHeader.Bridge.Bridge;
|
||||
AsciiPrint (
|
||||
"PCI Bridge. Bus Primary %d Secondary %d Subordinate %d\n",
|
||||
"PCI Bridge. Bus Primary %d Secondary %d Subordinate %d\n",
|
||||
Bridge->PrimaryBus, Bridge->SecondaryBus, Bridge->SubordinateBus
|
||||
);
|
||||
AsciiPrint (" Bar 0: 0x%08x Bar 1: 0x%08x\n", Bridge->Bar[0], Bridge->Bar[1]);
|
||||
@@ -283,14 +283,14 @@ EblPciCmd (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AsciiPrint ("\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FreePool (HandleBuffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@
|
||||
ior 0x3f8 ;Do a 8-bit IO Read from 0x3f8
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -81,7 +81,7 @@ EblIoReadCmd (
|
||||
iow 0x3f8 af ;Do an 8-bit IO write of af to 0x3f8
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -104,7 +104,7 @@ EblIoWriteCmd (
|
||||
Port = AsciiStrHexToUintn (Argv[1]);
|
||||
Data = AsciiStrHexToUintn (Argv[2]);
|
||||
Width = WidthFromCommandName (Argv[0], 1);
|
||||
|
||||
|
||||
if (Width == 1) {
|
||||
IoWrite8 (Port, (UINT8)Data);
|
||||
} else if (Width == 2) {
|
||||
|
@@ -31,13 +31,13 @@ UINTN gScreenRows;
|
||||
// Global to turn on/off breaking commands with prompts before they scroll the screen
|
||||
BOOLEAN gPageBreak = TRUE;
|
||||
|
||||
VOID
|
||||
VOID
|
||||
RingBufferIncrement (
|
||||
IN INTN *Value
|
||||
)
|
||||
{
|
||||
*Value = *Value + 1;
|
||||
|
||||
|
||||
if (*Value >= MAX_CMD_HISTORY) {
|
||||
*Value = 0;
|
||||
}
|
||||
@@ -49,14 +49,14 @@ RingBufferDecrement (
|
||||
)
|
||||
{
|
||||
*Value = *Value - 1;
|
||||
|
||||
|
||||
if (*Value < 0) {
|
||||
*Value = MAX_CMD_HISTORY - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Save this command in the circular history buffer. Older commands are
|
||||
Save this command in the circular history buffer. Older commands are
|
||||
overwritten with newer commands.
|
||||
|
||||
@param Cmd Command line to archive the history of.
|
||||
@@ -71,7 +71,7 @@ SetCmdHistory (
|
||||
{
|
||||
// Don't bother adding empty commands to the list
|
||||
if (AsciiStrLen(Cmd) != 0) {
|
||||
|
||||
|
||||
// First entry
|
||||
if (mCmdHistoryStart == -1) {
|
||||
mCmdHistoryStart = 0;
|
||||
@@ -79,19 +79,19 @@ SetCmdHistory (
|
||||
} else {
|
||||
// Record the new command at the next index
|
||||
RingBufferIncrement(&mCmdHistoryStart);
|
||||
|
||||
|
||||
// If the next index runs into the end index, shuffle end back by one
|
||||
if (mCmdHistoryStart == mCmdHistoryEnd) {
|
||||
RingBufferIncrement(&mCmdHistoryEnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copy the new command line into the ring buffer
|
||||
AsciiStrnCpy(&mCmdHistory[mCmdHistoryStart][0], Cmd, MAX_CMD_LINE);
|
||||
}
|
||||
|
||||
|
||||
// Reset the command history for the next up arrow press
|
||||
mCmdHistoryCurrent = mCmdHistoryStart;
|
||||
mCmdHistoryCurrent = mCmdHistoryStart;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,41 +110,41 @@ GetCmdHistory (
|
||||
)
|
||||
{
|
||||
CHAR8 *HistoricalCommand = NULL;
|
||||
|
||||
|
||||
// No history yet?
|
||||
if (mCmdHistoryCurrent == -1) {
|
||||
HistoricalCommand = mCmdBlank;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if (Direction == SCAN_UP) {
|
||||
HistoricalCommand = &mCmdHistory[mCmdHistoryCurrent][0];
|
||||
|
||||
|
||||
// if we just echoed the last command, hang out there, don't wrap around
|
||||
if (mCmdHistoryCurrent == mCmdHistoryEnd) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
// otherwise, back up by one
|
||||
RingBufferDecrement(&mCmdHistoryCurrent);
|
||||
|
||||
|
||||
} else if (Direction == SCAN_DOWN) {
|
||||
|
||||
|
||||
// if we last echoed the start command, put a blank prompt out
|
||||
if (mCmdHistoryCurrent == mCmdHistoryStart) {
|
||||
HistoricalCommand = mCmdBlank;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
// otherwise increment the current pointer and return that command
|
||||
RingBufferIncrement(&mCmdHistoryCurrent);
|
||||
RingBufferIncrement(&mCmdHistoryCurrent);
|
||||
|
||||
|
||||
HistoricalCommand = &mCmdHistory[mCmdHistoryCurrent][0];
|
||||
RingBufferDecrement(&mCmdHistoryCurrent);
|
||||
}
|
||||
|
||||
Exit:
|
||||
Exit:
|
||||
return HistoricalCommand;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ ParseArguments (
|
||||
} else if (*Char != ' ') {
|
||||
Argv[Arg++] = Char;
|
||||
LookingForArg = FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Looking for the terminator of an Argv[] entry
|
||||
if (!InQuote && (*Char == ' ')) {
|
||||
@@ -214,7 +214,7 @@ ParseArguments (
|
||||
*Char = '\0';
|
||||
InQuote = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*Argc = Arg;
|
||||
@@ -236,7 +236,7 @@ ParseArguments (
|
||||
|
||||
@param Key EFI Key information returned
|
||||
@param TimeoutInSec Number of seconds to wait to timeout
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
|
||||
@return EFI_SUCCESS Key was returned
|
||||
@return EFI_TIMEOUT If the TimoutInSec expired
|
||||
@@ -275,15 +275,15 @@ EblGetCharKey (
|
||||
if (WaitCount == 2) {
|
||||
gBS->CloseEvent (WaitList[1]);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Periodic 1 sec timer signaled
|
||||
// Periodic 1 sec timer signaled
|
||||
TimeoutInSec--;
|
||||
if (CallBack != NULL) {
|
||||
// Call the users callback function if registered
|
||||
// Call the users callback function if registered
|
||||
CallBack (TimeoutInSec);
|
||||
}
|
||||
if (TimeoutInSec == 0) {
|
||||
@@ -294,7 +294,7 @@ EblGetCharKey (
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ EblGetCharKey (
|
||||
If the use hits Q to quit return TRUE else for any other key return FALSE.
|
||||
PrefixNewline is used to figure out if a newline is needed before the prompt
|
||||
string. This depends on the last print done before calling this function.
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
needed.
|
||||
|
||||
@param CurrentRow Used to figure out if its the end of the page and updated
|
||||
@@ -349,7 +349,7 @@ EblAnyKeyToContinueQtoQuit (
|
||||
|
||||
|
||||
/**
|
||||
Set the text color of the EFI Console. If a zero is passed in reset to
|
||||
Set the text color of the EFI Console. If a zero is passed in reset to
|
||||
default text/background color.
|
||||
|
||||
@param Attribute For text and background color
|
||||
@@ -372,12 +372,12 @@ EblSetTextColor (
|
||||
/**
|
||||
Collect the keyboard input for a cmd line. Carriage Return, New Line, or ESC
|
||||
terminates the command line. You can edit the command line via left arrow,
|
||||
delete and backspace and they all back up and erase the command line.
|
||||
delete and backspace and they all back up and erase the command line.
|
||||
No edit of command line is possible without deletion at this time!
|
||||
The up arrow and down arrow fill Cmd with information from the history
|
||||
The up arrow and down arrow fill Cmd with information from the history
|
||||
buffer.
|
||||
|
||||
@param Cmd Command line to return
|
||||
@param Cmd Command line to return
|
||||
@param CmdMaxSize Maximum size of Cmd
|
||||
|
||||
@return The Status of EblGetCharKey()
|
||||
@@ -462,9 +462,9 @@ EblPrintStartupBanner (
|
||||
|
||||
/**
|
||||
Send null requests to all removable media block IO devices so the a media add/remove/change
|
||||
can be detected in real before we execute a command.
|
||||
can be detected in real before we execute a command.
|
||||
|
||||
This is mainly due to the fact that the FAT driver does not do this today so you can get stale
|
||||
This is mainly due to the fact that the FAT driver does not do this today so you can get stale
|
||||
dir commands after an SD Card has been removed.
|
||||
**/
|
||||
VOID
|
||||
@@ -521,7 +521,7 @@ EblPrompt (
|
||||
commands returns an error.
|
||||
|
||||
@param CmdLine Command Line to process.
|
||||
@param MaxCmdLineSize MaxSize of the Command line
|
||||
@param MaxCmdLineSize MaxSize of the Command line
|
||||
|
||||
@return EFI status of the Command
|
||||
|
||||
@@ -559,17 +559,17 @@ ProcessCmdLine (
|
||||
}
|
||||
} else {
|
||||
AsciiPrint ("The command '%a' is not supported.\n", Argv[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
|
||||
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
|
||||
devices. PcdEmbeddedAutomaticBootCommand is a complied in command line that
|
||||
gets executed automatically. The ; separator allows multiple commands
|
||||
for each command line.
|
||||
@@ -585,7 +585,7 @@ EFIAPI
|
||||
EdkBootLoaderEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 CmdLine[MAX_CMD_LINE];
|
||||
@@ -605,7 +605,7 @@ EdkBootLoaderEntry (
|
||||
EblInitializeExternalCmd ();
|
||||
EblInitializeNetworkCmd();
|
||||
EblInitializeVariableCmds ();
|
||||
|
||||
|
||||
if (gST->ConOut == NULL) {
|
||||
DEBUG((EFI_D_ERROR,"Error: No Console Output\n"));
|
||||
return EFI_NOT_READY;
|
||||
@@ -628,29 +628,29 @@ EdkBootLoaderEntry (
|
||||
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &gScreenColumns, &gScreenRows);
|
||||
|
||||
EblPrintStartupBanner ();
|
||||
|
||||
|
||||
// Parse command line and handle commands separated by ;
|
||||
// The loop prints the prompt gets user input and saves history
|
||||
|
||||
|
||||
// Look for a variable with a default command line, otherwise use the Pcd
|
||||
ZeroMem(&VendorGuid, sizeof(EFI_GUID));
|
||||
|
||||
Status = gRT->GetVariable(CommandLineVariableName, &VendorGuid, NULL, &CommandLineVariableSize, CommandLineVariable);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
CommandLineVariable = AllocatePool(CommandLineVariableSize);
|
||||
|
||||
|
||||
Status = gRT->GetVariable(CommandLineVariableName, &VendorGuid, NULL, &CommandLineVariableSize, CommandLineVariable);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
UnicodeStrToAsciiStr(CommandLineVariable, CmdLine);
|
||||
}
|
||||
|
||||
|
||||
FreePool(CommandLineVariable);
|
||||
}
|
||||
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiStrCpy (CmdLine, (CHAR8 *)PcdGetPtr (PcdEmbeddedAutomaticBootCommand));
|
||||
}
|
||||
|
||||
|
||||
for (;;) {
|
||||
Status = ProcessCmdLine (CmdLine, MAX_CMD_LINE);
|
||||
if (Status == EFI_ABORTED) {
|
||||
|
@@ -28,7 +28,7 @@ ParseIp (
|
||||
Address->v4.Addr[2] = (UINT8)AsciiStrDecimalToUintn (String);
|
||||
String = AsciiStrStr(String, ".") + 1;
|
||||
Address->v4.Addr[3] = (UINT8)AsciiStrDecimalToUintn (String);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -41,28 +41,28 @@ EblIpCmd (
|
||||
EFI_STATUS Status = EFI_INVALID_PARAMETER;
|
||||
EFI_MAC_ADDRESS Mac;
|
||||
EFI_IP_ADDRESS Ip;
|
||||
|
||||
if (Argc == 1) {
|
||||
|
||||
if (Argc == 1) {
|
||||
// Get current IP/MAC
|
||||
|
||||
|
||||
// Get current MAC address
|
||||
Status = EblGetCurrentMacAddress (&Mac);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
AsciiPrint ("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", Mac.Addr[0], Mac.Addr[1], Mac.Addr[2], Mac.Addr[3], Mac.Addr[4], Mac.Addr[5]);
|
||||
|
||||
|
||||
// Get current IP address
|
||||
Status = EblGetCurrentIpAddress (&Ip);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("IP Address is not configured.\n");
|
||||
Status = EFI_SUCCESS;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
AsciiPrint("IP Address: %d.%d.%d.%d\n", Ip.v4.Addr[0], Ip.v4.Addr[1],Ip.v4.Addr[2], Ip.v4.Addr[3]);
|
||||
|
||||
|
||||
} else if ((Argv[1][0] == 'r') && (Argc == 2)) {
|
||||
// Get new address via dhcp
|
||||
Status = EblPerformDHCP (TRUE);
|
||||
@@ -72,10 +72,10 @@ EblIpCmd (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
Status = EblSetStationIp (&Ip, NULL);
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
return Status;
|
||||
}
|
||||
|
@@ -21,13 +21,13 @@
|
||||
|
||||
/**
|
||||
Execute the passed in file like a series of commands. The ; can be used on
|
||||
a single line to indicate multiple commands per line. The Ascii text file
|
||||
can contain any number of lines. The following line termination forms are
|
||||
a single line to indicate multiple commands per line. The Ascii text file
|
||||
can contain any number of lines. The following line termination forms are
|
||||
supported:
|
||||
LF : Unix, Mac OS X*, BeOS
|
||||
CR+LF: MS-DOS*, Microsoft Windows*
|
||||
CR : Commodore, Apple II, and really Mac OS
|
||||
LF+CR: for simplicity and completeness
|
||||
LF+CR: for simplicity and completeness
|
||||
|
||||
Argv[0] - "script"
|
||||
Argv[1] - Device Name:path for the file to load
|
||||
@@ -35,7 +35,7 @@
|
||||
script fv1:\script.txt
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -54,8 +54,8 @@ EblScriptCmd (
|
||||
CHAR8 *Ptr;
|
||||
CHAR8 *ScanPtr;
|
||||
UINTN CmdLineSize;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (Argc < 2) {
|
||||
// file name required
|
||||
@@ -85,15 +85,15 @@ EblScriptCmd (
|
||||
CmdLineSize++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Status = ProcessCmdLine (Ptr, CmdLineSize);
|
||||
}
|
||||
|
||||
|
||||
FreePool (Address);
|
||||
}
|
||||
|
||||
|
||||
EfiClose (File);
|
||||
return Status;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ EblScriptCmd (
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mScriptTemplate[] = {
|
||||
{
|
||||
"script",
|
||||
" device:path; load an ascii file and execute it like commands",
|
||||
" device:path; load an ascii file and execute it like commands",
|
||||
NULL,
|
||||
EblScriptCmd
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -113,7 +113,7 @@ EblSetCmd (
|
||||
AsciiPrint("Variable name is missing.\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
// Check if it is a valid variable setting
|
||||
AsciiValue = AsciiStrStr (AsciiVariableSetting,"=");
|
||||
if (AsciiValue == NULL) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/** @file
|
||||
Glue code that contains the EFI entry point and converts it to an EBL
|
||||
Glue code that contains the EFI entry point and converts it to an EBL
|
||||
ASCII Argc, Argv sytle entry point
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ ParseArguments (
|
||||
} else if (*Char != ' ') {
|
||||
Argv[Arg++] = Char;
|
||||
LookingForArg = FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Looking for the terminator of an Argv[] entry
|
||||
if ((InQuote && (*Char == '"')) || (!InQuote && (*Char == ' '))) {
|
||||
@@ -112,12 +112,12 @@ ParseArguments (
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
|
||||
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
|
||||
devices. PcdEmbeddedAutomaticBootCommand is a complied in command line that
|
||||
gets executed automatically. The ; separator allows multiple commands
|
||||
for each command line.
|
||||
@@ -133,7 +133,7 @@ EFIAPI
|
||||
EdkExternCmdEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
|
||||
@@ -144,10 +144,10 @@ EdkExternCmdEntry (
|
||||
if (EFI_ERROR (Status)) {
|
||||
Argc = 0;
|
||||
} else {
|
||||
// Looks like valid commands were passed in.
|
||||
// Looks like valid commands were passed in.
|
||||
ParseArguments (ImageInfo->LoadOptions, ImageInfo->LoadOptionsSize, &Argc, Argv);
|
||||
}
|
||||
|
||||
|
||||
return EblMain (Argc, Argv);
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/** @file
|
||||
Example of an external EBL command. It's loaded via EBL start command.
|
||||
Example of an external EBL command. It's loaded via EBL start command.
|
||||
Argc and Argv are passed in via "" of the EBL command line.
|
||||
|
||||
Start fs0:\EdkExternCmd.efi "Argv[0] Argv[1] 2"
|
||||
|
||||
will launch this command with
|
||||
will launch this command with
|
||||
Argv[0] = "Argv[0]"
|
||||
Argv[1] = "Argv[2]"
|
||||
Argv[2] = "3"
|
||||
@@ -29,7 +29,7 @@
|
||||
Entry point with Argc, Argv. Put your code here.
|
||||
|
||||
@param Argc Number of command arguments in Argv
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
@param Argv Array of strings that represent the parsed command line.
|
||||
Argv[0] is the command name
|
||||
|
||||
@return EFI_SUCCESS
|
||||
@@ -47,7 +47,7 @@ EblMain (
|
||||
for (Index = 0; Index < Argc; Index++) {
|
||||
AsciiPrint ("Argv[%d] = %a\n", Index, Argv[Index]);
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -32,7 +32,7 @@ GetNextMonotonicCount (
|
||||
if (Count == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
*Count = gCurrentMonotonicCount++;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -46,9 +46,9 @@ GetNextHighMonotonicCount (
|
||||
if (HighCount == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
gCurrentMonotonicCount += 0x0000000100000000ULL;
|
||||
|
||||
|
||||
*HighCount = (UINT32)RShiftU64 (gCurrentMonotonicCount, 32) & 0xFFFFFFFF;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
|
@@ -75,7 +75,7 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE|BOOLEAN|0x00000006
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|FALSE|BOOLEAN|0x00000041
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable|TRUE|BOOLEAN|0x00000052
|
||||
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|FALSE|BOOLEAN|0x0000001b
|
||||
gEmbeddedTokenSpaceGuid.PcdCacheEnable|FALSE|BOOLEAN|0x00000042
|
||||
gEmbeddedTokenSpaceGuid.PcdGdbSerial|FALSE|BOOLEAN|0x00000053
|
||||
@@ -90,14 +90,14 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|131072|UINT32|0x00000040
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0|UINT32|0x0000000b
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|131072|UINT32|0x0000000c
|
||||
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdMemoryBase|0x0|UINT32|0x0000004e
|
||||
gEmbeddedTokenSpaceGuid.PcdMemorySize|0x0|UINT32|0x0000004f
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|0x0|UINT32|0x00000043
|
||||
gEmbeddedTokenSpaceGuid.PcdFlashFvMainOffset|0x0|UINT32|0x00000044
|
||||
gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize|0x0|UINT32|0x00000045
|
||||
|
||||
|
||||
# Used to help reduce fragmentation in the EFI memory map
|
||||
# EFI Pages (4K) are the units used
|
||||
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0|UINT32|0x00000012
|
||||
@@ -116,7 +116,7 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress|0x38e00000|UINT32|0x0000001f
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|100|UINT32|0x00000020
|
||||
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress|0xffff0000|UINT32|0x00000030
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize|0x0000000|UINT32|0x00000031
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|0x0000000|UINT64|0x00000032
|
||||
|
@@ -50,7 +50,7 @@
|
||||
# DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
|
||||
|
||||
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
|
||||
@@ -58,17 +58,17 @@
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
|
||||
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
|
||||
|
||||
|
||||
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
|
||||
|
||||
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
|
||||
|
||||
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
|
||||
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
|
||||
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
|
||||
|
||||
|
||||
SerialPortLib|EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
|
||||
SerialPortExtLib|EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.inf
|
||||
RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
|
||||
@@ -80,7 +80,7 @@
|
||||
# Need to change this for IPF
|
||||
#
|
||||
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
|
||||
|
||||
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
@@ -103,7 +103,7 @@
|
||||
# Networking Requirements
|
||||
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
@@ -117,7 +117,7 @@
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
|
||||
|
||||
[LibraryClasses.common.SEC]
|
||||
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
|
||||
|
||||
@@ -146,11 +146,11 @@
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|FALSE
|
||||
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|FALSE
|
||||
|
||||
|
||||
#
|
||||
# Control what commands are supported from the UI
|
||||
# Turn these on and off to add features or save size
|
||||
#
|
||||
#
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
|
||||
@@ -158,7 +158,7 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
|
||||
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|FALSE
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|L""
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
|
||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
|
||||
|
||||
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0
|
||||
@@ -190,8 +190,8 @@
|
||||
#
|
||||
# Optinal feature to help prevent EFI memory map fragments
|
||||
# Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
|
||||
# Values are in EFI Pages (4K). DXE Core will make sure that
|
||||
# at least this much of each type of memory can be allocated
|
||||
# Values are in EFI Pages (4K). DXE Core will make sure that
|
||||
# at least this much of each type of memory can be allocated
|
||||
# from a single memory range. This way you only end up with
|
||||
# maximum of two fragements for each type in the memory map
|
||||
# (the memory used, and the free memory that was prereserved
|
||||
@@ -235,11 +235,11 @@
|
||||
#
|
||||
################################################################################
|
||||
[Components.common]
|
||||
EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
|
||||
EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
|
||||
EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
|
||||
EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
|
||||
EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.inf
|
||||
EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf
|
||||
EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.inf
|
||||
EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf
|
||||
EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
|
||||
EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
|
||||
EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.inf
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# This is Ebl FDF file
|
||||
# This is Ebl FDF file
|
||||
#
|
||||
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
@@ -51,21 +51,21 @@ READ_LOCK_STATUS = TRUE
|
||||
#
|
||||
################################################################################
|
||||
INF EmbeddedPkg/Ebl/Ebl.inf
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
#
|
||||
# Rules are use with the [FV] section's module INF type to define
|
||||
# how an FFS file is created for a given INF file. The following Rule are the default
|
||||
# rules for the different module type. User can add the customized rules to define the
|
||||
# content of the FFS file.
|
||||
#
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
############################################################################
|
||||
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
|
||||
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
|
||||
############################################################################
|
||||
#
|
||||
#
|
||||
#[Rule.Common.DXE_DRIVER]
|
||||
# FILE DRIVER = $(NAMED_GUID) {
|
||||
# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
@@ -88,14 +88,14 @@ INF EmbeddedPkg/Ebl/Ebl.inf
|
||||
[Rule.Common.PEI_CORE]
|
||||
FILE PEI_CORE = $(NAMED_GUID) {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING ="$(MODULE_NAME)" Optional
|
||||
UI STRING ="$(MODULE_NAME)" Optional
|
||||
}
|
||||
|
||||
[Rule.Common.PEIM]
|
||||
FILE PEIM = $(NAMED_GUID) {
|
||||
PEI_DEPEX PEI_DEPEX Optional $(MODULE_NAME).depex
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
}
|
||||
|
||||
[Rule.Common.PEIM.TIANOCOMPRESSED]
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -23,10 +23,10 @@
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_ARM_SOFTWARE_INTERRUPT, GDB_SIGTRAP }
|
||||
// { EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },
|
||||
// { EXCEPT_ARM_PREFETCH_ABORT, GDB_SIGTRAP },
|
||||
// { EXCEPT_ARM_DATA_ABORT, GDB_SIGEMT },
|
||||
// { EXCEPT_ARM_RESERVED, GDB_SIGILL }
|
||||
// { EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },
|
||||
// { EXCEPT_ARM_PREFETCH_ABORT, GDB_SIGTRAP },
|
||||
// { EXCEPT_ARM_DATA_ABORT, GDB_SIGEMT },
|
||||
// { EXCEPT_ARM_RESERVED, GDB_SIGILL }
|
||||
};
|
||||
|
||||
// Shut up some annoying RVCT warnings
|
||||
@@ -86,8 +86,8 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -100,8 +100,8 @@ MaxEfiException (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gRegisters[]
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxRegisterCount (
|
||||
@@ -113,10 +113,10 @@ MaxRegisterCount (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
@retval TRUE if Isa is supported
|
||||
@retval TRUE if Isa is supported
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -135,14 +135,14 @@ CheckIsa (
|
||||
/**
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the ARM member
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -168,7 +168,7 @@ BasicReadRegister (
|
||||
{
|
||||
UINTN RegSize;
|
||||
CHAR8 Char;
|
||||
|
||||
|
||||
if (gRegisterOffsets[RegNumber] > 0xF00) {
|
||||
AsciiSPrint (OutBufPtr, 9, "00000000");
|
||||
OutBufPtr += 8;
|
||||
@@ -182,13 +182,13 @@ BasicReadRegister (
|
||||
Char = Char - 'A' + 'a';
|
||||
}
|
||||
*OutBufPtr++ = Char;
|
||||
|
||||
|
||||
Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
|
||||
if ((Char >= 'A') && (Char <= 'F')) {
|
||||
Char = Char - 'A' + 'a';
|
||||
}
|
||||
*OutBufPtr++ = Char;
|
||||
|
||||
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
return OutBufPtr;
|
||||
@@ -196,7 +196,7 @@ BasicReadRegister (
|
||||
|
||||
|
||||
/**
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
**/
|
||||
@@ -209,29 +209,29 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[9]; // 1 reg=8 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
|
||||
if (RegNumber >= MaxRegisterCount ()) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket (OutBuffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
@@ -239,14 +239,14 @@ ReadGeneralRegisters (
|
||||
CHAR8 *OutBuffer;
|
||||
CHAR8 *OutBufPtr;
|
||||
UINTN RegisterCount = MaxRegisterCount ();
|
||||
|
||||
|
||||
// It is not safe to allocate pool here....
|
||||
OutBuffer = AllocatePool ((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
|
||||
OutBufPtr = OutBuffer;
|
||||
for (Index = 0; Index < RegisterCount; Index++) {
|
||||
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);
|
||||
}
|
||||
|
||||
|
||||
*OutBufPtr = '\0';
|
||||
SendPacket (OutBuffer);
|
||||
FreePool (OutBuffer);
|
||||
@@ -270,7 +270,7 @@ CHAR8
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT32 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
if (gRegisterOffsets[RegNumber] > 0xF00) {
|
||||
return InBufPtr + 8;
|
||||
}
|
||||
@@ -279,21 +279,21 @@ CHAR8
|
||||
RegSize = 0;
|
||||
while (RegSize < 32) {
|
||||
TempValue = HexCharToInt (*InBufPtr++);
|
||||
|
||||
|
||||
if ((INTN)TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt (*InBufPtr++);
|
||||
|
||||
|
||||
if ((INTN)TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
|
||||
@@ -316,19 +316,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if (RegNumber >= MaxRegisterCount ()) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -356,21 +356,21 @@ WriteGeneralRegisters (
|
||||
UINTN RegisterCount = MaxRegisterCount ();
|
||||
|
||||
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format
|
||||
|
||||
|
||||
if (AsciiStrLen (InBuffer) < MinLength) {
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for (i = 0; i < RegisterCount; i++) {
|
||||
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
|
||||
}
|
||||
|
||||
|
||||
SendSuccess ();
|
||||
}
|
||||
|
||||
@@ -395,9 +395,9 @@ typedef struct {
|
||||
|
||||
LIST_ENTRY BreakpointList;
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -410,11 +410,11 @@ AddSingleStep (
|
||||
return;
|
||||
}
|
||||
mSingleStepActive = TRUE;
|
||||
|
||||
|
||||
mSingleStepPC = SystemContext.SystemContextArm->PC;
|
||||
|
||||
mSingleStepDataSize = sizeof (UINT32);
|
||||
mSingleStepData = (*(UINT32 *)mSingleStepPC);
|
||||
mSingleStepData = (*(UINT32 *)mSingleStepPC);
|
||||
*(UINT32 *)mSingleStepPC = GDB_ARM_BKPT;
|
||||
if (*(UINT32 *)mSingleStepPC != GDB_ARM_BKPT) {
|
||||
// For some reason our breakpoint did not take
|
||||
@@ -425,10 +425,10 @@ AddSingleStep (
|
||||
//DEBUG((EFI_D_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -439,7 +439,7 @@ RemoveSingleStep (
|
||||
if (!mSingleStepActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mSingleStepDataSize == sizeof (UINT16)) {
|
||||
*(UINT16 *)mSingleStepPC = (UINT16)mSingleStepData;
|
||||
} else {
|
||||
@@ -453,10 +453,10 @@ RemoveSingleStep (
|
||||
|
||||
|
||||
/**
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -467,15 +467,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextArm->PC = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -554,7 +554,7 @@ SetBreakpoint (
|
||||
Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;
|
||||
Breakpoint->Address = Address;
|
||||
Breakpoint->Instruction = *(UINT32 *)Address;
|
||||
|
||||
|
||||
// Add it to the list
|
||||
InsertTailList (&BreakpointList, &Breakpoint->Link);
|
||||
|
||||
@@ -645,7 +645,7 @@ RemoveBreakPoint (
|
||||
switch (Type) {
|
||||
case 0: //Software breakpoint
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
SendError (GDB_EINVALIDBRKPOINTTYPE);
|
||||
return;
|
||||
@@ -679,13 +679,13 @@ ValidateAddress (
|
||||
|
||||
BOOLEAN
|
||||
ValidateException (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINT32 ExceptionAddress;
|
||||
UINT32 Instruction;
|
||||
|
||||
|
||||
// Is it a debugger SWI?
|
||||
ExceptionAddress = SystemContext.SystemContextArm->PC -= 4;
|
||||
Instruction = *(UINT32 *)ExceptionAddress;
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/** @file
|
||||
UEFI driver that implements a GDB stub
|
||||
|
||||
|
||||
Note: Any code in the path of the Serial IO output can not call DEBUG as will
|
||||
will blow out the stack. Serial IO calls DEBUG, debug calls Serail IO, ...
|
||||
|
||||
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -29,7 +29,7 @@ UINTN gMaxProcessorIndex = 0;
|
||||
CHAR8 gInBuffer[MAX_BUF_SIZE];
|
||||
CHAR8 gOutBuffer[MAX_BUF_SIZE];
|
||||
|
||||
// Assume gdb does a "qXfer:libraries:read::offset,length" when it connects so we can default
|
||||
// Assume gdb does a "qXfer:libraries:read::offset,length" when it connects so we can default
|
||||
// this value to FALSE. Since gdb can reconnect its self a global default is not good enough
|
||||
BOOLEAN gSymbolTableUpdate = FALSE;
|
||||
EFI_EVENT gEvent;
|
||||
@@ -59,12 +59,12 @@ GdbSymbolEventHandler (
|
||||
|
||||
/**
|
||||
The user Entry Point for Application. The user code starts with this function
|
||||
as the real entry point for the image goes into a library that calls this
|
||||
as the real entry point for the image goes into a library that calls this
|
||||
function.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||
@retval other Some error occurs when executing this entry point.
|
||||
|
||||
@@ -76,7 +76,7 @@ GdbStubEntry (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *Handles;
|
||||
@@ -101,7 +101,7 @@ GdbStubEntry (
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
DebugSupport = NULL;
|
||||
IsaSupported = FALSE;
|
||||
do {
|
||||
@@ -120,19 +120,19 @@ GdbStubEntry (
|
||||
}
|
||||
} while (HandleCount > 0);
|
||||
FreePool (Handles);
|
||||
|
||||
|
||||
if (!IsaSupported) {
|
||||
DEBUG ((EFI_D_ERROR, "Debug Support Protocol does not support our ISA\n"));
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
Status = DebugSupport->GetMaximumProcessorIndex (DebugSupport, &gMaxProcessorIndex);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
DEBUG ((EFI_D_INFO, "Debug Support Protocol ISA %x\n", DebugSupport->Isa));
|
||||
DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
|
||||
|
||||
|
||||
// Call processor-specific init routine
|
||||
InitializeProcessor ();
|
||||
|
||||
@@ -147,10 +147,10 @@ GdbStubEntry (
|
||||
Status = DebugSupport->RegisterPeriodicCallback (DebugSupport, Processor, GdbPeriodicCallBack);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This even fires every time an image is added. This allows the stub to know when gdb needs
|
||||
// to update the symbol table.
|
||||
// to update the symbol table.
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
@@ -171,11 +171,11 @@ GdbStubEntry (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
|
||||
if (PcdGetBool (PcdGdbSerial)) {
|
||||
GdbInitializeSerialConsole ();
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -196,14 +196,14 @@ TransferFromInBufToMem (
|
||||
{
|
||||
CHAR8 c1;
|
||||
CHAR8 c2;
|
||||
|
||||
|
||||
while (Length-- > 0) {
|
||||
c1 = (CHAR8)HexCharToInt (*NewData++);
|
||||
c2 = (CHAR8)HexCharToInt (*NewData++);
|
||||
|
||||
if ((c1 < 0) || (c2 < 0)) {
|
||||
Print ((CHAR16 *)L"Bad message from write to memory..\n");
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return;
|
||||
}
|
||||
*Address++ = (UINT8)((c1 << 4) + c2);
|
||||
@@ -239,7 +239,7 @@ TransferFromMemToOutBufAndSend (
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
while (Length > 0) {
|
||||
|
||||
|
||||
Char = mHexToStr[*Address >> 4];
|
||||
if ((Char >= 'A') && (Char <= 'F')) {
|
||||
Char = Char - 'A' + 'a';
|
||||
@@ -264,16 +264,16 @@ TransferFromMemToOutBufAndSend (
|
||||
|
||||
/**
|
||||
Send a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
in an infinit loop. This is so if you unplug the debugger code just keeps running
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
|
||||
|
||||
@retval Number of bytes of packet data sent.
|
||||
|
||||
**/
|
||||
@@ -287,7 +287,7 @@ SendPacket (
|
||||
CHAR8 *Ptr;
|
||||
CHAR8 TestChar;
|
||||
UINTN Count;
|
||||
|
||||
|
||||
Timeout = PcdGet32 (PcdGdbMaxPacketRetryCount);
|
||||
|
||||
Count = 0;
|
||||
@@ -299,38 +299,38 @@ SendPacket (
|
||||
// Only try a finite number of times so we don't get stuck in the loop
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
// Packet prefix
|
||||
GdbPutChar ('$');
|
||||
|
||||
|
||||
for (CheckSum = 0, Count =0 ; *Ptr != '\0'; Ptr++, Count++) {
|
||||
GdbPutChar (*Ptr);
|
||||
CheckSum = CheckSum + *Ptr;
|
||||
}
|
||||
|
||||
// Packet terminating character and checksum
|
||||
|
||||
// Packet terminating character and checksum
|
||||
GdbPutChar ('#');
|
||||
GdbPutChar (mHexToStr[CheckSum >> 4]);
|
||||
GdbPutChar (mHexToStr[CheckSum & 0x0F]);
|
||||
|
||||
|
||||
TestChar = GdbGetChar ();
|
||||
} while (TestChar != '+');
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
/**
|
||||
Receive a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
|
||||
If host re-starts sending a packet without ending the previous packet, only the last valid packet is proccessed.
|
||||
(In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)
|
||||
|
||||
|
||||
If an ack '+' is not sent resend the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data received.
|
||||
|
||||
@@ -346,16 +346,16 @@ ReceivePacket (
|
||||
CHAR8 Char;
|
||||
CHAR8 SumString[3];
|
||||
CHAR8 TestChar;
|
||||
|
||||
|
||||
ZeroMem (PacketData, PacketDataSize);
|
||||
|
||||
|
||||
for (;;) {
|
||||
// wait for the start of a packet
|
||||
TestChar = GdbGetChar ();
|
||||
while (TestChar != '$') {
|
||||
TestChar = GdbGetChar ();
|
||||
};
|
||||
|
||||
|
||||
retry:
|
||||
for (Index = 0, CheckSum = 0; Index < (PacketDataSize - 1); Index++) {
|
||||
Char = GdbGetChar ();
|
||||
@@ -375,14 +375,14 @@ ReceivePacket (
|
||||
continue;
|
||||
}
|
||||
|
||||
SumString[0] = GdbGetChar ();
|
||||
SumString[0] = GdbGetChar ();
|
||||
SumString[1] = GdbGetChar ();
|
||||
SumString[2] = '\0';
|
||||
|
||||
|
||||
if (AsciiStrHexToUintn (SumString) == CheckSum) {
|
||||
// Ack: Success
|
||||
GdbPutChar ('+');
|
||||
|
||||
|
||||
// Null terminate the callers string
|
||||
PacketData[Index] = '\0';
|
||||
return Index;
|
||||
@@ -391,27 +391,27 @@ ReceivePacket (
|
||||
GdbPutChar ('-');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Empties the given buffer
|
||||
Empties the given buffer
|
||||
@param Buf pointer to the first element in buffer to be emptied
|
||||
**/
|
||||
VOID
|
||||
EmptyBuffer (
|
||||
EmptyBuffer (
|
||||
IN CHAR8 *Buf
|
||||
)
|
||||
{
|
||||
{
|
||||
*Buf = '\0';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts an 8-bit Hex Char into a INTN.
|
||||
|
||||
|
||||
@param Char the hex character to be converted into UINTN
|
||||
@retval a INTN, from 0 to 15, that corressponds to Char
|
||||
-1 if Char is not a hex character
|
||||
@@ -428,7 +428,7 @@ HexCharToInt (
|
||||
} else if ((Char >= '0') && (Char <= '9')) {
|
||||
return Char - '0';
|
||||
} else { // if not a hex value, return a negative value
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ CHAR8 *gError = "E__";
|
||||
Send an error with the given error number after converting to hex.
|
||||
The error number is put into the buffer in hex. '255' is the biggest errno we can send.
|
||||
ex: 162 will be sent as A2.
|
||||
|
||||
|
||||
@param errno the error number that will be sent
|
||||
**/
|
||||
VOID
|
||||
@@ -453,7 +453,7 @@ SendError (
|
||||
//
|
||||
gError[1] = mHexToStr [ErrorNum >> 4];
|
||||
gError[2] = mHexToStr [ErrorNum & 0x0f];
|
||||
|
||||
|
||||
SendPacket (gError); // send buffer
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ VOID
|
||||
EFIAPI
|
||||
SendSuccess (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
SendPacket ("OK"); // send buffer
|
||||
}
|
||||
@@ -475,11 +475,11 @@ SendSuccess (
|
||||
/**
|
||||
Send empty packet to specify that particular command/functionality is not supported.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
VOID
|
||||
EFIAPI
|
||||
SendNotSupported (
|
||||
VOID
|
||||
)
|
||||
VOID
|
||||
)
|
||||
{
|
||||
SendPacket ("");
|
||||
}
|
||||
@@ -487,7 +487,7 @@ SendNotSupported (
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -513,9 +513,9 @@ GdbSendTSignal (
|
||||
//
|
||||
// replace _, or previous value, with Exception type
|
||||
//
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType >> 4];
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType >> 4];
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType & 0x0f];
|
||||
|
||||
|
||||
if (GdbExceptionType == GDB_SIGTRAP) {
|
||||
if (gSymbolTableUpdate) {
|
||||
//
|
||||
@@ -531,17 +531,17 @@ GdbSendTSignal (
|
||||
|
||||
//
|
||||
// possible n:r pairs
|
||||
//
|
||||
//
|
||||
|
||||
//Retrieve the breakpoint number
|
||||
BreakpointDetected = GetBreakpointDetected (SystemContext);
|
||||
|
||||
//Figure out if the exception is happend due to watch, rwatch or awatch.
|
||||
BreakType = GetBreakpointType (SystemContext, BreakpointDetected);
|
||||
BreakType = GetBreakpointType (SystemContext, BreakpointDetected);
|
||||
|
||||
//INFO: rwatch is not supported due to the way IA32 debug registers work
|
||||
if ((BreakType == DataWrite) || (BreakType == DataRead) || (BreakType == DataReadWrite)) {
|
||||
|
||||
|
||||
//Construct n:r pair
|
||||
DataAddress = GetBreakpointDataAddress (SystemContext, BreakpointDetected);
|
||||
|
||||
@@ -559,7 +559,7 @@ GdbSendTSignal (
|
||||
}
|
||||
|
||||
*TSignalPtr++ = ':';
|
||||
|
||||
|
||||
//Set up series of bytes in big-endian byte order. "awatch" won't work with little-endian byte order.
|
||||
RegSize = REG_SIZE;
|
||||
while (RegSize > 0) {
|
||||
@@ -575,23 +575,23 @@ GdbSendTSignal (
|
||||
|
||||
*TSignalPtr = '\0';
|
||||
|
||||
SendPacket (TSignalBuffer);
|
||||
SendPacket (TSignalBuffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Translates the EFI mapping to GDB mapping
|
||||
|
||||
|
||||
@param EFIExceptionType EFI Exception that is being processed
|
||||
@retval UINTN that corresponds to EFIExceptionType's GDB exception type number
|
||||
**/
|
||||
UINT8
|
||||
ConvertEFItoGDBtype (
|
||||
ConvertEFItoGDBtype (
|
||||
IN EFI_EXCEPTION_TYPE EFIExceptionType
|
||||
)
|
||||
{
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
|
||||
for (Index = 0; Index < MaxEfiException () ; Index++) {
|
||||
if (gExceptionType[Index].Exception == EFIExceptionType) {
|
||||
return gExceptionType[Index].SignalNo;
|
||||
@@ -602,8 +602,8 @@ ConvertEFItoGDBtype (
|
||||
|
||||
|
||||
/** "m addr,length"
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
send it as a packet.
|
||||
**/
|
||||
|
||||
@@ -618,39 +618,39 @@ ReadFromMemory (
|
||||
CHAR8 AddressBuffer[MAX_ADDR_SIZE]; // the buffer that will hold the address in hex chars
|
||||
CHAR8 *AddrBufPtr; // pointer to the address buffer
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
|
||||
AddrBufPtr = AddressBuffer;
|
||||
InBufPtr = &PacketData[1];
|
||||
while (*InBufPtr != ',') {
|
||||
*AddrBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*AddrBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ',' in the buffer
|
||||
|
||||
|
||||
/* Error checking */
|
||||
if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
|
||||
Print((CHAR16 *)L"Address is too long\n");
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 2 = 'm' + ','
|
||||
if (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
|
||||
Print((CHAR16 *)L"Length is too long\n");
|
||||
SendError (GDB_EBADMEMLENGTH);
|
||||
SendError (GDB_EBADMEMLENGTH);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Address = AsciiStrHexToUintn (AddressBuffer);
|
||||
Length = AsciiStrHexToUintn (InBufPtr);
|
||||
|
||||
|
||||
TransferFromMemToOutBufAndSend (Length, (unsigned char *)Address);
|
||||
}
|
||||
|
||||
|
||||
/** "M addr,length :XX..."
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
another function, TransferFromInBufToMem, that will write to that memory space the info in
|
||||
the input buffer.
|
||||
**/
|
||||
@@ -668,50 +668,50 @@ WriteToMemory (
|
||||
CHAR8 *AddrBufPtr; // pointer to the Address buffer
|
||||
CHAR8 *LengthBufPtr; // pointer to the Length buffer
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
|
||||
AddrBufPtr = AddressBuffer;
|
||||
LengthBufPtr = LengthBuffer;
|
||||
InBufPtr = &PacketData[1];
|
||||
|
||||
|
||||
while (*InBufPtr != ',') {
|
||||
*AddrBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*AddrBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ',' in the buffer
|
||||
|
||||
|
||||
while (*InBufPtr != ':') {
|
||||
*LengthBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*LengthBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ':' in the buffer
|
||||
|
||||
|
||||
Address = AsciiStrHexToUintn (AddressBuffer);
|
||||
Length = AsciiStrHexToUintn (LengthBuffer);
|
||||
|
||||
|
||||
/* Error checking */
|
||||
|
||||
|
||||
//Check if Address is not too long.
|
||||
if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
|
||||
Print ((CHAR16 *)L"Address too long..\n");
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Check if message length is not too long
|
||||
if (AsciiStrLen (LengthBuffer) >= MAX_LENGTH_SIZE) {
|
||||
Print ((CHAR16 *)L"Length too long..\n");
|
||||
SendError (GDB_EBADMEMLENGBUFSIZE);
|
||||
SendError (GDB_EBADMEMLENGBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if Message is not too long/short.
|
||||
// 3 = 'M' + ',' + ':'
|
||||
MessageLength = (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - AsciiStrLen (LengthBuffer) - 3);
|
||||
if (MessageLength != (2*Length)) {
|
||||
//Message too long/short. New data is not the right size.
|
||||
SendError (GDB_EBADMEMDATASIZE);
|
||||
SendError (GDB_EBADMEMDATASIZE);
|
||||
return;
|
||||
}
|
||||
TransferFromInBufToMem (Length, (unsigned char *)Address, InBufPtr);
|
||||
@@ -800,7 +800,7 @@ gXferObjectReadResponse (
|
||||
*OutBufPtr++ = Type;
|
||||
Count = 1;
|
||||
|
||||
// Binary data encoding
|
||||
// Binary data encoding
|
||||
OutBufPtr = gOutBuffer;
|
||||
while (*Str != '\0') {
|
||||
Char = *Str++;
|
||||
@@ -816,17 +816,17 @@ gXferObjectReadResponse (
|
||||
|
||||
*OutBufPtr = '\0' ; // the end of the buffer
|
||||
SendPacket (gOutBuffer);
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Note: This should be a library function. In the Apple case you have to add
|
||||
the size of the PE/COFF header into the starting address to make things work
|
||||
Note: This should be a library function. In the Apple case you have to add
|
||||
the size of the PE/COFF header into the starting address to make things work
|
||||
right as there is no way to pad the Mach-O for the size of the PE/COFF header.
|
||||
|
||||
|
||||
|
||||
|
||||
Returns a pointer to the PDB file name for a PE/COFF image that has been
|
||||
loaded into system memory with the PE/COFF Loader Library functions.
|
||||
|
||||
@@ -844,7 +844,7 @@ gXferObjectReadResponse (
|
||||
|
||||
@return The PDB file name for the PE/COFF image specified by Pe32Data or NULL
|
||||
if it cannot be retrieved. DebugBase is only valid if PDB file name is
|
||||
valid.
|
||||
valid.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
@@ -895,14 +895,14 @@ PeCoffLoaderGetDebuggerInfo (
|
||||
TEImageAdjust);
|
||||
}
|
||||
SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
|
||||
|
||||
|
||||
// __APPLE__ check this math...
|
||||
*DebugBase = ((CHAR8 *)Pe32Data) - TEImageAdjust;
|
||||
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
||||
|
||||
|
||||
*DebugBase = Pe32Data;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// NOTE: We use Machine field to identify PE32/PE32+, instead of Magic.
|
||||
// It is due to backward-compatibility, for some system might
|
||||
@@ -983,38 +983,38 @@ PeCoffLoaderGetDebuggerInfo (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Process "qXfer:object:read:annex:offset,length" request.
|
||||
|
||||
Returns an XML document that contains loaded libraries. In our case it is
|
||||
|
||||
Returns an XML document that contains loaded libraries. In our case it is
|
||||
information in the EFI Debug Image Table converted into an XML document.
|
||||
|
||||
GDB will call with an arbitrary length (it can't know the real length and
|
||||
will reply with chunks of XML that are easy for us to deal with. Gdb will
|
||||
|
||||
GDB will call with an arbitrary length (it can't know the real length and
|
||||
will reply with chunks of XML that are easy for us to deal with. Gdb will
|
||||
keep calling until we say we are done. XML doc looks like:
|
||||
|
||||
|
||||
<library-list>
|
||||
<library name="/a/a/c/d.dSYM"><segment address="0x10000000"/></library>
|
||||
<library name="/a/m/e/e.pdb"><segment address="0x20000000"/></library>
|
||||
<library name="/a/l/f/f.dll"><segment address="0x30000000"/></library>
|
||||
</library-list>
|
||||
|
||||
|
||||
Since we can not allocate memory in interrupt context this module has
|
||||
assumptions about how it will get called:
|
||||
1) Length will generally be max remote packet size (big enough)
|
||||
2) First Offset of an XML document read needs to be 0
|
||||
3) This code will return back small chunks of the XML document on every read.
|
||||
Each subsequent call will ask for the next available part of the document.
|
||||
|
||||
|
||||
Note: The only variable size element in the XML is:
|
||||
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
|
||||
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
|
||||
based on the file path and name of the symbol file. If the symbol file name
|
||||
is bigger than the max gdb remote packet size we could update this code
|
||||
to respond back in chunks.
|
||||
|
||||
@param Offset offset into special data area
|
||||
@param Length number of bytes to read starting at Offset
|
||||
|
||||
@param Length number of bytes to read starting at Offset
|
||||
|
||||
**/
|
||||
VOID
|
||||
QxferLibrary (
|
||||
@@ -1029,8 +1029,8 @@ QxferLibrary (
|
||||
if (Offset != gPacketqXferLibraryOffset) {
|
||||
SendError (GDB_EINVALIDARG);
|
||||
Print (L"\nqXferLibrary (%d, %d) != %d\n", Offset, Length, gPacketqXferLibraryOffset);
|
||||
|
||||
// Force a retry from the beginning
|
||||
|
||||
// Force a retry from the beginning
|
||||
gPacketqXferLibraryOffset = 0;
|
||||
|
||||
return;
|
||||
@@ -1038,41 +1038,41 @@ QxferLibrary (
|
||||
|
||||
if (Offset == 0) {
|
||||
gPacketqXferLibraryOffset += gXferObjectReadResponse ('m', "<library-list>\n");
|
||||
|
||||
|
||||
// The owner of the table may have had to ralloc it so grab a fresh copy every time
|
||||
// we assume qXferLibrary will get called over and over again until the entire XML table is
|
||||
// we assume qXferLibrary will get called over and over again until the entire XML table is
|
||||
// returned in a tight loop. Since we are in the debugger the table should not get updated
|
||||
gDebugTable = gDebugImageTableHeader->EfiDebugImageInfoTable;
|
||||
gEfiDebugImageTableEntry = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (gDebugTable != NULL) {
|
||||
for (; gEfiDebugImageTableEntry < gDebugImageTableHeader->TableSize; gEfiDebugImageTableEntry++, gDebugTable++) {
|
||||
if (gDebugTable->NormalImage != NULL) {
|
||||
if ((gDebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
|
||||
if ((gDebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
|
||||
(gDebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
|
||||
Pdb = PeCoffLoaderGetDebuggerInfo (
|
||||
gDebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase,
|
||||
gDebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase,
|
||||
&LoadAddress
|
||||
);
|
||||
if (Pdb != NULL) {
|
||||
Size = AsciiSPrint (
|
||||
gXferLibraryBuffer,
|
||||
sizeof (gXferLibraryBuffer),
|
||||
" <library name=\"%a\"><segment address=\"0x%p\"/></library>\n",
|
||||
gXferLibraryBuffer,
|
||||
sizeof (gXferLibraryBuffer),
|
||||
" <library name=\"%a\"><segment address=\"0x%p\"/></library>\n",
|
||||
Pdb,
|
||||
LoadAddress
|
||||
);
|
||||
if ((Size != 0) && (Size != (sizeof (gXferLibraryBuffer) - 1))) {
|
||||
gPacketqXferLibraryOffset += gXferObjectReadResponse ('m', gXferLibraryBuffer);
|
||||
|
||||
|
||||
// Update loop variables so we are in the right place when we get back
|
||||
gEfiDebugImageTableEntry++;
|
||||
gDebugTable++;
|
||||
return;
|
||||
} else {
|
||||
// We could handle <library> entires larger than sizeof (gXferLibraryBuffer) here if
|
||||
// We could handle <library> entires larger than sizeof (gXferLibraryBuffer) here if
|
||||
// needed by breaking up into N packets
|
||||
// "<library name=\"%s
|
||||
// the rest of the string (as many packets as required
|
||||
@@ -1080,13 +1080,13 @@ QxferLibrary (
|
||||
//
|
||||
// But right now we just skip any entry that is too big
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
gXferObjectReadResponse ('l', "</library-list>\n");
|
||||
gPacketqXferLibraryOffset = 0;
|
||||
return;
|
||||
@@ -1096,55 +1096,55 @@ QxferLibrary (
|
||||
/**
|
||||
Exception Hanldler for GDB. It will be called for all exceptions
|
||||
registered via the gExceptionType[] array.
|
||||
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINT8 GdbExceptionType;
|
||||
CHAR8 *Ptr;
|
||||
|
||||
|
||||
|
||||
|
||||
if (ValidateException (ExceptionType, SystemContext) == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RemoveSingleStep (SystemContext);
|
||||
|
||||
|
||||
GdbExceptionType = ConvertEFItoGDBtype (ExceptionType);
|
||||
GdbSendTSignal (SystemContext, GdbExceptionType);
|
||||
|
||||
|
||||
for( ; ; ) {
|
||||
ReceivePacket (gInBuffer, MAX_BUF_SIZE);
|
||||
|
||||
|
||||
switch (gInBuffer[0]) {
|
||||
case '?':
|
||||
GdbSendTSignal (SystemContext, GdbExceptionType);
|
||||
break;
|
||||
|
||||
|
||||
case 'c':
|
||||
ContinueAtAddress (SystemContext, gInBuffer);
|
||||
ContinueAtAddress (SystemContext, gInBuffer);
|
||||
return;
|
||||
|
||||
case 'g':
|
||||
ReadGeneralRegisters (SystemContext);
|
||||
break;
|
||||
|
||||
|
||||
case 'G':
|
||||
WriteGeneralRegisters (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
|
||||
case 'H':
|
||||
//Return "OK" packet since we don't have more than one thread.
|
||||
//Return "OK" packet since we don't have more than one thread.
|
||||
SendSuccess ();
|
||||
break;
|
||||
|
||||
|
||||
case 'm':
|
||||
ReadFromMemory (gInBuffer);
|
||||
break;
|
||||
@@ -1160,7 +1160,7 @@ GdbExceptionHandler (
|
||||
//
|
||||
// Still debugging this code. Not used in Darwin
|
||||
//
|
||||
case 'q':
|
||||
case 'q':
|
||||
// General Query Packets
|
||||
if (AsciiStrnCmp (gInBuffer, "qSupported", 10) == 0) {
|
||||
// return what we currently support, we don't parse what gdb suports
|
||||
@@ -1170,7 +1170,7 @@ GdbExceptionHandler (
|
||||
// ‘qXfer:libraries:read::offset,length
|
||||
// gInBuffer[22] is offset string, ++Ptr is length string’
|
||||
for (Ptr = &gInBuffer[22]; *Ptr != ','; Ptr++);
|
||||
|
||||
|
||||
// Not sure if multi-radix support is required. Currently only support decimal
|
||||
QxferLibrary (AsciiStrHexToUintn (&gInBuffer[22]), AsciiStrHexToUintn (++Ptr));
|
||||
} if (AsciiStrnCmp (gInBuffer, "qOffsets", 10) == 0) {
|
||||
@@ -1183,18 +1183,18 @@ GdbExceptionHandler (
|
||||
break;
|
||||
|
||||
case 's':
|
||||
SingleStep (SystemContext, gInBuffer);
|
||||
SingleStep (SystemContext, gInBuffer);
|
||||
return;
|
||||
|
||||
|
||||
case 'z':
|
||||
RemoveBreakPoint (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
|
||||
case 'Z':
|
||||
InsertBreakPoint (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
//Send empty packet
|
||||
SendNotSupported ();
|
||||
break;
|
||||
@@ -1204,28 +1204,28 @@ GdbExceptionHandler (
|
||||
|
||||
|
||||
/**
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
break in type command from GDB.
|
||||
|
||||
@param SystemContext Register content at time of the call
|
||||
|
||||
@param SystemContext Register content at time of the call
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
//
|
||||
// gCtrlCBreakFlag may have been set from a previous F response package
|
||||
// and we set the global as we need to process it at a point where we
|
||||
// gCtrlCBreakFlag may have been set from a previous F response package
|
||||
// and we set the global as we need to process it at a point where we
|
||||
// can update the system context. If we are in the middle of processing
|
||||
// a F Packet it is not safe to read the GDB serial stream so we need
|
||||
// to skip it on this check
|
||||
//
|
||||
if (!gCtrlCBreakFlag && !gProcessingFPacket) {
|
||||
//
|
||||
// Ctrl-C was not pending so grab any pending characters and see if they
|
||||
// are a Ctrl-c (0x03). If so set the Ctrl-C global.
|
||||
// Ctrl-C was not pending so grab any pending characters and see if they
|
||||
// are a Ctrl-c (0x03). If so set the Ctrl-C global.
|
||||
//
|
||||
while (TRUE) {
|
||||
if (!GdbIsCharAvailable ()) {
|
||||
@@ -1234,7 +1234,7 @@ GdbPeriodicCallBack (
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (GdbGetChar () == 0x03) {
|
||||
gCtrlCBreakFlag = TRUE;
|
||||
//
|
||||
@@ -1244,7 +1244,7 @@ GdbPeriodicCallBack (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gCtrlCBreakFlag) {
|
||||
//
|
||||
// Update the context to force a single step trap when we exit the GDB
|
||||
|
@@ -34,39 +34,39 @@
|
||||
|
||||
[Sources.ARM]
|
||||
Arm/Processor.c
|
||||
|
||||
|
||||
[Sources.IA32]
|
||||
Ia32/Processor.c
|
||||
|
||||
|
||||
[Sources.X64]
|
||||
X64/Processor.c
|
||||
|
||||
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
PcdLib
|
||||
BaseLib
|
||||
DebugLib
|
||||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
PcdLib
|
||||
GdbSerialLib
|
||||
PrintLib
|
||||
CacheMaintenanceLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiDebugSupportProtocolGuid
|
||||
gEfiDebugPortProtocolGuid
|
||||
gEfiSerialIoProtocolGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiDebugSupportProtocolGuid
|
||||
gEfiDebugPortProtocolGuid
|
||||
gEfiSerialIoProtocolGuid
|
||||
|
||||
[Guids]
|
||||
gEfiDebugImageInfoTableGuid
|
||||
|
||||
|
@@ -37,7 +37,7 @@
|
||||
extern CONST CHAR8 mHexToStr[];
|
||||
|
||||
// maximum size of input and output buffers
|
||||
// This value came from the show remote command of the gdb we tested against
|
||||
// This value came from the show remote command of the gdb we tested against
|
||||
#define MAX_BUF_SIZE 2000
|
||||
|
||||
// maximum size of address buffer
|
||||
@@ -59,7 +59,7 @@ extern CONST CHAR8 mHexToStr[];
|
||||
//
|
||||
// GDB Signal definitions - generic names for interrupts
|
||||
//
|
||||
#define GDB_SIGILL 4 // Illegal instruction
|
||||
#define GDB_SIGILL 4 // Illegal instruction
|
||||
#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)
|
||||
#define GDB_SIGEMT 7 // Emulator Trap
|
||||
#define GDB_SIGFPE 8 // Floating point exception
|
||||
@@ -71,9 +71,9 @@ extern CONST CHAR8 mHexToStr[];
|
||||
// Includes all general GDB Unix like error values
|
||||
//
|
||||
#define GDB_EBADMEMADDRBUFSIZE 11 // the buffer that stores memory Address to be read from/written to is not the right size
|
||||
#define GDB_EBADMEMLENGBUFSIZE 12 // the buffer that stores Length is not the right size
|
||||
#define GDB_EBADMEMLENGBUFSIZE 12 // the buffer that stores Length is not the right size
|
||||
#define GDB_EBADMEMLENGTH 13 // Length, the given number of bytes to read or write, is not the right size
|
||||
#define GDB_EBADMEMDATA 14 // one of the bytes or nibbles of the memory is leess than 0
|
||||
#define GDB_EBADMEMDATA 14 // one of the bytes or nibbles of the memory is leess than 0
|
||||
#define GDB_EBADMEMDATASIZE 15 // the memory data, 'XX..', is too short or too long
|
||||
#define GDB_EBADBUFSIZE 21 // the buffer created is not the correct size
|
||||
#define GDB_EINVALIDARG 31 // argument is invalid
|
||||
@@ -93,7 +93,7 @@ extern CONST CHAR8 mHexToStr[];
|
||||
//
|
||||
//Define Register size for different architectures
|
||||
//
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#define REG_SIZE 32
|
||||
#elif defined (MDE_CPU_X64)
|
||||
#define REG_SIZE 64
|
||||
@@ -151,7 +151,7 @@ typedef union {
|
||||
UINT32 B1:1; // Breakpoint condition detected
|
||||
UINT32 B2:1; // Breakpoint condition detected
|
||||
UINT32 B3:1; // Breakpoint condition detected
|
||||
UINT32 Reserved_1:9; // Reserved
|
||||
UINT32 Reserved_1:9; // Reserved
|
||||
UINT32 BD:1; // Debug register access detected
|
||||
UINT32 BS:1; // Single step
|
||||
UINT32 BT:1; // Task switch
|
||||
@@ -210,7 +210,7 @@ extern EFI_EXCEPTION_TYPE_ENTRY gExceptionType[];
|
||||
|
||||
//
|
||||
// Set TRUE if F Reply package signals a ctrl-c. We can not process the Ctrl-c
|
||||
// here we need to wait for the periodic callback to do this.
|
||||
// here we need to wait for the periodic callback to do this.
|
||||
//
|
||||
extern BOOLEAN gCtrlCBreakFlag;
|
||||
|
||||
@@ -229,8 +229,8 @@ extern UINTN gRegisterOffsets[];
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -240,8 +240,8 @@ MaxEfiException (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gRegisters[]
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxRegisterCount (
|
||||
@@ -250,9 +250,9 @@ MaxRegisterCount (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
|
||||
@retval TRUE if Isa is supported,
|
||||
FALSE otherwise.
|
||||
**/
|
||||
@@ -264,7 +264,7 @@ CheckIsa (
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -278,29 +278,29 @@ GdbSendTSignal (
|
||||
|
||||
/**
|
||||
Translates the EFI mapping to GDB mapping
|
||||
|
||||
|
||||
@param EFIExceptionType EFI Exception that is being processed
|
||||
@retval UINTN that corresponds to EFIExceptionType's GDB exception type number
|
||||
**/
|
||||
UINT8
|
||||
ConvertEFItoGDBtype (
|
||||
ConvertEFItoGDBtype (
|
||||
IN EFI_EXCEPTION_TYPE EFIExceptionType
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Empties the given buffer
|
||||
Empties the given buffer
|
||||
@param *Buf pointer to the first element in buffer to be emptied
|
||||
**/
|
||||
VOID
|
||||
EmptyBuffer (
|
||||
EmptyBuffer (
|
||||
IN CHAR8 *Buf
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Converts an 8-bit Hex Char into a INTN.
|
||||
|
||||
|
||||
@param Char - the hex character to be converted into UINTN
|
||||
@retval a INTN, from 0 to 15, that corressponds to Char
|
||||
-1 if Char is not a hex character
|
||||
@@ -315,7 +315,7 @@ HexCharToInt (
|
||||
Send an error with the given error number after converting to hex.
|
||||
The error number is put into the buffer in hex. '255' is the biggest errno we can send.
|
||||
ex: 162 will be sent as A2.
|
||||
|
||||
|
||||
@param errno the error number that will be sent
|
||||
**/
|
||||
VOID
|
||||
@@ -342,8 +342,8 @@ SendNotSupported (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer This is the input buffer received from gdb server
|
||||
**/
|
||||
@@ -354,12 +354,12 @@ ReadNthRegister (
|
||||
);
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
@@ -390,10 +390,10 @@ WriteGeneralRegisters (
|
||||
|
||||
|
||||
/** ‘m addr,length ’
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
send it as a packet.
|
||||
|
||||
|
||||
@param *PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
VOID
|
||||
@@ -403,10 +403,10 @@ ReadFromMemory (
|
||||
|
||||
|
||||
/** ‘M addr,length :XX...’
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
another function, TransferFromInBufToMem, that will write to that memory space the info in
|
||||
the input buffer.
|
||||
|
||||
|
||||
@param PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
VOID
|
||||
@@ -415,11 +415,11 @@ WriteToMemory (
|
||||
);
|
||||
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param *PacketData Pointer to PacketData
|
||||
**/
|
||||
|
||||
@@ -431,9 +431,9 @@ ContinueAtAddress (
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
@@ -443,27 +443,27 @@ SingleStep (
|
||||
IN CHAR8 *PacketData
|
||||
);
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
AddSingleStep (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
RemoveSingleStep (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
‘Z1, [addr], [length]’
|
||||
‘Z2, [addr], [length]’
|
||||
@@ -507,36 +507,36 @@ RemoveBreakPoint(
|
||||
/**
|
||||
Exception Hanldler for GDB. It will be called for all exceptions
|
||||
registered via the gExceptionType[] array.
|
||||
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
break in type command from GDB.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the call
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Make two serail consoles: 1) StdIn and StdOut via GDB. 2) StdErr via GDB.
|
||||
|
||||
|
||||
These console show up on the remote system running GDB
|
||||
|
||||
**/
|
||||
@@ -549,15 +549,15 @@ GdbInitializeSerialConsole (
|
||||
|
||||
/**
|
||||
Send a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
in an infinit loop. This is so if you unplug the debugger code just keeps running
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data sent.
|
||||
|
||||
**/
|
||||
@@ -565,21 +565,21 @@ UINTN
|
||||
SendPacket (
|
||||
IN CHAR8 *PacketData
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Receive a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
|
||||
If host re-starts sending a packet without ending the previous packet, only the last valid packet is proccessed.
|
||||
(In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)
|
||||
|
||||
|
||||
If an ack '+' is not sent resend the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data received.
|
||||
|
||||
**/
|
||||
@@ -588,15 +588,15 @@ ReceivePacket (
|
||||
OUT CHAR8 *PacketData,
|
||||
IN UINTN PacketDataSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
the end of a file. On error -1 is returned. If count is zero, GdbRead returns zero.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that were read
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes read.
|
||||
@@ -608,15 +608,15 @@ GdbRead (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that are to be written
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes written.
|
||||
@@ -629,13 +629,13 @@ GdbWrite (
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
UINTN *
|
||||
UINTN *
|
||||
FindPointerToRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
);
|
||||
|
||||
CHAR8 *
|
||||
CHAR8 *
|
||||
BasicReadRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber,
|
||||
@@ -662,7 +662,7 @@ BasicWriteRegister (
|
||||
IN CHAR8 *InBufPtr
|
||||
);
|
||||
|
||||
VOID
|
||||
VOID
|
||||
PrintReg (
|
||||
EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
@@ -678,7 +678,7 @@ ParseBreakpointPacket (
|
||||
UINTN
|
||||
GetBreakpointDataAddress (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN BreakpointNumber
|
||||
IN UINTN BreakpointNumber
|
||||
);
|
||||
|
||||
UINTN
|
||||
@@ -689,7 +689,7 @@ GetBreakpointDetected (
|
||||
BREAK_TYPE
|
||||
GetBreakpointType (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN BreakpointNumber
|
||||
IN UINTN BreakpointNumber
|
||||
);
|
||||
|
||||
UINTN
|
||||
@@ -739,8 +739,8 @@ ValidateAddress (
|
||||
|
||||
BOOLEAN
|
||||
ValidateException (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -20,7 +20,7 @@
|
||||
// {EFI mapping, GDB mapping}
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_IA32_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_IA32_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_IA32_DEBUG, GDB_SIGTRAP },
|
||||
{ EXCEPT_IA32_NMI, GDB_SIGEMT },
|
||||
{ EXCEPT_IA32_BREAKPOINT, GDB_SIGTRAP },
|
||||
@@ -62,7 +62,7 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
|
||||
//Debug only..
|
||||
VOID
|
||||
VOID
|
||||
PrintReg (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
@@ -80,7 +80,7 @@ PrintReg (
|
||||
}
|
||||
|
||||
//Debug only..
|
||||
VOID
|
||||
VOID
|
||||
PrintDRreg (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
@@ -96,8 +96,8 @@ PrintDRreg (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -110,8 +110,8 @@ MaxEfiException (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gRegisters[]
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxRegisterCount (
|
||||
@@ -123,9 +123,9 @@ MaxRegisterCount (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
|
||||
@retval TRUE if Isa is supported,
|
||||
FALSE otherwise.
|
||||
**/
|
||||
@@ -142,14 +142,14 @@ CheckIsa (
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the IA32 member
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -174,7 +174,7 @@ BasicReadRegister (
|
||||
)
|
||||
{
|
||||
UINTN RegSize;
|
||||
|
||||
|
||||
RegSize = 0;
|
||||
while (RegSize < REG_SIZE) {
|
||||
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
|
||||
@@ -185,8 +185,8 @@ BasicReadRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
@@ -201,7 +201,7 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[9]; // 1 reg=8 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
@@ -217,14 +217,14 @@ ReadNthRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
@@ -233,7 +233,7 @@ ReadGeneralRegisters (
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
for (i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
|
||||
for (i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
|
||||
OutBufPtr = BasicReadRegister (SystemContext, i, OutBufPtr);
|
||||
}
|
||||
|
||||
@@ -260,26 +260,26 @@ BasicWriteRegister (
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT32 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
NewValue = 0;
|
||||
RegSize = 0;
|
||||
while (RegSize < REG_SIZE) {
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
|
||||
@@ -304,19 +304,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -341,16 +341,16 @@ WriteGeneralRegisters (
|
||||
UINTN i;
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 129
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 129
|
||||
if (AsciiStrLen(InBuffer) != 129) { // 16 regs, 8 hex chars each, and the end '\0' (escape seq)
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for (i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
|
||||
@@ -361,9 +361,9 @@ WriteGeneralRegisters (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -374,10 +374,10 @@ AddSingleStep (
|
||||
SystemContext.SystemContextIa32->Eflags |= TF_BIT; //Setting the TF bit.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -390,11 +390,11 @@ RemoveSingleStep (
|
||||
|
||||
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -405,15 +405,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextIa32->Eip = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -425,7 +425,7 @@ SingleStep (
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextIa32->Eip = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
|
||||
|
||||
AddSingleStep (SystemContext);
|
||||
}
|
||||
|
||||
@@ -469,9 +469,9 @@ GetBreakpointDataAddress (
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@retval {1-4} Currently detected breakpoint value
|
||||
@retval {1-4} Currently detected breakpoint value
|
||||
@retval 0 No breakpoint detected.
|
||||
|
||||
|
||||
**/
|
||||
UINTN
|
||||
GetBreakpointDetected (
|
||||
@@ -492,7 +492,7 @@ GetBreakpointDetected (
|
||||
} else if (Dr6.Bits.B3 == 1) {
|
||||
BreakpointNumber = 4;
|
||||
} else {
|
||||
BreakpointNumber = 0; //No breakpoint detected
|
||||
BreakpointNumber = 0; //No breakpoint detected
|
||||
}
|
||||
|
||||
return BreakpointNumber;
|
||||
@@ -502,13 +502,13 @@ GetBreakpointDetected (
|
||||
/**
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead or DataReadWrite)
|
||||
based on the Breakpoint number
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn field
|
||||
For unknown value, it returns NotSupported.
|
||||
|
||||
|
||||
**/
|
||||
BREAK_TYPE
|
||||
GetBreakpointType (
|
||||
@@ -522,22 +522,22 @@ GetBreakpointType (
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if (BreakpointNumber == 1) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW0;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW0;
|
||||
} else if (BreakpointNumber == 2) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW1;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW1;
|
||||
} else if (BreakpointNumber == 3) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW2;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW2;
|
||||
} else if (BreakpointNumber == 4) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW3;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW3;
|
||||
}
|
||||
|
||||
return Type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Parses Length and returns the length which DR7 LENn field accepts.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
Zero gets written to DR7 LENn field.
|
||||
|
||||
@param Length Breakpoint length in Bytes (1 byte, 2 byte, 4 byte)
|
||||
@@ -550,7 +550,7 @@ ConvertLengthData (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 1) { //1-Byte length
|
||||
if (Length == 1) { //1-Byte length
|
||||
return 0;
|
||||
} else if (Length == 2) { //2-Byte length
|
||||
return 1;
|
||||
@@ -563,8 +563,8 @@ ConvertLengthData (
|
||||
|
||||
|
||||
/**
|
||||
Finds the next free debug register. If all the registers are occupied then
|
||||
EFI_OUT_OF_RESOURCES is returned.
|
||||
Finds the next free debug register. If all the registers are occupied then
|
||||
EFI_OUT_OF_RESOURCES is returned.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3 for the first free debug register)
|
||||
@@ -601,11 +601,11 @@ FindNextFreeDebugRegister (
|
||||
/**
|
||||
Enables the debug register. Writes Address value to appropriate DR0-3 register.
|
||||
Sets LENn, Gn, RWn bits in DR7 register.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3)
|
||||
@param Register Register value (0 - 3)
|
||||
@param Address Breakpoint address value
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
or write etc.)
|
||||
|
||||
@retval EFI_STATUS Appropriate status value.
|
||||
@@ -625,15 +625,15 @@ EnableDebugRegister (
|
||||
//Convert length data
|
||||
Length = ConvertLengthData (Length);
|
||||
|
||||
//For Instruction execution, length should be 0
|
||||
//For Instruction execution, length should be 0
|
||||
//(Ref. Intel reference manual 18.2.4)
|
||||
if ((Type == 0) && (Length != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -665,7 +665,7 @@ EnableDebugRegister (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//Update Dr7 with appropriate Gn, RWn and LENn bits
|
||||
//Update Dr7 with appropriate Gn, RWn and LENn bits
|
||||
SystemContext.SystemContextIa32->Dr7 = Dr7.UintN;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -681,7 +681,7 @@ EnableDebugRegister (
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Address Breakpoint address value
|
||||
@param Length Breakpoint length value
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
Data read or write etc.)
|
||||
@param Register Register value to be returned
|
||||
|
||||
@@ -701,7 +701,7 @@ FindMatchingDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -711,24 +711,24 @@ FindMatchingDebugRegister (
|
||||
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
(Dr7.Bits.LEN0 == Length) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr0)) {
|
||||
*Register = 0;
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
(Dr7.Bits.LEN1 == Length) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr1)) {
|
||||
*Register = 1;
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
(Dr7.Bits.LEN2 == Length) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr2)) {
|
||||
*Register = 2;
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
(Dr7.Bits.LEN3 == Length) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr3)) {
|
||||
*Register = 3;
|
||||
} else {
|
||||
@@ -752,12 +752,12 @@ FindMatchingDebugRegister (
|
||||
EFI_STATUS
|
||||
DisableDebugRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN Register
|
||||
IN UINTN Register
|
||||
)
|
||||
{
|
||||
IA32_DR7 Dr7;
|
||||
UINTN Address = 0;
|
||||
|
||||
|
||||
//Read DR7 register so appropriate Gn, RWn and LENn bits can be turned off.
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
@@ -914,15 +914,15 @@ RemoveBreakPoint (
|
||||
}
|
||||
|
||||
switch (Type) {
|
||||
|
||||
|
||||
case 0: //Software breakpoint
|
||||
BreakType = SoftwareBreakpoint;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //Hardware breakpoint
|
||||
BreakType = InstructionExecution;
|
||||
break;
|
||||
|
||||
|
||||
case 2: //Write watchpoint
|
||||
BreakType = DataWrite;
|
||||
break;
|
||||
@@ -984,8 +984,8 @@ ValidateAddress (
|
||||
|
||||
BOOLEAN
|
||||
ValidateException (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
Serial IO Abstraction for GDB stub. This allows an EFI consoles that shows up on the system
|
||||
Serial IO Abstraction for GDB stub. This allows an EFI consoles that shows up on the system
|
||||
running GDB. One consle for error information and another console for user input/output.
|
||||
|
||||
Basic packet format is $packet-data#checksum. So every comand has 4 bytes of overhead: $,
|
||||
#, 0, 0. The 0 and 0 are the ascii characters for the checksum.
|
||||
|
||||
|
||||
Basic packet format is $packet-data#checksum. So every comand has 4 bytes of overhead: $,
|
||||
#, 0, 0. The 0 and 0 are the ascii characters for the checksum.
|
||||
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
//
|
||||
// Set TRUE if F Reply package signals a ctrl-c. We can not process the Ctrl-c
|
||||
// here we need to wait for the periodic callback to do this.
|
||||
// here we need to wait for the periodic callback to do this.
|
||||
//
|
||||
BOOLEAN gCtrlCBreakFlag = FALSE;
|
||||
|
||||
@@ -34,9 +34,9 @@ BOOLEAN gCtrlCBreakFlag = FALSE;
|
||||
BOOLEAN gProcessingFPacket = FALSE;
|
||||
|
||||
/**
|
||||
Process a control-C break message.
|
||||
|
||||
Currently a place holder, remove the ASSERT when it gets implemented.
|
||||
Process a control-C break message.
|
||||
|
||||
Currently a place holder, remove the ASSERT when it gets implemented.
|
||||
|
||||
@param ErrNo Error infomration from the F reply packet or other source
|
||||
|
||||
@@ -62,55 +62,55 @@ GdbCtrlCBreakMessage (
|
||||
@param Packet Packet to parse like an F reply packet
|
||||
@param ErrNo Buffer to hold Count bytes that were read
|
||||
|
||||
@retval -1 Error, not a valid F reply packet
|
||||
@retval other Return the return code from the F reply packet
|
||||
@retval -1 Error, not a valid F reply packet
|
||||
@retval other Return the return code from the F reply packet
|
||||
|
||||
**/
|
||||
INTN
|
||||
GdbParseFReplyPacket (
|
||||
IN CHAR8 *Packet,
|
||||
OUT UINTN *ErrNo
|
||||
OUT UINTN *ErrNo
|
||||
)
|
||||
{
|
||||
INTN RetCode;
|
||||
|
||||
|
||||
if (Packet[0] != 'F') {
|
||||
// A valid responce would be an F packet
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
RetCode = AsciiStrHexToUintn (&Packet[1]);
|
||||
|
||||
// Find 1st comma
|
||||
for (;*Packet != '\0' && *Packet != ','; Packet++);
|
||||
|
||||
// Find 1st comma
|
||||
for (;*Packet != '\0' && *Packet != ','; Packet++);
|
||||
if (*Packet == '\0') {
|
||||
*ErrNo = 0;
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
|
||||
*ErrNo = AsciiStrHexToUintn (++Packet);
|
||||
|
||||
// Find 2nd comma
|
||||
for (;*Packet != '\0' && *Packet != ','; Packet++);
|
||||
// Find 2nd comma
|
||||
for (;*Packet != '\0' && *Packet != ','; Packet++);
|
||||
if (*Packet == '\0') {
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
|
||||
if (*(++Packet) == 'C') {
|
||||
GdbCtrlCBreakMessage (*ErrNo);
|
||||
GdbCtrlCBreakMessage (*ErrNo);
|
||||
}
|
||||
|
||||
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
the end of a file. On error -1 is returned. If count is zero, GdbRead returns zero.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that were read
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes read.
|
||||
@@ -128,19 +128,19 @@ GdbRead (
|
||||
INTN RetCode;
|
||||
UINTN ErrNo;
|
||||
BOOLEAN ReceiveDone = FALSE;
|
||||
|
||||
|
||||
// Send:
|
||||
// "Fread,XX,YYYYYYYY,XX
|
||||
//
|
||||
// XX - FileDescriptor in ASCII
|
||||
// YYYYYYYY - Buffer address in ASCII
|
||||
// YYYYYYYY - Buffer address in ASCII
|
||||
// XX - Count in ASCII
|
||||
// SS - check sum
|
||||
//
|
||||
Size = AsciiSPrint (Packet, sizeof (Packet), "Fread,%x,%x,%x", FileDescriptor, Buffer, Count);
|
||||
// Packet array is too small if you got this ASSERT
|
||||
ASSERT (Size < sizeof (Packet));
|
||||
|
||||
|
||||
gProcessingFPacket = TRUE;
|
||||
SendPacket (Packet);
|
||||
Print ((CHAR16 *)L"Packet sent..\n");
|
||||
@@ -175,25 +175,25 @@ GdbRead (
|
||||
|
||||
RetCode = GdbParseFReplyPacket (Packet, &ErrNo);
|
||||
Print ((CHAR16 *)L"RetCode: %x..ErrNo: %x..\n", RetCode, ErrNo);
|
||||
|
||||
|
||||
if (ErrNo > 0) {
|
||||
//Send error to the host if there is any.
|
||||
SendError ((UINT8)ErrNo);
|
||||
}
|
||||
|
||||
|
||||
gProcessingFPacket = FALSE;
|
||||
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that are to be written
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes written.
|
||||
@@ -216,14 +216,14 @@ GdbWrite (
|
||||
// #Fwrite,XX,YYYYYYYY,XX$SS
|
||||
//
|
||||
// XX - FileDescriptor in ASCII
|
||||
// YYYYYYYY - Buffer address in ASCII
|
||||
// YYYYYYYY - Buffer address in ASCII
|
||||
// XX - Count in ASCII
|
||||
// SS - check sum
|
||||
//
|
||||
Size = AsciiSPrint (Packet, sizeof (Packet), "Fwrite,%x,%x,%x", FileDescriptor, Buffer, Count);
|
||||
// Packet array is too small if you got this ASSERT
|
||||
ASSERT (Size < sizeof (Packet));
|
||||
|
||||
|
||||
SendPacket (Packet);
|
||||
Print ((CHAR16 *)L"Packet sent..\n");
|
||||
|
||||
@@ -235,7 +235,7 @@ GdbWrite (
|
||||
// Process GDB commands
|
||||
switch (Packet[0]) {
|
||||
//Read memory command.
|
||||
//m addr,length.
|
||||
//m addr,length.
|
||||
case 'm':
|
||||
ReadFromMemory (Packet);
|
||||
break;
|
||||
@@ -243,13 +243,13 @@ GdbWrite (
|
||||
//Fretcode, errno, Ctrl-C flag
|
||||
//retcode - Count read
|
||||
case 'F':
|
||||
//Once target receives F reply packet that means the previous
|
||||
//Once target receives F reply packet that means the previous
|
||||
//transactions are finished.
|
||||
ReceiveDone = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
//Send empty buffer
|
||||
default :
|
||||
default :
|
||||
SendNotSupported();
|
||||
break;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ GdbWrite (
|
||||
if (ErrNo > 0) {
|
||||
SendError((UINT8)ErrNo);
|
||||
}
|
||||
|
||||
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ GdbWrite (
|
||||
Reset the serial device.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The device was reset.
|
||||
@retval EFI_DEVICE_ERROR The serial device could not be reset.
|
||||
|
||||
@@ -287,7 +287,7 @@ GdbSerialReset (
|
||||
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data buts, and stop bits on a serial device.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@@ -355,7 +355,7 @@ GdbSerialSetControl (
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Control A pointer to return the current Control signals from the serial device.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
@@ -396,16 +396,16 @@ GdbSerialWrite (
|
||||
UINTN Return;
|
||||
|
||||
SerialDev = GDB_SERIAL_DEV_FROM_THIS (This);
|
||||
|
||||
|
||||
Return = GdbWrite (SerialDev->OutFileDescriptor, Buffer, *BufferSize);
|
||||
if (Return == (UINTN)-1) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (Return != *BufferSize) {
|
||||
*BufferSize = Return;
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -435,27 +435,27 @@ GdbSerialRead (
|
||||
UINTN Return;
|
||||
|
||||
SerialDev = GDB_SERIAL_DEV_FROM_THIS (This);
|
||||
|
||||
|
||||
Return = GdbRead (SerialDev->InFileDescriptor, Buffer, *BufferSize);
|
||||
if (Return == (UINTN)-1) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (Return != *BufferSize) {
|
||||
*BufferSize = Return;
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Template used to initailize the GDB Serial IO protocols
|
||||
//
|
||||
GDB_SERIAL_DEV gdbSerialDevTemplate = {
|
||||
GDB_SERIAL_DEV_SIGNATURE,
|
||||
NULL,
|
||||
|
||||
|
||||
{ // SerialIo
|
||||
SERIAL_IO_INTERFACE_REVISION,
|
||||
GdbSerialReset,
|
||||
@@ -504,7 +504,7 @@ GDB_SERIAL_DEV gdbSerialDevTemplate = {
|
||||
|
||||
/**
|
||||
Make two serial consoles: 1) StdIn and StdOut via GDB. 2) StdErr via GDB.
|
||||
|
||||
|
||||
These console show up on the remote system running GDB
|
||||
|
||||
**/
|
||||
@@ -520,21 +520,21 @@ GdbInitializeSerialConsole (
|
||||
// Use the template to make a copy of the Serial Console private data structure.
|
||||
StdOutSerialDev = AllocateCopyPool (sizeof (GDB_SERIAL_DEV), &gdbSerialDevTemplate);
|
||||
ASSERT (StdOutSerialDev != NULL);
|
||||
|
||||
|
||||
// Fixup pointer after the copy
|
||||
StdOutSerialDev->SerialIo.Mode = &StdOutSerialDev->SerialMode;
|
||||
|
||||
|
||||
StdErrSerialDev = AllocateCopyPool (sizeof (GDB_SERIAL_DEV), &gdbSerialDevTemplate);
|
||||
ASSERT (StdErrSerialDev != NULL);
|
||||
|
||||
// Fixup pointer and modify stuff that is different for StdError
|
||||
StdErrSerialDev->SerialIo.Mode = &StdErrSerialDev->SerialMode;
|
||||
StdErrSerialDev->SerialIo.Mode = &StdErrSerialDev->SerialMode;
|
||||
StdErrSerialDev->DevicePath.Index = 1;
|
||||
StdErrSerialDev->OutFileDescriptor = GDB_STDERR;
|
||||
|
||||
|
||||
// Make a new handle with Serial IO protocol and its device path on it.
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&StdOutSerialDev->Handle,
|
||||
&StdOutSerialDev->Handle,
|
||||
&gEfiSerialIoProtocolGuid, &StdOutSerialDev->SerialIo,
|
||||
&gEfiDevicePathProtocolGuid, &StdOutSerialDev->DevicePath,
|
||||
NULL
|
||||
@@ -543,7 +543,7 @@ GdbInitializeSerialConsole (
|
||||
|
||||
// Make a new handle with Serial IO protocol and its device path on it.
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&StdErrSerialDev->Handle,
|
||||
&StdErrSerialDev->Handle,
|
||||
&gEfiSerialIoProtocolGuid, &StdErrSerialDev->SerialIo,
|
||||
&gEfiDevicePathProtocolGuid, &StdErrSerialDev->DevicePath,
|
||||
NULL
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -19,7 +19,7 @@
|
||||
// Array of exception types that need to be hooked by the debugger
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_X64_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_X64_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_X64_DEBUG, GDB_SIGTRAP },
|
||||
{ EXCEPT_X64_NMI, GDB_SIGEMT },
|
||||
{ EXCEPT_X64_BREAKPOINT, GDB_SIGTRAP },
|
||||
@@ -37,7 +37,7 @@ EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
|
||||
|
||||
// The offsets of registers SystemContextX64.
|
||||
// The fields in the array are in the gdb ordering.
|
||||
// The fields in the array are in the gdb ordering.
|
||||
// HAVE TO DOUBLE-CHECK THE ORDER of the 24 regs
|
||||
//
|
||||
UINTN gRegisterOffsets[] = {
|
||||
@@ -70,8 +70,8 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -84,8 +84,8 @@ MaxEfiException (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gRegisters[]
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxRegisterCount (
|
||||
@@ -95,9 +95,9 @@ MaxRegisterCount (
|
||||
return sizeof (gRegisterOffsets)/sizeof (UINTN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
@retval TRUE if Isa is supported
|
||||
@@ -114,14 +114,14 @@ CheckIsa (
|
||||
/**
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the X64 member
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister(
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -145,7 +145,7 @@ BasicReadRegister (
|
||||
)
|
||||
{
|
||||
UINTN RegSize;
|
||||
|
||||
|
||||
RegSize = 0;
|
||||
while (RegSize < 64) {
|
||||
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
|
||||
@@ -156,8 +156,8 @@ BasicReadRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
**/
|
||||
@@ -170,42 +170,42 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[17]; // 1 reg=16 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
OutBufPtr = BasicReadRegister(SystemContext, RegNumber, OutBufPtr);
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket (OutBuffer);
|
||||
}
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINTN i;
|
||||
CHAR8 OutBuffer[385]; // 24 regs, 16 hex chars each, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 24 registers to read
|
||||
for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 24 registers to read
|
||||
OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
|
||||
}
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket (OutBuffer);
|
||||
}
|
||||
@@ -229,26 +229,26 @@ BasicWriteRegister (
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT64 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
NewValue = 0;
|
||||
RegSize = 0;
|
||||
while (RegSize < 64) {
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
|
||||
@@ -273,19 +273,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -309,30 +309,30 @@ WriteGeneralRegisters (
|
||||
{
|
||||
UINTN i;
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 385
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 385
|
||||
if (AsciiStrLen(InBuffer) != 385) { // 24 regs, 16 hex chars each, and the end '\0' (escape seq)
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for(i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
|
||||
InBufPtr = BasicWriteRegister(SystemContext, i, InBufPtr);
|
||||
}
|
||||
|
||||
|
||||
SendSuccess();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -343,11 +343,11 @@ AddSingleStep (
|
||||
SystemContext.SystemContextX64->Rflags |= TF_BIT; //Setting the TF bit.
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -360,11 +360,11 @@ RemoveSingleStep (
|
||||
|
||||
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -375,15 +375,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn(&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -395,19 +395,19 @@ SingleStep (
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
|
||||
|
||||
AddSingleStep (SystemContext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns breakpoint data address from DR0-DR3 based on the input breakpoint
|
||||
Returns breakpoint data address from DR0-DR3 based on the input breakpoint
|
||||
number
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
@retval Address Data address from DR0-DR3 based on the
|
||||
@retval Address Data address from DR0-DR3 based on the
|
||||
breakpoint number.
|
||||
|
||||
**/
|
||||
@@ -435,7 +435,7 @@ GetBreakpointDataAddress (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns currently detected breakpoint value based on the register
|
||||
Returns currently detected breakpoint value based on the register
|
||||
DR6 B0-B3 field.
|
||||
If no breakpoint is detected then it returns 0.
|
||||
|
||||
@@ -471,13 +471,13 @@ GetBreakpointDetected (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead
|
||||
or DataReadWrite) based on the Breakpoint number
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn
|
||||
field. For unknown value, it returns NotSupported.
|
||||
|
||||
**/
|
||||
@@ -506,9 +506,9 @@ GetBreakpointType (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Parses Length and returns the length which DR7 LENn field accepts.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
Zero gets written to DR7 LENn field.
|
||||
|
||||
@param Length Breakpoint length in Bytes (1 byte, 2 byte, 4 byte)
|
||||
@@ -521,7 +521,7 @@ ConvertLengthData (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 1) { //1-Byte length
|
||||
if (Length == 1) { //1-Byte length
|
||||
return 0;
|
||||
} else if (Length == 2) { //2-Byte length
|
||||
return 1;
|
||||
@@ -576,7 +576,7 @@ FindNextFreeDebugRegister (
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3)
|
||||
@param Address Breakpoint address value
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
Data read or write etc.)
|
||||
|
||||
@retval EFI_STATUS Appropriate status value.
|
||||
@@ -596,7 +596,7 @@ EnableDebugRegister (
|
||||
//Convert length data
|
||||
Length = ConvertLengthData (Length);
|
||||
|
||||
//For Instruction execution, length should be 0
|
||||
//For Instruction execution, length should be 0
|
||||
//(Ref. Intel reference manual 18.2.4)
|
||||
if ((Type == 0) && (Length != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -604,7 +604,7 @@ EnableDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -643,14 +643,14 @@ EnableDebugRegister (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns register number 0 - 3 for the maching debug register.
|
||||
This function compares incoming Address, Type, Length and
|
||||
/**
|
||||
Returns register number 0 - 3 for the maching debug register.
|
||||
This function compares incoming Address, Type, Length and
|
||||
if there is a match then it returns the appropriate register number.
|
||||
In case of mismatch, function returns EFI_NOT_FOUND message.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Address Breakpoint address value
|
||||
@param Address Breakpoint address value
|
||||
@param Length Breakpoint length value
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
or write etc.)
|
||||
@@ -672,7 +672,7 @@ FindMatchingDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -682,24 +682,24 @@ FindMatchingDebugRegister (
|
||||
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
(Dr7.Bits.LEN0 == Length) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr0)) {
|
||||
*Register = 0;
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
(Dr7.Bits.LEN1 == Length) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr1)) {
|
||||
*Register = 1;
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
(Dr7.Bits.LEN2 == Length) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr2)) {
|
||||
*Register = 2;
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
(Dr7.Bits.LEN3 == Length) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr3)) {
|
||||
*Register = 3;
|
||||
} else {
|
||||
@@ -884,15 +884,15 @@ RemoveBreakPoint (
|
||||
}
|
||||
|
||||
switch (Type) {
|
||||
|
||||
|
||||
case 0: //Software breakpoint
|
||||
BreakType = SoftwareBreakpoint;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //Hardware breakpoint
|
||||
BreakType = InstructionExecution;
|
||||
break;
|
||||
|
||||
|
||||
case 2: //Write watchpoint
|
||||
BreakType = DataWrite;
|
||||
break;
|
||||
@@ -954,8 +954,8 @@ ValidateAddress (
|
||||
|
||||
BOOLEAN
|
||||
ValidateException (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
|
@@ -28,7 +28,7 @@ typedef struct {
|
||||
} EXTRACT_SECTION_DATA;
|
||||
|
||||
typedef struct {
|
||||
EFI_HOB_GUID_TYPE Hob;
|
||||
EFI_HOB_GUID_TYPE Hob;
|
||||
EXTRACT_SECTION_DATA Data;
|
||||
} EXTRACT_SECTION_HOB;
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/** @file
|
||||
Platform specific Debug Agent abstraction for timer used by the agent.
|
||||
Platform specific Debug Agent abstraction for timer used by the agent.
|
||||
|
||||
The timer is used by the debugger to break into a running program.
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -31,33 +31,32 @@ EFIAPI
|
||||
DebugAgentTimerIntialize (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set the period for the debug agent timer. Zero means disable the timer.
|
||||
|
||||
@param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.
|
||||
|
||||
**/
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentTimerSetPeriod (
|
||||
IN UINT32 TimerPeriodMilliseconds
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Perform End Of Interrupt for the debug agent timer. This is called in the
|
||||
interrupt handler after the interrupt has been processed.
|
||||
Perform End Of Interrupt for the debug agent timer. This is called in the
|
||||
interrupt handler after the interrupt has been processed.
|
||||
|
||||
**/
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentTimerEndOfInterrupt (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
DMA abstraction library APIs. Based on UEFI PCI IO protocol DMA abstractions.
|
||||
At some point these functions will probably end up in a non PCI protocol
|
||||
At some point these functions will probably end up in a non PCI protocol
|
||||
for embedded systems.
|
||||
|
||||
DMA Bus Master Read Operation:
|
||||
Call DmaMap() for MapOperationBusMasterRead.
|
||||
Program the DMA Bus Master with the DeviceAddress returned by DmaMap().
|
||||
Start the DMA Bus Master.
|
||||
Wait for DMA Bus Master to complete the read operation.
|
||||
Call DmaMap() for MapOperationBusMasterRead.
|
||||
Program the DMA Bus Master with the DeviceAddress returned by DmaMap().
|
||||
Start the DMA Bus Master.
|
||||
Wait for DMA Bus Master to complete the read operation.
|
||||
Call DmaUnmap().
|
||||
|
||||
DMA Bus Master Write Operation:
|
||||
@@ -18,11 +18,11 @@
|
||||
Call DmaUnmap().
|
||||
|
||||
DMA Bus Master Common Buffer Operation:
|
||||
Call DmaAllocateBuffer() to allocate a common buffer.
|
||||
Call DmaMap() for MapOperationBusMasterCommonBuffer.
|
||||
Program the DMA Bus Master with the DeviceAddress returned by DmaMap().
|
||||
The common buffer can now be accessed equally by the processor and the DMA bus master.
|
||||
Call DmaUnmap().
|
||||
Call DmaAllocateBuffer() to allocate a common buffer.
|
||||
Call DmaMap() for MapOperationBusMasterCommonBuffer.
|
||||
Program the DMA Bus Master with the DeviceAddress returned by DmaMap().
|
||||
The common buffer can now be accessed equally by the processor and the DMA bus master.
|
||||
Call DmaUnmap().
|
||||
Call DmaFreeBuffer().
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
@@ -60,25 +60,25 @@ typedef enum {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Provides the DMA controller-specific addresses needed to access system memory.
|
||||
|
||||
|
||||
Operation is relative to the DMA bus master.
|
||||
|
||||
|
||||
@param Operation Indicates if the bus master is going to read or write to system memory.
|
||||
@param HostAddress The system memory address to map to the DMA controller.
|
||||
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
|
||||
that were mapped.
|
||||
that were mapped.
|
||||
@param DeviceAddress The resulting map address for the bus master controller to use to
|
||||
access the hosts HostAddress.
|
||||
access the hosts HostAddress.
|
||||
@param Mapping A resulting value to pass to DmaUnmap().
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
|
||||
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
||||
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -93,15 +93,15 @@ DmaMap (
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Completes the DmaMapBusMasterRead, DmaMapBusMasterWrite, or DmaMapBusMasterCommonBuffer
|
||||
operation and releases any corresponding resources.
|
||||
|
||||
|
||||
@param Mapping The mapping value returned from DmaMap().
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The range was unmapped.
|
||||
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -110,22 +110,22 @@ DmaUnmap (
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Allocates pages that are suitable for an DmaMap() of type MapOperationBusMasterCommonBuffer.
|
||||
mapping.
|
||||
|
||||
mapping.
|
||||
|
||||
@param MemoryType The type of memory to allocate, EfiBootServicesData or
|
||||
EfiRuntimeServicesData.
|
||||
@param Pages The number of pages to allocate.
|
||||
EfiRuntimeServicesData.
|
||||
@param Pages The number of pages to allocate.
|
||||
@param HostAddress A pointer to store the base system memory address of the
|
||||
allocated range.
|
||||
allocated range.
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were allocated.
|
||||
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
|
||||
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
||||
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -136,16 +136,16 @@ DmaAllocateBuffer (
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Frees memory that was allocated with DmaAllocateBuffer().
|
||||
|
||||
@param Pages The number of pages to free.
|
||||
@param HostAddress The base system memory address of the allocated range.
|
||||
|
||||
|
||||
@param Pages The number of pages to free.
|
||||
@param HostAddress The base system memory address of the allocated range.
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were freed.
|
||||
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
|
||||
was not allocated with DmaAllocateBuffer().
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -155,5 +155,5 @@ DmaFreeBuffer (
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -42,7 +42,7 @@ EblAddExternalCommands (
|
||||
|
||||
@param TimeoutInSec Number of seconds to wait to timeout
|
||||
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ EblGetCharKey (
|
||||
|
||||
string. This depends on the last print done before calling this function.
|
||||
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
|
||||
needed.
|
||||
|
||||
|
@@ -34,7 +34,7 @@ EblAddCommands (
|
||||
|
||||
|
||||
//
|
||||
// LIbrary constructor called directly from Ebl Code.
|
||||
// LIbrary constructor called directly from Ebl Code.
|
||||
// This module calls EblAddCommand () or EblAddCommands () to register new commands
|
||||
//
|
||||
VOID
|
||||
|
@@ -49,7 +49,7 @@ EblSetStationIp (
|
||||
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
|
||||
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EblMtftp (
|
||||
@@ -63,6 +63,6 @@ EblMtftp (
|
||||
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
|
||||
IN BOOLEAN DontUseBuffer
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
Library functions that perform file IO. Memory buffer, file system, and
|
||||
fimrware volume operations are supproted.
|
||||
Library functions that perform file IO. Memory buffer, file system, and
|
||||
fimrware volume operations are supproted.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
@@ -18,7 +18,7 @@
|
||||
current mounted device concept of current working directory concept implement
|
||||
by this library.
|
||||
|
||||
Device names are case insensative and only check the leading characters for
|
||||
Device names are case insensative and only check the leading characters for
|
||||
unique matches. Thus the following are all the same:
|
||||
LoadFile0:
|
||||
l0:
|
||||
@@ -32,7 +32,7 @@
|
||||
fs3: - EFI Simple File System device 3
|
||||
Fv2: - EFI Firmware VOlume device 2
|
||||
1.2.3.4:name - TFTP IP and file name
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __EFI_FILE_LIB_H__
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
#define MAX_PATHNAME 0x200
|
||||
|
||||
/// Type of the file that has been opened
|
||||
/// Type of the file that has been opened
|
||||
typedef enum {
|
||||
EfiOpenLoadFile,
|
||||
EfiOpenMemoryBuffer,
|
||||
@@ -64,11 +64,11 @@ typedef enum {
|
||||
|
||||
/// Public information about the open file
|
||||
typedef struct {
|
||||
UINTN Version; // Common information
|
||||
UINTN Version; // Common information
|
||||
EFI_OPEN_FILE_TYPE Type;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS LastError;
|
||||
EFI_HANDLE EfiHandle;
|
||||
EFI_HANDLE EfiHandle;
|
||||
CHAR8 *DeviceName;
|
||||
CHAR8 *FileName;
|
||||
|
||||
@@ -76,18 +76,18 @@ typedef struct {
|
||||
UINT64 MaxPosition;
|
||||
|
||||
UINTN BaseOffset; // Base offset for hexdump command
|
||||
|
||||
|
||||
UINTN Size; // Valid for all types other than l#:
|
||||
UINT8 *Buffer; // Information valid for A#:
|
||||
|
||||
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; // Information valid for Fv#:
|
||||
EFI_GUID FvNameGuid;
|
||||
EFI_SECTION_TYPE FvSectionType;
|
||||
EFI_FV_FILETYPE FvType;
|
||||
EFI_FV_FILE_ATTRIBUTES FvAttributes;
|
||||
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; // Information valid for Fv#:
|
||||
EFI_GUID FvNameGuid;
|
||||
EFI_SECTION_TYPE FvSectionType;
|
||||
EFI_FV_FILETYPE FvType;
|
||||
EFI_FV_FILE_ATTRIBUTES FvAttributes;
|
||||
|
||||
EFI_PHYSICAL_ADDRESS FvStart;
|
||||
UINTN FvSize;
|
||||
EFI_PHYSICAL_ADDRESS FvStart;
|
||||
UINTN FvSize;
|
||||
UINTN FvHeaderSize;
|
||||
|
||||
EFI_FILE *FsFileHandle; // Information valid for Fs#:
|
||||
@@ -99,11 +99,11 @@ typedef struct {
|
||||
UINTN DiskOffset; // Information valid for B#:
|
||||
|
||||
EFI_LOAD_FILE_PROTOCOL *LoadFile; // Information valid for l#:
|
||||
|
||||
|
||||
EFI_IP_ADDRESS ServerIp; // Information valid for t:
|
||||
BOOLEAN IsDirty;
|
||||
BOOLEAN IsBufferValid;
|
||||
|
||||
|
||||
} EFI_OPEN_FILE;
|
||||
|
||||
|
||||
@@ -117,17 +117,17 @@ typedef enum {
|
||||
|
||||
|
||||
/**
|
||||
Open a device named by PathName. The PathName includes a device name and
|
||||
Open a device named by PathName. The PathName includes a device name and
|
||||
path separated by a :. See file header for more details on the PathName
|
||||
syntax. There is no checking to prevent a file from being opened more than
|
||||
one type.
|
||||
one type.
|
||||
|
||||
SectionType is only used to open an FV. Each file in an FV contains multiple
|
||||
sections and only the SectionType section is opened.
|
||||
|
||||
For any file that is opened with EfiOpen() must be closed with EfiClose().
|
||||
|
||||
@param PathName Path to parse to open
|
||||
@param PathName Path to parse to open
|
||||
@param OpenMode Same as EFI_FILE.Open()
|
||||
@param SectionType Section in FV to open.
|
||||
|
||||
@@ -182,9 +182,9 @@ EfiClose (
|
||||
|
||||
|
||||
/**
|
||||
Return the size of the file represented by Stream. Also return the current
|
||||
Return the size of the file represented by Stream. Also return the current
|
||||
Seek position. Opening a file will enable a valid file size to be returned.
|
||||
LoadFile is an exception as a load file size is set to zero.
|
||||
LoadFile is an exception as a load file size is set to zero.
|
||||
|
||||
@param Stream Open File Handle
|
||||
|
||||
@@ -200,16 +200,16 @@ EfiTell (
|
||||
|
||||
/**
|
||||
Seek to the Offset location in the file. LoadFile and FV device types do
|
||||
not support EfiSeek(). It is not possible to grow the file size using
|
||||
not support EfiSeek(). It is not possible to grow the file size using
|
||||
EfiSeek().
|
||||
|
||||
|
||||
SeekType defines how use Offset to calculate the new file position:
|
||||
EfiSeekStart : Position = Offset
|
||||
EfiSeekCurrent: Position is Offset bytes from the current position
|
||||
EfiSeekEnd : Only supported if Offset is zero to seek to end of file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Offset Offset to seek too.
|
||||
@param Offset Offset to seek too.
|
||||
@param SeekType Type of seek to perform
|
||||
|
||||
|
||||
@@ -229,10 +229,10 @@ EfiSeek (
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from the current location in the file. For load file
|
||||
and FV case you must read the entire file.
|
||||
and FV case you must read the entire file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Caller allocated buffer.
|
||||
@param Buffer Caller allocated buffer.
|
||||
@param BufferSize Size of buffer in bytes.
|
||||
|
||||
|
||||
@@ -253,13 +253,13 @@ EfiRead (
|
||||
|
||||
/**
|
||||
Read the entire file into a buffer. This routine allocates the buffer and
|
||||
returns it to the user full of the read data.
|
||||
returns it to the user full of the read data.
|
||||
|
||||
This is very useful for load file where it's hard to know how big the buffer
|
||||
must be.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param BufferSize Pointer to Size of buffer return..
|
||||
|
||||
|
||||
@@ -279,10 +279,10 @@ EfiReadAllocatePool (
|
||||
|
||||
|
||||
/**
|
||||
Write data back to the file.
|
||||
Write data back to the file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param BufferSize Pointer to Size of buffer return..
|
||||
|
||||
|
||||
@@ -313,12 +313,12 @@ UINTN
|
||||
EfiGetDeviceCounts (
|
||||
IN EFI_OPEN_FILE_TYPE Type
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set the Current Working Directory (CWD). If a call is made to EfiOpen () and
|
||||
the path does not contain a device name, The CWD is prepended to the path.
|
||||
|
||||
|
||||
@param Cwd Current Working Directory to set
|
||||
|
||||
|
||||
@@ -329,22 +329,22 @@ EfiGetDeviceCounts (
|
||||
EFI_STATUS
|
||||
EfiSetCwd (
|
||||
IN CHAR8 *Cwd
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Current Working Directory (CWD). If a call is made to EfiOpen () and
|
||||
the path does not contain a device name, The CWD is prepended to the path.
|
||||
|
||||
@param Cwd Current Working Directory
|
||||
|
||||
@param Cwd Current Working Directory
|
||||
|
||||
|
||||
@return NULL No CWD set
|
||||
@return 'other' malloc'ed buffer contains CWD.
|
||||
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EfiGetCwd (
|
||||
VOID
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -36,7 +36,7 @@ LibResetSystem (
|
||||
IN UINTN DataSize,
|
||||
IN CHAR16 *ResetData OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ LibResetSystem (
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data buts, and stop bits on a serial device. This call is optional as the serial
|
||||
port will be set up with defaults base on PCD values.
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
GdbSerialInit (
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
);
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ GdbSerialInit (
|
||||
|
||||
@return TRUE - Character availible
|
||||
@return FALSE - Character not availible
|
||||
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
@@ -65,7 +65,7 @@ GdbIsCharAvailable (
|
||||
Get a character from GDB. This function must be able to run in interrupt context.
|
||||
|
||||
@return A character from GDB
|
||||
|
||||
|
||||
**/
|
||||
CHAR8
|
||||
EFIAPI
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -33,7 +33,7 @@ PrePeiGetHobList (
|
||||
Updates the pointer to the HOB list.
|
||||
|
||||
@param HobList Hob list pointer to store
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@@ -83,7 +83,7 @@ FfsFindSectionData (
|
||||
|
||||
/**
|
||||
Find a file in the volume by name
|
||||
|
||||
|
||||
@param FileName A pointer to the name of the file to
|
||||
find within the firmware volume.
|
||||
|
||||
@@ -117,15 +117,15 @@ FfsFindByName (
|
||||
information.
|
||||
|
||||
@retval EFI_SUCCESS File information returned.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileHandle does not
|
||||
represent a valid file.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EFIAPI
|
||||
FfsGetFileInfo (
|
||||
IN CONST EFI_PEI_FILE_HANDLE FileHandle,
|
||||
OUT EFI_FV_FILE_INFO *FileInfo
|
||||
@@ -141,10 +141,10 @@ FfsGetFileInfo (
|
||||
information.
|
||||
|
||||
@retval EFI_SUCCESS File information returned.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileHandle does not
|
||||
represent a valid file.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
|
||||
|
||||
**/
|
||||
@@ -180,7 +180,7 @@ FfsProcessFvFile (
|
||||
@param FileType File handle of a Fv type file.
|
||||
@param Volumehandle On succes Volume Handle of the match
|
||||
@param FileHandle On success File Handle of the match
|
||||
|
||||
|
||||
@retval EFI_NOT_FOUND FV image can't be found.
|
||||
@retval EFI_SUCCESS Successfully found FileType
|
||||
|
||||
@@ -212,10 +212,10 @@ FfsProcessFvFile (
|
||||
|
||||
|
||||
/**
|
||||
This service enables PEIMs to ascertain the present value of the boot mode.
|
||||
This service enables PEIMs to ascertain the present value of the boot mode.
|
||||
|
||||
|
||||
@retval BootMode
|
||||
@retval BootMode
|
||||
|
||||
**/
|
||||
EFI_BOOT_MODE
|
||||
@@ -226,7 +226,7 @@ GetBootMode (
|
||||
|
||||
|
||||
/**
|
||||
This service enables PEIMs to update the boot mode variable.
|
||||
This service enables PEIMs to update the boot mode variable.
|
||||
|
||||
@param BootMode The value of the boot mode to set.
|
||||
|
||||
@@ -251,7 +251,7 @@ SetBootMode (
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetHobList (
|
||||
VOID
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ GetHobList (
|
||||
Updates the pointer to the HOB list.
|
||||
|
||||
@param HobList Hob list pointer to store
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -313,7 +313,7 @@ CreateHob (
|
||||
/**
|
||||
Returns the next instance of a HOB type from the starting HOB.
|
||||
|
||||
This function searches the first instance of a HOB type from the starting HOB pointer.
|
||||
This function searches the first instance of a HOB type from the starting HOB pointer.
|
||||
If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
unconditionally: it returns HobStart back if HobStart itself meets the requirement;
|
||||
@@ -336,8 +336,8 @@ GetNextHob (
|
||||
/**
|
||||
Returns the first instance of a HOB type among the whole HOB list.
|
||||
|
||||
This function searches the first instance of a HOB type among the whole HOB list.
|
||||
If there does not exist such HOB type in the HOB list, it will return NULL.
|
||||
This function searches the first instance of a HOB type among the whole HOB list.
|
||||
If there does not exist such HOB type in the HOB list, it will return NULL.
|
||||
|
||||
@param Type The HOB type to return.
|
||||
|
||||
@@ -351,10 +351,10 @@ GetFirstHob (
|
||||
);
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB from the starting HOB pointer.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
This function searches the first instance of a HOB from the starting HOB pointer.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
|
||||
to extract the data section and its size info respectively.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
@@ -377,7 +377,7 @@ GetNextGuidHob (
|
||||
);
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB among the whole HOB list.
|
||||
This function searches the first instance of a HOB among the whole HOB list.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
@@ -447,8 +447,8 @@ BuildResourceDescriptorHob (
|
||||
/**
|
||||
Builds a GUID HOB with a certain data length.
|
||||
|
||||
This function builds a customized HOB tagged with a GUID for identification
|
||||
and returns the start address of GUID HOB data so that caller can fill the customized data.
|
||||
This function builds a customized HOB tagged with a GUID for identification
|
||||
and returns the start address of GUID HOB data so that caller can fill the customized data.
|
||||
The HOB Header and Name field is already stripped.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
@@ -517,7 +517,7 @@ BuildFvHob (
|
||||
);
|
||||
|
||||
/**
|
||||
Builds a Firmware Volume HOB and a resrouce descriptor hob
|
||||
Builds a Firmware Volume HOB and a resrouce descriptor hob
|
||||
|
||||
This function builds a Firmware Volume HOB.
|
||||
It can only be invoked during PEI phase;
|
||||
@@ -530,11 +530,11 @@ BuildFvHob (
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildFvHobs (
|
||||
BuildFvHobs (
|
||||
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
|
||||
IN UINT64 NumberOfBytes,
|
||||
IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute OPTIONAL
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
@@ -549,7 +549,7 @@ BuildFvHobs (
|
||||
@param Length The size of the Firmware Volume in bytes.
|
||||
@param FvName The name of the Firmware Volume.
|
||||
@param FileName The name of the file.
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -702,12 +702,12 @@ BuildPeCoffLoaderHob (
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocatePages (
|
||||
IN UINTN Pages
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiBootServicesData.
|
||||
|
||||
@@ -725,8 +725,8 @@ EFIAPI
|
||||
AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
Implement EFI RealTimeClock runtime services via Lib.
|
||||
|
||||
|
||||
Currently this driver does not support runtime virtual calling.
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2012, ARM Ltd. All rights reserved.
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
Protocol is used to help implement DebugSupport.RegisterPeriodicCallback() functionality.
|
||||
This enables the DXE timer driver to support the periodic callback function so the
|
||||
This enables the DXE timer driver to support the periodic callback function so the
|
||||
DebugSupport driver does not need to contain platform specific information about how a timer
|
||||
works.
|
||||
|
||||
@@ -39,4 +39,4 @@ struct _EFI_DEBUG_SUPPORT_PERIODIC_CALLBACK_PROTOCOL {
|
||||
|
||||
extern EFI_GUID gEfiDebugSupportPeriodicCallbackProtocolGuid;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -46,7 +46,7 @@ typedef struct {
|
||||
|
||||
/**
|
||||
Add a single command table entry.
|
||||
|
||||
|
||||
@param EntryArray Pointer EBL_COMMAND_TABLE of the command that is being added
|
||||
|
||||
**/
|
||||
@@ -73,7 +73,7 @@ VOID
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EBL_GET_CHAR_CALL_BACK) (
|
||||
IN UINTN ElapsedTime
|
||||
@@ -86,13 +86,13 @@ VOID
|
||||
|
||||
@param Key EFI Key information returned
|
||||
@param TimeoutInSec Number of seconds to wait to timeout
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
|
||||
@return EFI_SUCCESS Key was returned
|
||||
@return EFI_TIMEOUT If the TimoutInSec expired
|
||||
|
||||
**/
|
||||
typedef
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EBL_GET_CHAR_KEY) (
|
||||
IN OUT EFI_INPUT_KEY *Key,
|
||||
@@ -108,7 +108,7 @@ EFI_STATUS
|
||||
If the use hits Q to quit return TRUE else for any other key return FALSE.
|
||||
PrefixNewline is used to figure out if a newline is needed before the prompt
|
||||
string. This depends on the last print done before calling this function.
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
needed.
|
||||
|
||||
@param CurrentRow Used to figure out if its the end of the page and updated
|
||||
|
@@ -1,16 +1,16 @@
|
||||
/** @file
|
||||
Deal with devices that just exist in memory space.
|
||||
|
||||
|
||||
To follow the EFI driver model you need a root handle to start with. An
|
||||
EFI driver will have a driver binding protocol (Supported, Start, Stop)
|
||||
that is used to layer on top of a handle via a gBS->ConnectController.
|
||||
EFI driver will have a driver binding protocol (Supported, Start, Stop)
|
||||
that is used to layer on top of a handle via a gBS->ConnectController.
|
||||
The first handle has to just be in the system to make that work. For
|
||||
PCI it is a PCI Root Bridge IO protocol that provides the root.
|
||||
|
||||
On an embedded system with MMIO device we need a handle to just
|
||||
show up. That handle will have this protocol and a device path
|
||||
protocol on it.
|
||||
|
||||
PCI it is a PCI Root Bridge IO protocol that provides the root.
|
||||
|
||||
On an embedded system with MMIO device we need a handle to just
|
||||
show up. That handle will have this protocol and a device path
|
||||
protocol on it.
|
||||
|
||||
For an ethernet device the device path must contain a MAC address device path
|
||||
node.
|
||||
|
||||
|
@@ -48,7 +48,7 @@ Arguments:
|
||||
Offset - starting register number
|
||||
Length - number of bytes to read
|
||||
Buffer - destination buffer
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - registers read successfully
|
||||
@@ -76,7 +76,7 @@ Arguments:
|
||||
Offset - starting register number
|
||||
Length - number of bytes to write
|
||||
Buffer - source buffer
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - registers written successfully
|
||||
|
@@ -68,7 +68,7 @@ Arguments:
|
||||
This - pointer to protocol
|
||||
Gpio - which pin to read
|
||||
Value - state of the pin
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GPIO state returned in Value
|
||||
@@ -94,7 +94,7 @@ Arguments:
|
||||
This - pointer to protocol
|
||||
Gpio - which pin to modify
|
||||
Mode - mode to set
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GPIO set as requested
|
||||
@@ -120,7 +120,7 @@ Arguments:
|
||||
This - pointer to protocol
|
||||
Gpio - which pin
|
||||
Mode - pointer to output mode value
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - mode value retrieved
|
||||
@@ -146,7 +146,7 @@ Arguments:
|
||||
This - pointer to protocol
|
||||
Gpio - which pin
|
||||
Direction - pull-up, pull-down, or none
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - pin was set
|
||||
@@ -164,4 +164,4 @@ struct _EMBEDDED_GPIO {
|
||||
|
||||
extern EFI_GUID gEmbeddedGpioProtocolGuid;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Abstraction for hardware based interrupt routine
|
||||
|
||||
|
||||
On non IA-32 systems it is common to have a single hardware interrupt vector
|
||||
and a 2nd layer of software that routes the interrupt handlers based on the
|
||||
interrupt source. This protocol enables this routing. The driver implementing
|
||||
this protocol is responsible for clearing the pending interrupt in the
|
||||
interrupt routing hardware. The HARDWARE_INTERRUPT_HANDLER is responsible
|
||||
interrupt source. This protocol enables this routing. The driver implementing
|
||||
this protocol is responsible for clearing the pending interrupt in the
|
||||
interrupt routing hardware. The HARDWARE_INTERRUPT_HANDLER is responsible
|
||||
for clearing interrupt sources from individual devices.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef UINTN HARDWARE_INTERRUPT_SOURCE;
|
||||
@param Source Source of the interrupt. Hardware routing off a specific platform defines
|
||||
what source means.
|
||||
@param SystemContext Pointer to system register context. Mostly used by debuggers and will
|
||||
update the system context after the return from the interrupt if
|
||||
update the system context after the return from the interrupt if
|
||||
modified. Don't change these values unless you know what you are doing
|
||||
|
||||
**/
|
||||
@@ -56,7 +56,7 @@ typedef
|
||||
VOID
|
||||
(EFIAPI *HARDWARE_INTERRUPT_HANDLER) (
|
||||
IN HARDWARE_INTERRUPT_SOURCE Source,
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
@@ -133,11 +133,11 @@ EFI_STATUS
|
||||
(EFIAPI *HARDWARE_INTERRUPT_INTERRUPT_STATE) (
|
||||
IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
|
||||
IN HARDWARE_INTERRUPT_SOURCE Source,
|
||||
IN BOOLEAN *InterruptState
|
||||
IN BOOLEAN *InterruptState
|
||||
);
|
||||
|
||||
/**
|
||||
Signal to the hardware that the End Of Intrrupt state
|
||||
Signal to the hardware that the End Of Intrrupt state
|
||||
has been reached.
|
||||
|
||||
@param This Instance pointer for this protocol
|
||||
|
@@ -2,14 +2,14 @@
|
||||
Definition of the MMC Host Protocol
|
||||
|
||||
Copyright (c) 2011-2014, ARM Limited. All rights reserved.
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -30,16 +30,16 @@ typedef struct _PE_COFF_LOADER_PROTOCOL PE_COFF_LOADER_PROTOCOL;
|
||||
/**
|
||||
Retrieves information about a PE/COFF image.
|
||||
|
||||
Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and
|
||||
DebugDirectoryEntryRva fields of the ImageContext structure.
|
||||
If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
|
||||
If the PE/COFF image accessed through the ImageRead service in the ImageContext
|
||||
structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED.
|
||||
If any errors occur while computing the fields of ImageContext,
|
||||
then the error status is returned in the ImageError field of ImageContext.
|
||||
Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and
|
||||
DebugDirectoryEntryRva fields of the ImageContext structure.
|
||||
If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
|
||||
If the PE/COFF image accessed through the ImageRead service in the ImageContext
|
||||
structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED.
|
||||
If any errors occur while computing the fields of ImageContext,
|
||||
then the error status is returned in the ImageError field of ImageContext.
|
||||
If the image is a TE image, then SectionAlignment is set to 0.
|
||||
The ImageRead and Handle fields of ImageContext structure must be valid prior
|
||||
The ImageRead and Handle fields of ImageContext structure must be valid prior
|
||||
to invoking this service.
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
@@ -64,12 +64,12 @@ RETURN_STATUS
|
||||
ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
|
||||
of ImageContext as the relocation base address. The caller must allocate the relocation
|
||||
fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
|
||||
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress,
|
||||
ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders,
|
||||
DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of
|
||||
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress,
|
||||
ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders,
|
||||
DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of
|
||||
the ImageContext structure must be valid prior to invoking this service.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
@@ -101,10 +101,10 @@ RETURN_STATUS
|
||||
specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
|
||||
the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
|
||||
The EntryPoint, FixupDataSize, CodeView, PdbPointer and HiiResourceData fields of ImageContext are computed.
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
|
||||
fields of the ImageContext structure must be valid prior to invoking this service.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
@@ -135,25 +135,25 @@ RETURN_STATUS
|
||||
|
||||
/**
|
||||
Reads contents of a PE/COFF image from a buffer in system memory.
|
||||
|
||||
This is the default implementation of a PE_COFF_LOADER_READ_FILE function
|
||||
that assumes FileHandle pointer to the beginning of a PE/COFF image.
|
||||
This function reads contents of the PE/COFF image that starts at the system memory
|
||||
address specified by FileHandle. The read operation copies ReadSize bytes from the
|
||||
PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
|
||||
|
||||
This is the default implementation of a PE_COFF_LOADER_READ_FILE function
|
||||
that assumes FileHandle pointer to the beginning of a PE/COFF image.
|
||||
This function reads contents of the PE/COFF image that starts at the system memory
|
||||
address specified by FileHandle. The read operation copies ReadSize bytes from the
|
||||
PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
|
||||
The size of the buffer actually read is returned in ReadSize.
|
||||
|
||||
|
||||
If FileHandle is NULL, then ASSERT().
|
||||
If ReadSize is NULL, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
@param FileHandle Pointer to base of the input stream
|
||||
@param FileOffset Offset into the PE/COFF image to begin the read operation.
|
||||
@param ReadSize On input, the size in bytes of the requested read operation.
|
||||
@param ReadSize On input, the size in bytes of the requested read operation.
|
||||
On output, the number of bytes actually read.
|
||||
@param Buffer Output buffer that contains the data read from the PE/COFF image.
|
||||
|
||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||
the buffer.
|
||||
**/
|
||||
typedef
|
||||
@@ -169,26 +169,26 @@ RETURN_STATUS
|
||||
|
||||
/**
|
||||
Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI
|
||||
runtime.
|
||||
|
||||
This function reapplies relocation fixups to the PE/COFF image specified by ImageBase
|
||||
and ImageSize so the image will execute correctly when the PE/COFF image is mapped
|
||||
to the address specified by VirtualImageBase. RelocationData must be identical
|
||||
to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure
|
||||
runtime.
|
||||
|
||||
This function reapplies relocation fixups to the PE/COFF image specified by ImageBase
|
||||
and ImageSize so the image will execute correctly when the PE/COFF image is mapped
|
||||
to the address specified by VirtualImageBase. RelocationData must be identical
|
||||
to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure
|
||||
after this PE/COFF image was relocated with PeCoffLoaderRelocateImage().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
cache(s) in hardware, then the caller is responsible for performing cache maintenance operations
|
||||
prior to transferring control to a PE/COFF image that is loaded using this library.
|
||||
|
||||
@param ImageBase Base address of a PE/COFF image that has been loaded
|
||||
@param ImageBase Base address of a PE/COFF image that has been loaded
|
||||
and relocated into system memory.
|
||||
@param VirtImageBase The request virtual address that the PE/COFF image is to
|
||||
be fixed up for.
|
||||
@param ImageSize The size, in bytes, of the PE/COFF image.
|
||||
@param RelocationData A pointer to the relocation data that was collected when the PE/COFF
|
||||
@param RelocationData A pointer to the relocation data that was collected when the PE/COFF
|
||||
image was relocated using PeCoffLoaderRelocateImage().
|
||||
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
@@ -203,15 +203,15 @@ VOID
|
||||
|
||||
/**
|
||||
Unloads a loaded PE/COFF image from memory and releases its taken resource.
|
||||
Releases any environment specific resources that were allocated when the image
|
||||
specified by ImageContext was loaded using PeCoffLoaderLoadImage().
|
||||
|
||||
Releases any environment specific resources that were allocated when the image
|
||||
specified by ImageContext was loaded using PeCoffLoaderLoadImage().
|
||||
|
||||
For NT32 emulator, the PE/COFF image loaded by system needs to release.
|
||||
For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
|
||||
For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
|
||||
this function can simply return RETURN_SUCCESS.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image to be unloaded.
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
program with the debugger.
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -31,14 +31,14 @@ DebugAgentTimerIntialize (
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set the period for the debug agent timer. Zero means disable the timer.
|
||||
|
||||
@param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.
|
||||
|
||||
**/
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentTimerSetPeriod (
|
||||
@@ -46,13 +46,13 @@ DebugAgentTimerSetPeriod (
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Perform End Of Interrupt for the debug agent timer. This is called in the
|
||||
interrupt handler after the interrupt has been processed.
|
||||
Perform End Of Interrupt for the debug agent timer. This is called in the
|
||||
interrupt handler after the interrupt has been processed.
|
||||
|
||||
**/
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentTimerEndOfInterrupt (
|
||||
@@ -60,5 +60,4 @@ DebugAgentTimerEndOfInterrupt (
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/** @file
|
||||
PE/COFF Loader Library implementation that wraps a protocol passed up from
|
||||
PE/COFF Loader Library implementation that wraps a protocol passed up from
|
||||
SEC/PEI via a HOB. This is done to save space.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
@@ -27,16 +27,16 @@ PE_COFF_LOADER_PROTOCOL *gPeCoffLoader = NULL;
|
||||
/**
|
||||
Retrieves information about a PE/COFF image.
|
||||
|
||||
Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and
|
||||
DebugDirectoryEntryRva fields of the ImageContext structure.
|
||||
If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
|
||||
If the PE/COFF image accessed through the ImageRead service in the ImageContext
|
||||
structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED.
|
||||
If any errors occur while computing the fields of ImageContext,
|
||||
then the error status is returned in the ImageError field of ImageContext.
|
||||
Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and
|
||||
DebugDirectoryEntryRva fields of the ImageContext structure.
|
||||
If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
|
||||
If the PE/COFF image accessed through the ImageRead service in the ImageContext
|
||||
structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED.
|
||||
If any errors occur while computing the fields of ImageContext,
|
||||
then the error status is returned in the ImageError field of ImageContext.
|
||||
If the image is a TE image, then SectionAlignment is set to 0.
|
||||
The ImageRead and Handle fields of ImageContext structure must be valid prior
|
||||
The ImageRead and Handle fields of ImageContext structure must be valid prior
|
||||
to invoking this service.
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
@@ -64,12 +64,12 @@ PeCoffLoaderGetImageInfo (
|
||||
ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
|
||||
of ImageContext as the relocation base address. The caller must allocate the relocation
|
||||
fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
|
||||
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress,
|
||||
ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders,
|
||||
DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of
|
||||
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress,
|
||||
ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders,
|
||||
DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of
|
||||
the ImageContext structure must be valid prior to invoking this service.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
@@ -103,10 +103,10 @@ PeCoffLoaderRelocateImage (
|
||||
specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
|
||||
the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
|
||||
The EntryPoint, FixupDataSize, CodeView, PdbPointer and HiiResourceData fields of ImageContext are computed.
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
|
||||
The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize,
|
||||
DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
|
||||
fields of the ImageContext structure must be valid prior to invoking this service.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
@@ -140,25 +140,25 @@ PeCoffLoaderLoadImage (
|
||||
|
||||
/**
|
||||
Reads contents of a PE/COFF image from a buffer in system memory.
|
||||
|
||||
This is the default implementation of a PE_COFF_LOADER_READ_FILE function
|
||||
that assumes FileHandle pointer to the beginning of a PE/COFF image.
|
||||
This function reads contents of the PE/COFF image that starts at the system memory
|
||||
address specified by FileHandle. The read operation copies ReadSize bytes from the
|
||||
PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
|
||||
|
||||
This is the default implementation of a PE_COFF_LOADER_READ_FILE function
|
||||
that assumes FileHandle pointer to the beginning of a PE/COFF image.
|
||||
This function reads contents of the PE/COFF image that starts at the system memory
|
||||
address specified by FileHandle. The read operation copies ReadSize bytes from the
|
||||
PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
|
||||
The size of the buffer actually read is returned in ReadSize.
|
||||
|
||||
|
||||
If FileHandle is NULL, then ASSERT().
|
||||
If ReadSize is NULL, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
@param FileHandle Pointer to base of the input stream
|
||||
@param FileOffset Offset into the PE/COFF image to begin the read operation.
|
||||
@param ReadSize On input, the size in bytes of the requested read operation.
|
||||
@param ReadSize On input, the size in bytes of the requested read operation.
|
||||
On output, the number of bytes actually read.
|
||||
@param Buffer Output buffer that contains the data read from the PE/COFF image.
|
||||
|
||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||
the buffer.
|
||||
**/
|
||||
RETURN_STATUS
|
||||
@@ -176,33 +176,33 @@ PeCoffLoaderImageReadFromMemory (
|
||||
ReadSize,
|
||||
Buffer
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI
|
||||
runtime.
|
||||
|
||||
This function reapplies relocation fixups to the PE/COFF image specified by ImageBase
|
||||
and ImageSize so the image will execute correctly when the PE/COFF image is mapped
|
||||
to the address specified by VirtualImageBase. RelocationData must be identical
|
||||
to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure
|
||||
runtime.
|
||||
|
||||
This function reapplies relocation fixups to the PE/COFF image specified by ImageBase
|
||||
and ImageSize so the image will execute correctly when the PE/COFF image is mapped
|
||||
to the address specified by VirtualImageBase. RelocationData must be identical
|
||||
to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure
|
||||
after this PE/COFF image was relocated with PeCoffLoaderRelocateImage().
|
||||
|
||||
Note that if the platform does not maintain coherency between the instruction cache(s) and the data
|
||||
cache(s) in hardware, then the caller is responsible for performing cache maintenance operations
|
||||
prior to transferring control to a PE/COFF image that is loaded using this library.
|
||||
|
||||
@param ImageBase Base address of a PE/COFF image that has been loaded
|
||||
@param ImageBase Base address of a PE/COFF image that has been loaded
|
||||
and relocated into system memory.
|
||||
@param VirtImageBase The request virtual address that the PE/COFF image is to
|
||||
be fixed up for.
|
||||
@param ImageSize The size, in bytes, of the PE/COFF image.
|
||||
@param RelocationData A pointer to the relocation data that was collected when the PE/COFF
|
||||
@param RelocationData A pointer to the relocation data that was collected when the PE/COFF
|
||||
image was relocated using PeCoffLoaderRelocateImage().
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -224,15 +224,15 @@ PeCoffLoaderRelocateImageForRuntime (
|
||||
|
||||
/**
|
||||
Unloads a loaded PE/COFF image from memory and releases its taken resource.
|
||||
Releases any environment specific resources that were allocated when the image
|
||||
specified by ImageContext was loaded using PeCoffLoaderLoadImage().
|
||||
|
||||
Releases any environment specific resources that were allocated when the image
|
||||
specified by ImageContext was loaded using PeCoffLoaderLoadImage().
|
||||
|
||||
For NT32 emulator, the PE/COFF image loaded by system needs to release.
|
||||
For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
|
||||
For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
|
||||
this function can simply return RETURN_SUCCESS.
|
||||
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image to be unloaded.
|
||||
|
||||
@@ -280,7 +280,7 @@ DxeHobPeCoffLibConstructor (
|
||||
if (Hob == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
gPeCoffLoader = Hob->Interface;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#/** @file
|
||||
# PE/COFF Loader Library implementation that wraps a protocol passed up from
|
||||
# PE/COFF Loader Library implementation that wraps a protocol passed up from
|
||||
# SEC/PEI via a HOB. This is done to save space.
|
||||
#
|
||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
@@ -20,7 +20,7 @@
|
||||
FILE_GUID = 671C6FD7-99FB-4EE3-B640-4B1D463BC3B5
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeCoffLib
|
||||
LIBRARY_CLASS = PeCoffLib
|
||||
CONSTRUCTOR = DxeHobPeCoffLibConstructor
|
||||
|
||||
|
||||
|
@@ -36,7 +36,7 @@ EBL_ADD_COMMAND_PROTOCOL *gEblExternalCommand = NULL;
|
||||
|
||||
@param Key EFI Key information returned
|
||||
@param TimeoutInSec Number of seconds to wait to timeout
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
@param CallBack Callback called every second during the timeout wait
|
||||
|
||||
@return EFI_SUCCESS Key was returned
|
||||
@return EFI_TIMEOUT If the TimoutInSec expired
|
||||
@@ -64,7 +64,7 @@ EblGetCharKey (
|
||||
If the use hits Q to quit return TRUE else for any other key return FALSE.
|
||||
PrefixNewline is used to figure out if a newline is needed before the prompt
|
||||
string. This depends on the last print done before calling this function.
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
CurrentRow is updated by one on a call or set back to zero if a prompt is
|
||||
needed.
|
||||
|
||||
@param CurrentRow Used to figure out if its the end of the page and updated
|
||||
@@ -118,12 +118,12 @@ EblAddCommandNotificationEvent (
|
||||
|
||||
/**
|
||||
The user Entry Point for the driver. The user code starts with this function
|
||||
as the real entry point for the image goes into a library that calls this
|
||||
as the real entry point for the image goes into a library that calls this
|
||||
function.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||
@retval other Some error occurs when executing this entry point.
|
||||
|
||||
@@ -141,7 +141,7 @@ EblAddExternalCommands (
|
||||
|
||||
mAddExternalCmdLibTemplate = EntryArray;
|
||||
mAddExternalCmdLibTemplateSize = ArrayCount;
|
||||
|
||||
|
||||
EfiCreateProtocolNotifyEvent (
|
||||
&gEfiEblAddCommandProtocolGuid,
|
||||
TPL_CALLBACK,
|
||||
@@ -149,7 +149,7 @@ EblAddExternalCommands (
|
||||
NULL,
|
||||
&mEblCommandRegistration
|
||||
);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
FILE_GUID = 9195D970-C6F7-484E-8013-5B03C89C3B81
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = EblAddExternalCommandLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
LIBRARY_CLASS = EblAddExternalCommandLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
|
||||
|
||||
#
|
||||
@@ -40,9 +40,8 @@
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
EblAddExternalCommandLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiEblAddCommandProtocolGuid
|
||||
|
||||
|
||||
[Guids]
|
||||
|
@@ -20,7 +20,7 @@
|
||||
FILE_GUID = 3513C4E2-06D6-4921-9C2B-E938777BA79E
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = EfiCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
LIBRARY_CLASS = EfiCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
|
||||
|
||||
#
|
||||
@@ -37,8 +37,7 @@
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
|
||||
|
||||
[Protocols]
|
||||
|
||||
|
||||
[Guids]
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -32,7 +32,7 @@ EblGetCurrentIpAddress (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
@@ -76,13 +76,13 @@ EblLoadFileBootTypeString (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *NullPtr;
|
||||
|
||||
|
||||
Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, &NullPtr);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return "EFI PXE Network Boot";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
@@ -93,7 +93,7 @@ EblPerformDHCP (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
@@ -118,7 +118,7 @@ EblSetStationIp (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
@@ -128,12 +128,12 @@ EblSetStationIp (
|
||||
if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = Pxe->SetStationIp (Pxe, NewStationIp, NewSubnetMask);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EblMtftp (
|
||||
@@ -150,12 +150,12 @@ EblMtftp (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = Pxe->Mtftp (
|
||||
Pxe,
|
||||
Operation,
|
||||
@@ -170,4 +170,4 @@ EblMtftp (
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
@@ -31,4 +31,4 @@
|
||||
gEfiPxeBaseCodeProtocolGuid
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
TRUE
|
||||
|
@@ -34,19 +34,19 @@ Fv2: - EFI Firmware VOlume device 2
|
||||
**/
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/DiskIo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/DiskIo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadFile.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
#include <Guid/FileInfo.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
@@ -210,7 +210,7 @@ EblUpdateDeviceLists (
|
||||
/**
|
||||
PathName is in the form <device name>:<path> for example fs1:\ or ROOT:\.
|
||||
Return TRUE if the <devce name> prefix of PathName matches a file system
|
||||
Volume Name. MatchIndex is the array index in mFsInfo[] of the match,
|
||||
Volume Name. MatchIndex is the array index in mFsInfo[] of the match,
|
||||
and it can be used with mFs[] to find the handle that needs to be opened
|
||||
|
||||
@param PathName PathName to check
|
||||
@@ -291,7 +291,7 @@ EfiGetDeviceCounts (
|
||||
|
||||
EFI_STATUS
|
||||
ConvertIpStringToEfiIp (
|
||||
IN CHAR8 *PathName,
|
||||
IN CHAR8 *PathName,
|
||||
OUT EFI_IP_ADDRESS *ServerIp
|
||||
)
|
||||
{
|
||||
@@ -326,7 +326,7 @@ ConvertIpStringToEfiIp (
|
||||
|
||||
|
||||
/**
|
||||
Internal work function to extract a device number from a string skipping
|
||||
Internal work function to extract a device number from a string skipping
|
||||
text. Easy way to extract numbers from strings like blk7:.
|
||||
|
||||
@param Str String to extract device number form
|
||||
@@ -344,7 +344,7 @@ EblConvertDevStringToNumber (
|
||||
UINTN Index;
|
||||
|
||||
|
||||
// Find the first digit
|
||||
// Find the first digit
|
||||
Max = AsciiStrLen (Str);
|
||||
for (Index = 0; !((*Str >= '0') && (*Str <= '9')) && (Index < Max); Index++) {
|
||||
Str++;
|
||||
@@ -563,11 +563,11 @@ EblFvFileDevicePath (
|
||||
do {
|
||||
File->FvType = EFI_FV_FILETYPE_ALL;
|
||||
GetNextFileStatus = File->Fv->GetNextFile (
|
||||
File->Fv,
|
||||
File->Fv,
|
||||
&Key,
|
||||
&File->FvType,
|
||||
&File->FvNameGuid,
|
||||
&File->FvAttributes,
|
||||
&File->FvType,
|
||||
&File->FvNameGuid,
|
||||
&File->FvAttributes,
|
||||
&File->Size
|
||||
);
|
||||
if (!EFI_ERROR (GetNextFileStatus)) {
|
||||
@@ -634,17 +634,17 @@ EblFvFileDevicePath (
|
||||
|
||||
|
||||
/**
|
||||
Open a device named by PathName. The PathName includes a device name and
|
||||
Open a device named by PathName. The PathName includes a device name and
|
||||
path separated by a :. See file header for more details on the PathName
|
||||
syntax. There is no checking to prevent a file from being opened more than
|
||||
one type.
|
||||
one type.
|
||||
|
||||
SectionType is only used to open an FV. Each file in an FV contains multiple
|
||||
sections and only the SectionType section is opened.
|
||||
|
||||
For any file that is opened with EfiOpen() must be closed with EfiClose().
|
||||
|
||||
@param PathName Path to parse to open
|
||||
@param PathName Path to parse to open
|
||||
@param OpenMode Same as EFI_FILE.Open()
|
||||
@param SectionType Section in FV to open.
|
||||
|
||||
@@ -711,7 +711,7 @@ EfiOpen (
|
||||
}
|
||||
|
||||
if ((PathName[0] == '/') || (PathName[0] == '\\')) {
|
||||
// PathName starts in / so this means we go to the root of the device in the CWD.
|
||||
// PathName starts in / so this means we go to the root of the device in the CWD.
|
||||
CwdPlusPathName[0] = '\0';
|
||||
for (FileStart = 0; gCwd[FileStart] != '\0'; FileStart++) {
|
||||
CwdPlusPathName[FileStart] = gCwd[FileStart];
|
||||
@@ -740,7 +740,7 @@ EfiOpen (
|
||||
return File;
|
||||
}
|
||||
|
||||
DevNumber = EblConvertDevStringToNumber ((CHAR8 *)PathName);
|
||||
DevNumber = EblConvertDevStringToNumber ((CHAR8 *)PathName);
|
||||
}
|
||||
|
||||
File->DeviceName = AllocatePool (StrLen);
|
||||
@@ -750,11 +750,11 @@ EfiOpen (
|
||||
if (File->FileName[0] == '\0') {
|
||||
// if it is just a file name use / as root
|
||||
File->FileName = "\\";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Use best match algorithm on the dev names so we only need to look at the
|
||||
// first few charters to match the full device name. Short name forms are
|
||||
// first few charters to match the full device name. Short name forms are
|
||||
// legal from the caller.
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
@@ -767,7 +767,7 @@ EfiOpen (
|
||||
File->EfiHandle = mFs[DevNumber];
|
||||
Status = EblFileDevicePath (File, &PathName[FileStart], OpenMode);
|
||||
|
||||
} else if (PathName[1] == 'v' || PathName[1] == 'V') {
|
||||
} else if (PathName[1] == 'v' || PathName[1] == 'V') {
|
||||
if (DevNumber >= mFvCount) {
|
||||
goto ErrorExit;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ EfiOpen (
|
||||
for (Index = FileStart; PathName[Index] != '\0'; Index++) {
|
||||
if (PathName[Index] == ':') {
|
||||
// Support fv0:\DxeCore:0x10
|
||||
// This means open the PE32 Section of the file
|
||||
// This means open the PE32 Section of the file
|
||||
ModifiedSectionType = (EFI_SECTION_TYPE)AsciiStrHexToUintn (&PathName[Index + 1]);
|
||||
PathName[Index] = '\0';
|
||||
}
|
||||
@@ -960,7 +960,7 @@ EfiCopyFile (
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Write file error %r\n", Status);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Any left over?
|
||||
@@ -977,7 +977,7 @@ EfiCopyFile (
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("Write file error\n");
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
@@ -1026,16 +1026,16 @@ EfiDeviceOpenByType (
|
||||
DevStr = "loadfile%d:";
|
||||
break;
|
||||
case EfiOpenFirmwareVolume:
|
||||
DevStr = "fv%d:";
|
||||
DevStr = "fv%d:";
|
||||
break;
|
||||
case EfiOpenFileSystem:
|
||||
DevStr = "fs%d:";
|
||||
DevStr = "fs%d:";
|
||||
break;
|
||||
case EfiOpenBlockIo:
|
||||
DevStr = "blk%d:";
|
||||
DevStr = "blk%d:";
|
||||
break;
|
||||
case EfiOpenMemoryBuffer:
|
||||
DevStr = "a%d:";
|
||||
DevStr = "a%d:";
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
@@ -1074,14 +1074,14 @@ EfiClose (
|
||||
|
||||
TftpBufferSize = File->Size;
|
||||
Status = EblMtftp (
|
||||
EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
|
||||
File->Buffer,
|
||||
TRUE,
|
||||
&TftpBufferSize,
|
||||
NULL,
|
||||
&File->ServerIp,
|
||||
(UINT8 *)File->FileName,
|
||||
NULL,
|
||||
EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
|
||||
File->Buffer,
|
||||
TRUE,
|
||||
&TftpBufferSize,
|
||||
NULL,
|
||||
&File->ServerIp,
|
||||
(UINT8 *)File->FileName,
|
||||
NULL,
|
||||
FALSE
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
@@ -1090,7 +1090,7 @@ EfiClose (
|
||||
}
|
||||
}
|
||||
|
||||
if ((File->Type == EfiOpenLoadFile) ||
|
||||
if ((File->Type == EfiOpenLoadFile) ||
|
||||
((File->Type == EfiOpenTftp) && (File->IsBufferValid == TRUE)) ||
|
||||
((File->Type == EfiOpenFirmwareVolume) && (File->IsBufferValid == TRUE))) {
|
||||
EblFreePool(File->Buffer);
|
||||
@@ -1112,9 +1112,9 @@ EfiClose (
|
||||
|
||||
|
||||
/**
|
||||
Return the size of the file represented by Stream. Also return the current
|
||||
Return the size of the file represented by Stream. Also return the current
|
||||
Seek position. Opening a file will enable a valid file size to be returned.
|
||||
LoadFile is an exception as a load file size is set to zero.
|
||||
LoadFile is an exception as a load file size is set to zero.
|
||||
|
||||
@param Stream Open File Handle
|
||||
|
||||
@@ -1176,7 +1176,7 @@ EfiTell (
|
||||
|
||||
/**
|
||||
Seek to the Offset location in the file. LoadFile and FV device types do
|
||||
not support EfiSeek(). It is not possible to grow the file size using
|
||||
not support EfiSeek(). It is not possible to grow the file size using
|
||||
EfiSeek().
|
||||
|
||||
SeekType defines how use Offset to calculate the new file position:
|
||||
@@ -1185,7 +1185,7 @@ EfiSeekCurrent: Position is Offset bytes from the current position
|
||||
EfiSeekEnd : Only supported if Offset is zero to seek to end of file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Offset Offset to seek too.
|
||||
@param Offset Offset to seek too.
|
||||
@param SeekType Type of seek to perform
|
||||
|
||||
|
||||
@@ -1278,14 +1278,14 @@ CacheTftpFile (
|
||||
TftpBufferSize = File->Size;
|
||||
|
||||
Status = EblMtftp (
|
||||
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
||||
File->Buffer,
|
||||
FALSE,
|
||||
&TftpBufferSize,
|
||||
NULL,
|
||||
&File->ServerIp,
|
||||
(UINT8 *)File->FileName,
|
||||
NULL,
|
||||
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
||||
File->Buffer,
|
||||
FALSE,
|
||||
&TftpBufferSize,
|
||||
NULL,
|
||||
&File->ServerIp,
|
||||
(UINT8 *)File->FileName,
|
||||
NULL,
|
||||
FALSE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
AsciiPrint("TFTP error during APPLE_NSP_TFTP_READ_FILE: %r\n", Status);
|
||||
@@ -1301,10 +1301,10 @@ CacheTftpFile (
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from the current location in the file. For load file,
|
||||
FV, and TFTP case you must read the entire file.
|
||||
FV, and TFTP case you must read the entire file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Caller allocated buffer.
|
||||
@param Buffer Caller allocated buffer.
|
||||
@param BufferSize Size of buffer in bytes.
|
||||
|
||||
|
||||
@@ -1345,7 +1345,7 @@ EfiRead (
|
||||
|
||||
case EfiOpenFirmwareVolume:
|
||||
if (CompareGuid (&File->FvNameGuid, &gZeroGuid)) {
|
||||
// This is the entire FV device, so treat like a memory buffer
|
||||
// This is the entire FV device, so treat like a memory buffer
|
||||
CopyMem (Buffer, (VOID *)(UINTN)(File->FvStart + File->CurrentPosition), *BufferSize);
|
||||
File->CurrentPosition += *BufferSize;
|
||||
Status = EFI_SUCCESS;
|
||||
@@ -1429,13 +1429,13 @@ EfiRead (
|
||||
|
||||
/**
|
||||
Read the entire file into a buffer. This routine allocates the buffer and
|
||||
returns it to the user full of the read data.
|
||||
returns it to the user full of the read data.
|
||||
|
||||
This is very useful for load file where it's hard to know how big the buffer
|
||||
must be.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param BufferSize Pointer to Size of buffer return..
|
||||
|
||||
|
||||
@@ -1471,10 +1471,10 @@ EfiReadAllocatePool (
|
||||
|
||||
|
||||
/**
|
||||
Write data back to the file. For TFTP case you must write the entire file.
|
||||
Write data back to the file. For TFTP case you must write the entire file.
|
||||
|
||||
@param Stream Open File Handle
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param Buffer Pointer to buffer to return.
|
||||
@param BufferSize Pointer to Size of buffer return..
|
||||
|
||||
|
||||
@@ -1494,7 +1494,7 @@ EfiWrite (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FV_WRITE_FILE_DATA FileData;
|
||||
EFI_DISK_IO_PROTOCOL *DiskIo;
|
||||
EFI_DISK_IO_PROTOCOL *DiskIo;
|
||||
|
||||
if (!FileHandleValid (File)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -1592,7 +1592,7 @@ EfiWrite (
|
||||
|
||||
|
||||
/**
|
||||
Given Cwd expand Path to remove .. and replace them with real
|
||||
Given Cwd expand Path to remove .. and replace them with real
|
||||
directory names.
|
||||
|
||||
@param Cwd Current Working Directory
|
||||
@@ -1636,9 +1636,9 @@ ExpandPath (
|
||||
if (Work == NULL) {
|
||||
// Remaining part of Path contains no more ..
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// append path prior to ..
|
||||
// append path prior to ..
|
||||
AsciiStrnCat (NewPath, Start, Work - Start);
|
||||
StrLen = AsciiStrLen (NewPath);
|
||||
for (i = StrLen; i >= 0; i--) {
|
||||
@@ -1659,7 +1659,7 @@ ExpandPath (
|
||||
}
|
||||
|
||||
Start = Work + 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the path that remains after the ..
|
||||
AsciiStrnCat (NewPath, Start, End - Start);
|
||||
@@ -1682,7 +1682,7 @@ the path does not contain a device name, The CWD is prepended to the path.
|
||||
EFI_STATUS
|
||||
EfiSetCwd (
|
||||
IN CHAR8 *Cwd
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_OPEN_FILE *File;
|
||||
UINTN Len;
|
||||
@@ -1700,7 +1700,7 @@ EfiSetCwd (
|
||||
Path = Cwd;
|
||||
if (AsciiStrStr (Cwd, "..") != NULL) {
|
||||
if (gCwd == NULL) {
|
||||
// no parent
|
||||
// no parent
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1754,10 +1754,10 @@ EfiSetCwd (
|
||||
Set the Current Working Directory (CWD). If a call is made to EfiOpen () and
|
||||
the path does not contain a device name, The CWD is prepended to the path.
|
||||
The CWD buffer is only valid until a new call is made to EfiSetCwd(). After
|
||||
a call to EfiSetCwd() it is not legal to use the pointer returned by
|
||||
a call to EfiSetCwd() it is not legal to use the pointer returned by
|
||||
this function.
|
||||
|
||||
@param Cwd Current Working Directory
|
||||
@param Cwd Current Working Directory
|
||||
|
||||
|
||||
@return "" No CWD set
|
||||
|
@@ -20,7 +20,7 @@
|
||||
FILE_GUID = d8c640db-73ba-48f5-a7ed-8e93c6012491
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = EfiFileLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
LIBRARY_CLASS = EfiFileLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
|
||||
|
||||
#
|
||||
@@ -44,12 +44,12 @@
|
||||
DevicePathLib
|
||||
PrintLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
DebugLib
|
||||
EblNetworkLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiBlockIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
gEfiDiskIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
@@ -57,7 +57,7 @@
|
||||
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
gEfiLoadFileProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiFileInfoGuid
|
||||
gEfiFileSystemInfoGuid
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#/* @file
|
||||
# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#*/
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Use ARMv6 instruction to operate on a single stack
|
||||
#
|
||||
@@ -19,7 +19,7 @@
|
||||
This is the stack constructed by the exception handler (low address to high address)
|
||||
# R0 - IFAR is EFI_SYSTEM_CONTEXT for ARM
|
||||
Reg Offset
|
||||
=== ======
|
||||
=== ======
|
||||
R0 0x00 # stmfd SP!,{R0-R12}
|
||||
R1 0x04
|
||||
R2 0x08
|
||||
@@ -41,14 +41,14 @@ This is the stack constructed by the exception handler (low address to high addr
|
||||
DFAR 0x48
|
||||
IFSR 0x4c
|
||||
IFAR 0x50
|
||||
|
||||
|
||||
LR 0x54 # SVC Link register (we need to restore it)
|
||||
|
||||
LR 0x58 # pushed by srsfd
|
||||
CPSR 0x5c
|
||||
|
||||
LR 0x58 # pushed by srsfd
|
||||
CPSR 0x5c
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
GCC_ASM_EXPORT(ExceptionHandlersStart)
|
||||
GCC_ASM_EXPORT(ExceptionHandlersEnd)
|
||||
@@ -175,55 +175,55 @@ ASM_PFX(CommonExceptionEntry):
|
||||
ASM_PFX(ExceptionHandlersEnd):
|
||||
|
||||
//
|
||||
// This code runs from CpuDxe driver loaded address. It is patched into
|
||||
// This code runs from CpuDxe driver loaded address. It is patched into
|
||||
// CommonExceptionEntry.
|
||||
//
|
||||
ASM_PFX(AsmCommonExceptionEntry):
|
||||
mrc p15, 0, R1, c6, c0, 2 @ Read IFAR
|
||||
str R1, [SP, #0x50] @ Store it in EFI_SYSTEM_CONTEXT_ARM.IFAR
|
||||
|
||||
str R1, [SP, #0x50] @ Store it in EFI_SYSTEM_CONTEXT_ARM.IFAR
|
||||
|
||||
mrc p15, 0, R1, c5, c0, 1 @ Read IFSR
|
||||
str R1, [SP, #0x4c] @ Store it in EFI_SYSTEM_CONTEXT_ARM.IFSR
|
||||
|
||||
|
||||
mrc p15, 0, R1, c6, c0, 0 @ Read DFAR
|
||||
str R1, [SP, #0x48] @ Store it in EFI_SYSTEM_CONTEXT_ARM.DFAR
|
||||
|
||||
|
||||
mrc p15, 0, R1, c5, c0, 0 @ Read DFSR
|
||||
str R1, [SP, #0x44] @ Store it in EFI_SYSTEM_CONTEXT_ARM.DFSR
|
||||
|
||||
ldr R1, [SP, #0x5c] @ srsdb saved pre-exception CPSR on the stack
|
||||
|
||||
ldr R1, [SP, #0x5c] @ srsdb saved pre-exception CPSR on the stack
|
||||
str R1, [SP, #0x40] @ Store it in EFI_SYSTEM_CONTEXT_ARM.CPSR
|
||||
|
||||
add R2, SP, #0x38 @ Make R2 point to EFI_SYSTEM_CONTEXT_ARM.LR
|
||||
and R3, R1, #0x1f @ Check CPSR to see if User or System Mode
|
||||
cmp R3, #0x1f @ if ((CPSR == 0x10) || (CPSR == 0x1df))
|
||||
cmpne R3, #0x10 @
|
||||
cmpne R3, #0x10 @
|
||||
stmeqed R2, {lr}^ @ save unbanked lr
|
||||
@ else
|
||||
@ else
|
||||
stmneed R2, {lr} @ save SVC lr
|
||||
|
||||
|
||||
ldr R5, [SP, #0x58] @ PC is the LR pushed by srsfd
|
||||
ldr R5, [SP, #0x58] @ PC is the LR pushed by srsfd
|
||||
@ Check to see if we have to adjust for Thumb entry
|
||||
sub r4, r0, #1 @ if (ExceptionType == 1 || ExceptionType ==2)) {
|
||||
cmp r4, #1 @ // UND & SVC have differnt LR adjust for Thumb
|
||||
cmp r4, #1 @ // UND & SVC have differnt LR adjust for Thumb
|
||||
bhi NoAdjustNeeded
|
||||
|
||||
tst r1, #0x20 @ if ((CPSR & T)) == T) { // Thumb Mode on entry
|
||||
|
||||
tst r1, #0x20 @ if ((CPSR & T)) == T) { // Thumb Mode on entry
|
||||
addne R5, R5, #2 @ PC += 2@
|
||||
str R5,[SP,#0x58] @ Update LR value pused by srsfd
|
||||
|
||||
str R5,[SP,#0x58] @ Update LR value pused by srsfd
|
||||
|
||||
NoAdjustNeeded:
|
||||
|
||||
str R5, [SP, #0x3c] @ Store it in EFI_SYSTEM_CONTEXT_ARM.PC
|
||||
|
||||
sub R1, SP, #0x60 @ We pused 0x60 bytes on the stack
|
||||
str R1, [SP, #0x34] @ Store it in EFI_SYSTEM_CONTEXT_ARM.SP
|
||||
|
||||
@ R0 is ExceptionType
|
||||
mov R1,SP @ R1 is SystemContext
|
||||
|
||||
/*
|
||||
sub R1, SP, #0x60 @ We pused 0x60 bytes on the stack
|
||||
str R1, [SP, #0x34] @ Store it in EFI_SYSTEM_CONTEXT_ARM.SP
|
||||
|
||||
@ R0 is ExceptionType
|
||||
mov R1,SP @ R1 is SystemContext
|
||||
|
||||
/*
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
@@ -231,28 +231,28 @@ GdbExceptionHandler (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext R1
|
||||
)
|
||||
|
||||
*/
|
||||
*/
|
||||
blx ASM_PFX(GdbExceptionHandler) @ Call exception handler
|
||||
|
||||
|
||||
ldr R1,[SP,#0x3c] @ EFI_SYSTEM_CONTEXT_ARM.PC
|
||||
str R1,[SP,#0x58] @ Store it back to srsfd stack slot so it can be restored
|
||||
str R1,[SP,#0x58] @ Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
ldr R1,[SP,#0x40] @ EFI_SYSTEM_CONTEXT_ARM.CPSR
|
||||
str R1,[SP,#0x5c] @ Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
str R1,[SP,#0x5c] @ Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
add R3, SP, #0x54 @ Make R3 point to SVC LR saved on entry
|
||||
add R2, SP, #0x38 @ Make R2 point to EFI_SYSTEM_CONTEXT_ARM.LR
|
||||
and R1, R1, #0x1f @ Check to see if User or System Mode
|
||||
cmp R1, #0x1f @ if ((CPSR == 0x10) || (CPSR == 0x1f))
|
||||
cmpne R1, #0x10 @
|
||||
cmpne R1, #0x10 @
|
||||
ldmeqed R2, {lr}^ @ restore unbanked lr
|
||||
@ else
|
||||
ldmneed R3, {lr} @ restore SVC lr, via ldmfd SP!, {LR}
|
||||
|
||||
|
||||
ldmfd SP!,{R0-R12} @ Restore general purpose registers
|
||||
@ Exception handler can not change SP
|
||||
|
||||
|
||||
add SP,SP,#0x20 @ Clear out the remaining stack space
|
||||
ldmfd SP!,{LR} @ restore the link register for this context
|
||||
rfefd SP! @ return from exception via srsfd stack slot
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Use ARMv6 instruction to operate on a single stack
|
||||
//
|
||||
@@ -21,7 +21,7 @@
|
||||
This is the stack constructed by the exception handler (low address to high address)
|
||||
# R0 - IFAR is EFI_SYSTEM_CONTEXT for ARM
|
||||
Reg Offset
|
||||
=== ======
|
||||
=== ======
|
||||
R0 0x00 # stmfd SP!,{R0-R12}
|
||||
R1 0x04
|
||||
R2 0x08
|
||||
@@ -43,15 +43,15 @@ This is the stack constructed by the exception handler (low address to high addr
|
||||
DFAR 0x48
|
||||
IFSR 0x4c
|
||||
IFAR 0x50
|
||||
|
||||
|
||||
LR 0x54 # SVC Link register (we need to restore it)
|
||||
|
||||
LR 0x58 # pushed by srsfd
|
||||
CPSR 0x5c
|
||||
|
||||
LR 0x58 # pushed by srsfd
|
||||
CPSR 0x5c
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
EXPORT ExceptionHandlersStart
|
||||
EXPORT ExceptionHandlersEnd
|
||||
EXPORT CommonExceptionEntry
|
||||
@@ -60,7 +60,7 @@ This is the stack constructed by the exception handler (low address to high addr
|
||||
|
||||
PRESERVE8
|
||||
AREA DxeExceptionHandlers, CODE, READONLY
|
||||
|
||||
|
||||
//
|
||||
// This code gets copied to the ARM vector table
|
||||
// ExceptionHandlersStart - ExceptionHandlersEnd gets copied
|
||||
@@ -101,7 +101,7 @@ UndefinedInstructionEntry
|
||||
stmfd SP!,{R0-R12} ; Store the register state
|
||||
|
||||
mov R0,#1 ; ExceptionType
|
||||
ldr R1,CommonExceptionEntry;
|
||||
ldr R1,CommonExceptionEntry;
|
||||
bx R1
|
||||
|
||||
SoftwareInterruptEntry
|
||||
@@ -173,55 +173,55 @@ CommonExceptionEntry
|
||||
ExceptionHandlersEnd
|
||||
|
||||
//
|
||||
// This code runs from CpuDxe driver loaded address. It is patched into
|
||||
// This code runs from CpuDxe driver loaded address. It is patched into
|
||||
// CommonExceptionEntry.
|
||||
//
|
||||
AsmCommonExceptionEntry
|
||||
mrc p15, 0, R1, c6, c0, 2 ; Read IFAR
|
||||
str R1, [SP, #0x50] ; Store it in EFI_SYSTEM_CONTEXT_ARM.IFAR
|
||||
|
||||
str R1, [SP, #0x50] ; Store it in EFI_SYSTEM_CONTEXT_ARM.IFAR
|
||||
|
||||
mrc p15, 0, R1, c5, c0, 1 ; Read IFSR
|
||||
str R1, [SP, #0x4c] ; Store it in EFI_SYSTEM_CONTEXT_ARM.IFSR
|
||||
|
||||
|
||||
mrc p15, 0, R1, c6, c0, 0 ; Read DFAR
|
||||
str R1, [SP, #0x48] ; Store it in EFI_SYSTEM_CONTEXT_ARM.DFAR
|
||||
|
||||
|
||||
mrc p15, 0, R1, c5, c0, 0 ; Read DFSR
|
||||
str R1, [SP, #0x44] ; Store it in EFI_SYSTEM_CONTEXT_ARM.DFSR
|
||||
|
||||
ldr R1, [SP, #0x5c] ; srsfd saved pre-exception CPSR on the stack
|
||||
|
||||
ldr R1, [SP, #0x5c] ; srsfd saved pre-exception CPSR on the stack
|
||||
str R1, [SP, #0x40] ; Store it in EFI_SYSTEM_CONTEXT_ARM.CPSR
|
||||
|
||||
add R2, SP, #0x38 ; Make R2 point to EFI_SYSTEM_CONTEXT_ARM.LR
|
||||
and R3, R1, #0x1f ; Check CPSR to see if User or System Mode
|
||||
cmp R3, #0x1f ; if ((CPSR == 0x10) || (CPSR == 0x1df))
|
||||
cmpne R3, #0x10 ;
|
||||
cmpne R3, #0x10 ;
|
||||
stmeqed R2, {lr}^ ; save unbanked lr
|
||||
; else
|
||||
; else
|
||||
stmneed R2, {lr} ; save SVC lr
|
||||
|
||||
|
||||
ldr R5, [SP, #0x58] ; PC is the LR pushed by srsfd
|
||||
ldr R5, [SP, #0x58] ; PC is the LR pushed by srsfd
|
||||
; Check to see if we have to adjust for Thumb entry
|
||||
sub r4, r0, #1 ; if (ExceptionType == 1 || ExceptionType ==2)) {
|
||||
cmp r4, #1 ; // UND & SVC have differnt LR adjust for Thumb
|
||||
cmp r4, #1 ; // UND & SVC have differnt LR adjust for Thumb
|
||||
bhi NoAdjustNeeded
|
||||
|
||||
tst r1, #0x20 ; if ((CPSR & T)) == T) { // Thumb Mode on entry
|
||||
|
||||
tst r1, #0x20 ; if ((CPSR & T)) == T) { // Thumb Mode on entry
|
||||
addne R5, R5, #2 ; PC += 2;
|
||||
str R5,[SP,#0x58] ; Update LR value pused by srsfd
|
||||
|
||||
str R5,[SP,#0x58] ; Update LR value pused by srsfd
|
||||
|
||||
NoAdjustNeeded
|
||||
|
||||
str R5, [SP, #0x3c] ; Store it in EFI_SYSTEM_CONTEXT_ARM.PC
|
||||
|
||||
sub R1, SP, #0x60 ; We pused 0x60 bytes on the stack
|
||||
str R1, [SP, #0x34] ; Store it in EFI_SYSTEM_CONTEXT_ARM.SP
|
||||
|
||||
; R0 is ExceptionType
|
||||
mov R1,SP ; R1 is SystemContext
|
||||
|
||||
/*
|
||||
sub R1, SP, #0x60 ; We pused 0x60 bytes on the stack
|
||||
str R1, [SP, #0x34] ; Store it in EFI_SYSTEM_CONTEXT_ARM.SP
|
||||
|
||||
; R0 is ExceptionType
|
||||
mov R1,SP ; R1 is SystemContext
|
||||
|
||||
/*
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
@@ -231,29 +231,29 @@ GdbExceptionHandler (
|
||||
|
||||
*/
|
||||
blx GdbExceptionHandler ; Call exception handler
|
||||
|
||||
|
||||
ldr R1,[SP,#0x3c] ; EFI_SYSTEM_CONTEXT_ARM.PC
|
||||
str R1,[SP,#0x58] ; Store it back to srsfd stack slot so it can be restored
|
||||
str R1,[SP,#0x58] ; Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
ldr R1,[SP,#0x40] ; EFI_SYSTEM_CONTEXT_ARM.CPSR
|
||||
str R1,[SP,#0x5c] ; Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
str R1,[SP,#0x5c] ; Store it back to srsfd stack slot so it can be restored
|
||||
|
||||
add R3, SP, #0x54 ; Make R3 point to SVC LR saved on entry
|
||||
add R2, SP, #0x38 ; Make R2 point to EFI_SYSTEM_CONTEXT_ARM.LR
|
||||
and R1, R1, #0x1f ; Check to see if User or System Mode
|
||||
cmp R1, #0x1f ; if ((CPSR == 0x10) || (CPSR == 0x1f))
|
||||
cmpne R1, #0x10 ;
|
||||
cmpne R1, #0x10 ;
|
||||
ldmeqed R2, {lr}^ ; restore unbanked lr
|
||||
; else
|
||||
ldmneed R3, {lr} ; restore SVC lr, via ldmfd SP!, {LR}
|
||||
|
||||
|
||||
ldmfd SP!,{R0-R12} ; Restore general purpose registers
|
||||
; Exception handler can not change SP
|
||||
|
||||
|
||||
add SP,SP,#0x20 ; Clear out the remaining stack space
|
||||
ldmfd SP!,{LR} ; restore the link register for this context
|
||||
rfefd SP! ; return from exception via srsfd stack slot
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -48,8 +48,8 @@ AsmCommonExceptionEntry (
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_ARM_SOFTWARE_INTERRUPT, GDB_SIGTRAP },
|
||||
{ EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },
|
||||
{ EXCEPT_ARM_PREFETCH_ABORT, GDB_SIGTRAP },
|
||||
{ EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },
|
||||
{ EXCEPT_ARM_PREFETCH_ABORT, GDB_SIGTRAP },
|
||||
{ EXCEPT_ARM_DATA_ABORT, GDB_SIGTRAP }, // GDB_SIGEMT
|
||||
{ EXCEPT_ARM_RESERVED, GDB_SIGTRAP }, // GDB_SIGILL
|
||||
{ EXCEPT_ARM_FIQ, GDB_SIGINT } // Used for ctrl-c
|
||||
@@ -113,8 +113,8 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -128,10 +128,10 @@ MaxEfiException (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
@retval TRUE if Isa is supported
|
||||
@retval TRUE if Isa is supported
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -150,14 +150,14 @@ CheckIsa (
|
||||
/**
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the ARM member
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister(
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -183,7 +183,7 @@ BasicReadRegister (
|
||||
{
|
||||
UINTN RegSize;
|
||||
CHAR8 Char;
|
||||
|
||||
|
||||
if (gRegisterOffsets[RegNumber] > 0xF00) {
|
||||
AsciiSPrint(OutBufPtr, 9, "00000000");
|
||||
OutBufPtr += 8;
|
||||
@@ -197,13 +197,13 @@ BasicReadRegister (
|
||||
Char = Char - 'A' + 'a';
|
||||
}
|
||||
*OutBufPtr++ = Char;
|
||||
|
||||
|
||||
Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
|
||||
if ((Char >= 'A') && (Char <= 'F')) {
|
||||
Char = Char - 'A' + 'a';
|
||||
}
|
||||
*OutBufPtr++ = Char;
|
||||
|
||||
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
return OutBufPtr;
|
||||
@@ -211,7 +211,7 @@ BasicReadRegister (
|
||||
|
||||
|
||||
/**
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
**/
|
||||
@@ -224,29 +224,29 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[9]; // 1 reg=8 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
|
||||
if (RegNumber >= (sizeof (gRegisterOffsets)/sizeof (UINTN))) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket(OutBuffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
@@ -254,13 +254,13 @@ ReadGeneralRegisters (
|
||||
// a UINT32 takes 8 ascii characters
|
||||
CHAR8 OutBuffer[(sizeof (gRegisterOffsets) * 2) + 1];
|
||||
CHAR8 *OutBufPtr;
|
||||
|
||||
|
||||
// It is not safe to allocate pool here....
|
||||
OutBufPtr = OutBuffer;
|
||||
for (Index = 0; Index < (sizeof (gRegisterOffsets)/sizeof (UINTN)); Index++) {
|
||||
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);
|
||||
}
|
||||
|
||||
|
||||
*OutBufPtr = '\0';
|
||||
SendPacket(OutBuffer);
|
||||
}
|
||||
@@ -283,7 +283,7 @@ BasicWriteRegister (
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT32 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
if (gRegisterOffsets[RegNumber] > 0xF00) {
|
||||
return InBufPtr + 8;
|
||||
}
|
||||
@@ -292,21 +292,21 @@ BasicWriteRegister (
|
||||
RegSize = 0;
|
||||
while (RegSize < 32) {
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if ((INTN)TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if ((INTN)TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
|
||||
@@ -329,19 +329,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if (RegNumber >= (sizeof (gRegisterOffsets)/sizeof (UINTN))) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -369,21 +369,21 @@ WriteGeneralRegisters (
|
||||
UINTN RegisterCount = (sizeof (gRegisterOffsets)/sizeof (UINTN));
|
||||
|
||||
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format
|
||||
|
||||
|
||||
if (AsciiStrLen(InBuffer) < MinLength) {
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for(i = 0; i < RegisterCount; i++) {
|
||||
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
|
||||
}
|
||||
|
||||
|
||||
SendSuccess ();
|
||||
}
|
||||
|
||||
@@ -391,10 +391,10 @@ WriteGeneralRegisters (
|
||||
|
||||
|
||||
/**
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -405,15 +405,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -448,9 +448,9 @@ RemoveBreakPoint (
|
||||
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly
|
||||
Send the T signal with the given exception type (in gdb order) and possibly
|
||||
with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -467,13 +467,13 @@ ProcessorSendTSignal (
|
||||
|
||||
/**
|
||||
FIQ state is only changed by FIQ exception. We don't want to take FIQ
|
||||
ticks in the GDB stub. The stub disables FIQ on entry, but this is the
|
||||
ticks in the GDB stub. The stub disables FIQ on entry, but this is the
|
||||
third instruction that executes in the execption handler. Thus we have
|
||||
a crack we need to test for.
|
||||
|
||||
@param PC PC of execption
|
||||
|
||||
@return TRUE We are in the GDB stub exception preamble
|
||||
@return TRUE We are in the GDB stub exception preamble
|
||||
@return FALSE We are not in GDB stub code
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -495,21 +495,21 @@ InFiqCrack (
|
||||
/**
|
||||
Check to see if this exception is related to ctrl-c handling.
|
||||
|
||||
In this scheme we dedicate FIQ to the ctrl-c handler so it is
|
||||
independent of the rest of the system.
|
||||
|
||||
SaveAndSetDebugTimerInterrupt () can be used to
|
||||
In this scheme we dedicate FIQ to the ctrl-c handler so it is
|
||||
independent of the rest of the system.
|
||||
|
||||
SaveAndSetDebugTimerInterrupt () can be used to
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@return TRUE This was a ctrl-c check that did not find a ctrl-c
|
||||
@return FALSE This was not a ctrl-c check or some one hit ctrl-c
|
||||
**/
|
||||
BOOLEAN
|
||||
ProcessorControlC (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
ProcessorControlC (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
CHAR8 Char;
|
||||
@@ -534,7 +534,7 @@ ProcessorControlC (
|
||||
Return = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Char = GdbGetChar ();
|
||||
if (Char == 0x03) {
|
||||
//
|
||||
@@ -622,7 +622,7 @@ InitializeDebugAgent (
|
||||
IN VOID *Context, OPTIONAL
|
||||
IN DEBUG_AGENT_CONTINUE Function OPTIONAL
|
||||
)
|
||||
{
|
||||
{
|
||||
UINTN Offset;
|
||||
UINTN Length;
|
||||
BOOLEAN IrqEnabled;
|
||||
@@ -647,7 +647,7 @@ InitializeDebugAgent (
|
||||
VectorBase = (UINT32 *)(UINTN)PcdGet32 (PcdCpuVectorBaseAddress);
|
||||
|
||||
|
||||
// Copy our assembly code into the page that contains the exception vectors.
|
||||
// Copy our assembly code into the page that contains the exception vectors.
|
||||
CopyMem ((VOID *)VectorBase, (VOID *)ExceptionHandlersStart, Length);
|
||||
|
||||
//
|
||||
|
@@ -34,7 +34,7 @@ CHAR8 gXferLibraryBuffer[2000];
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexToStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
||||
|
||||
|
||||
// add-symbol-file c:/work/edk2/Build/BeagleBoard/DEBUG_ARMGCC/ARM/BeagleBoardPkg/Sec/Sec/DEBUG/BeagleBoardSec.dll 0x80008360
|
||||
// add-symbol-file c:/work/edk2/Build/BeagleBoard/DEBUG_ARMGCC/ARM/BeagleBoardPkg/Sec/Sec/DEBUG/BeagleBoardSec.dll 0x80008360
|
||||
CHAR8 *qXferHack = "<library name=\"c:/work/edk2/Build/BeagleBoard/DEBUG_ARMGCC/ARM/BeagleBoardPkg/Sec/Sec/DEBUG/BeagleBoardSec.dll\"><segment address=\"0x80008360\"/></library>";
|
||||
|
||||
UINTN
|
||||
@@ -52,7 +52,7 @@ gXferObjectReadResponse (
|
||||
*OutBufPtr++ = Type;
|
||||
Count = 1;
|
||||
|
||||
// Binary data encoding
|
||||
// Binary data encoding
|
||||
OutBufPtr = gOutBuffer;
|
||||
while (*Str != '\0') {
|
||||
Char = *Str++;
|
||||
@@ -68,42 +68,42 @@ gXferObjectReadResponse (
|
||||
|
||||
*OutBufPtr = '\0' ; // the end of the buffer
|
||||
SendPacket (gOutBuffer);
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Process "qXfer:object:read:annex:offset,length" request.
|
||||
|
||||
Returns an XML document that contains loaded libraries. In our case it is
|
||||
|
||||
Returns an XML document that contains loaded libraries. In our case it is
|
||||
infomration in the EFI Debug Inmage Table converted into an XML document.
|
||||
|
||||
GDB will call with an arbitrary length (it can't know the real length and
|
||||
will reply with chunks of XML that are easy for us to deal with. Gdb will
|
||||
|
||||
GDB will call with an arbitrary length (it can't know the real length and
|
||||
will reply with chunks of XML that are easy for us to deal with. Gdb will
|
||||
keep calling until we say we are done. XML doc looks like:
|
||||
|
||||
|
||||
<library-list>
|
||||
<library name="/a/a/c/d.dSYM"><segment address="0x10000000"/></library>
|
||||
<library name="/a/m/e/e.pdb"><segment address="0x20000000"/></library>
|
||||
<library name="/a/l/f/f.dll"><segment address="0x30000000"/></library>
|
||||
</library-list>
|
||||
|
||||
Since we can not allocate memory in interupt context this module has
|
||||
|
||||
Since we can not allocate memory in interupt context this module has
|
||||
assumptions about how it will get called:
|
||||
1) Length will generally be max remote packet size (big enough)
|
||||
2) First Offset of an XML document read needs to be 0
|
||||
3) This code will return back small chunks of the XML document on every read.
|
||||
Each subseqent call will ask for the next availble part of the document.
|
||||
|
||||
|
||||
Note: The only variable size element in the XML is:
|
||||
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
|
||||
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
|
||||
based on the file path and name of the symbol file. If the symbol file name
|
||||
is bigger than the max gdb remote packet size we could update this code
|
||||
to respond back in chunks.
|
||||
|
||||
@param Offset offset into special data area
|
||||
@param Length number of bytes to read starting at Offset
|
||||
|
||||
@param Length number of bytes to read starting at Offset
|
||||
|
||||
**/
|
||||
VOID
|
||||
QxferLibrary (
|
||||
@@ -134,13 +134,13 @@ TransferFromInBufToMem (
|
||||
{
|
||||
CHAR8 c1;
|
||||
CHAR8 c2;
|
||||
|
||||
|
||||
while (Length-- > 0) {
|
||||
c1 = (CHAR8)HexCharToInt (*NewData++);
|
||||
c2 = (CHAR8)HexCharToInt (*NewData++);
|
||||
|
||||
if ((c1 < 0) || (c2 < 0)) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return;
|
||||
}
|
||||
*Address++ = (UINT8)((c1 << 4) + c2);
|
||||
@@ -171,7 +171,7 @@ TransferFromMemToOutBufAndSend (
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
while (Length > 0) {
|
||||
|
||||
|
||||
Char = mHexToStr[*Address >> 4];
|
||||
if ((Char >= 'A') && (Char <= 'F')) {
|
||||
Char = Char - 'A' + 'a';
|
||||
@@ -196,16 +196,16 @@ TransferFromMemToOutBufAndSend (
|
||||
|
||||
/**
|
||||
Send a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
in an infinit loop. This is so if you unplug the debugger code just keeps running
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
|
||||
|
||||
@retval Number of bytes of packet data sent.
|
||||
|
||||
**/
|
||||
@@ -219,7 +219,7 @@ SendPacket (
|
||||
CHAR8 *Ptr;
|
||||
CHAR8 TestChar;
|
||||
UINTN Count;
|
||||
|
||||
|
||||
Timeout = PcdGet32 (PcdGdbMaxPacketRetryCount);
|
||||
|
||||
Count = 0;
|
||||
@@ -231,38 +231,38 @@ SendPacket (
|
||||
// Only try a finite number of times so we don't get stuck in the loop
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
// Packet prefix
|
||||
GdbPutChar ('$');
|
||||
|
||||
|
||||
for (CheckSum = 0, Count =0 ; *Ptr != '\0'; Ptr++, Count++) {
|
||||
GdbPutChar (*Ptr);
|
||||
CheckSum = CheckSum + *Ptr;
|
||||
}
|
||||
|
||||
// Packet terminating character and checksum
|
||||
|
||||
// Packet terminating character and checksum
|
||||
GdbPutChar ('#');
|
||||
GdbPutChar (mHexToStr[CheckSum >> 4]);
|
||||
GdbPutChar (mHexToStr[CheckSum & 0x0F]);
|
||||
|
||||
|
||||
TestChar = GdbGetChar ();
|
||||
} while (TestChar != '+');
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
/**
|
||||
Receive a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
|
||||
If host re-starts sending a packet without ending the previous packet, only the last valid packet is proccessed.
|
||||
(In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)
|
||||
|
||||
|
||||
If an ack '+' is not sent resend the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data received.
|
||||
|
||||
@@ -278,16 +278,16 @@ ReceivePacket (
|
||||
CHAR8 Char;
|
||||
CHAR8 SumString[3];
|
||||
CHAR8 TestChar;
|
||||
|
||||
|
||||
ZeroMem (PacketData, PacketDataSize);
|
||||
|
||||
|
||||
for (;;) {
|
||||
// wait for the start of a packet
|
||||
TestChar = GdbGetChar ();
|
||||
while (TestChar != '$') {
|
||||
TestChar = GdbGetChar ();
|
||||
};
|
||||
|
||||
|
||||
retry:
|
||||
for (Index = 0, CheckSum = 0; Index < (PacketDataSize - 1); Index++) {
|
||||
Char = GdbGetChar ();
|
||||
@@ -307,14 +307,14 @@ ReceivePacket (
|
||||
continue;
|
||||
}
|
||||
|
||||
SumString[0] = GdbGetChar ();
|
||||
SumString[0] = GdbGetChar ();
|
||||
SumString[1] = GdbGetChar ();
|
||||
SumString[2] = '\0';
|
||||
|
||||
|
||||
if (AsciiStrHexToUintn (SumString) == CheckSum) {
|
||||
// Ack: Success
|
||||
GdbPutChar ('+');
|
||||
|
||||
|
||||
// Null terminate the callers string
|
||||
PacketData[Index] = '\0';
|
||||
return Index;
|
||||
@@ -323,27 +323,27 @@ ReceivePacket (
|
||||
GdbPutChar ('-');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Empties the given buffer
|
||||
Empties the given buffer
|
||||
@param Buf pointer to the first element in buffer to be emptied
|
||||
**/
|
||||
VOID
|
||||
EmptyBuffer (
|
||||
EmptyBuffer (
|
||||
IN CHAR8 *Buf
|
||||
)
|
||||
{
|
||||
{
|
||||
*Buf = '\0';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts an 8-bit Hex Char into a INTN.
|
||||
|
||||
|
||||
@param Char the hex character to be converted into UINTN
|
||||
@retval a INTN, from 0 to 15, that corressponds to Char
|
||||
-1 if Char is not a hex character
|
||||
@@ -360,7 +360,7 @@ HexCharToInt (
|
||||
} else if ((Char >= '0') && (Char <= '9')) {
|
||||
return Char - '0';
|
||||
} else { // if not a hex value, return a negative value
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ CHAR8 *gError = "E__";
|
||||
Send an error with the given error number after converting to hex.
|
||||
The error number is put into the buffer in hex. '255' is the biggest errno we can send.
|
||||
ex: 162 will be sent as A2.
|
||||
|
||||
|
||||
@param errno the error number that will be sent
|
||||
**/
|
||||
VOID
|
||||
@@ -385,7 +385,7 @@ SendError (
|
||||
//
|
||||
gError[1] = mHexToStr [ErrorNum >> 4];
|
||||
gError[2] = mHexToStr [ErrorNum & 0x0f];
|
||||
|
||||
|
||||
SendPacket (gError); // send buffer
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ VOID
|
||||
EFIAPI
|
||||
SendSuccess (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
SendPacket ("OK"); // send buffer
|
||||
}
|
||||
@@ -407,12 +407,12 @@ SendSuccess (
|
||||
/**
|
||||
Send empty packet to specify that particular command/functionality is not supported.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
VOID
|
||||
EFIAPI
|
||||
SendNotSupported (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID
|
||||
)
|
||||
{
|
||||
SendPacket ("");
|
||||
}
|
||||
|
||||
@@ -422,17 +422,17 @@ SendNotSupported (
|
||||
|
||||
/**
|
||||
Translates the EFI mapping to GDB mapping
|
||||
|
||||
|
||||
@param EFIExceptionType EFI Exception that is being processed
|
||||
@retval UINTN that corresponds to EFIExceptionType's GDB exception type number
|
||||
**/
|
||||
UINT8
|
||||
ConvertEFItoGDBtype (
|
||||
ConvertEFItoGDBtype (
|
||||
IN EFI_EXCEPTION_TYPE EFIExceptionType
|
||||
)
|
||||
{
|
||||
{
|
||||
UINTN i;
|
||||
|
||||
|
||||
for (i=0; i < MaxEfiException() ; i++) {
|
||||
if (gExceptionType[i].Exception == EFIExceptionType) {
|
||||
return gExceptionType[i].SignalNo;
|
||||
@@ -443,8 +443,8 @@ ConvertEFItoGDBtype (
|
||||
|
||||
|
||||
/** "m addr,length"
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
send it as a packet.
|
||||
**/
|
||||
|
||||
@@ -459,37 +459,37 @@ ReadFromMemory (
|
||||
CHAR8 AddressBuffer[MAX_ADDR_SIZE]; // the buffer that will hold the address in hex chars
|
||||
CHAR8 *AddrBufPtr; // pointer to the address buffer
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
|
||||
AddrBufPtr = AddressBuffer;
|
||||
InBufPtr = &PacketData[1];
|
||||
while (*InBufPtr != ',') {
|
||||
*AddrBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*AddrBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ',' in the buffer
|
||||
|
||||
|
||||
/* Error checking */
|
||||
if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 2 = 'm' + ','
|
||||
if (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
|
||||
SendError (GDB_EBADMEMLENGTH);
|
||||
SendError (GDB_EBADMEMLENGTH);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Address = AsciiStrHexToUintn (AddressBuffer);
|
||||
Length = AsciiStrHexToUintn (InBufPtr);
|
||||
|
||||
|
||||
TransferFromMemToOutBufAndSend (Length, (unsigned char *)Address);
|
||||
}
|
||||
|
||||
|
||||
/** "M addr,length :XX..."
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
another function, TransferFromInBufToMem, that will write to that memory space the info in
|
||||
the input buffer.
|
||||
**/
|
||||
@@ -507,48 +507,48 @@ WriteToMemory (
|
||||
CHAR8 *AddrBufPtr; // pointer to the Address buffer
|
||||
CHAR8 *LengthBufPtr; // pointer to the Length buffer
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
|
||||
AddrBufPtr = AddressBuffer;
|
||||
LengthBufPtr = LengthBuffer;
|
||||
InBufPtr = &PacketData[1];
|
||||
|
||||
|
||||
while (*InBufPtr != ',') {
|
||||
*AddrBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*AddrBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ',' in the buffer
|
||||
|
||||
|
||||
while (*InBufPtr != ':') {
|
||||
*LengthBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
*LengthBufPtr = '\0';
|
||||
|
||||
|
||||
InBufPtr++; // this skips ':' in the buffer
|
||||
|
||||
|
||||
Address = AsciiStrHexToUintn (AddressBuffer);
|
||||
Length = AsciiStrHexToUintn (LengthBuffer);
|
||||
|
||||
|
||||
/* Error checking */
|
||||
|
||||
|
||||
//Check if Address is not too long.
|
||||
if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
SendError (GDB_EBADMEMADDRBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Check if message length is not too long
|
||||
if (AsciiStrLen(LengthBuffer) >= MAX_LENGTH_SIZE) {
|
||||
SendError (GDB_EBADMEMLENGBUFSIZE);
|
||||
SendError (GDB_EBADMEMLENGBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if Message is not too long/short.
|
||||
// 3 = 'M' + ',' + ':'
|
||||
MessageLength = (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - AsciiStrLen(LengthBuffer) - 3);
|
||||
if (MessageLength != (2*Length)) {
|
||||
//Message too long/short. New data is not the right size.
|
||||
SendError (GDB_EBADMEMDATASIZE);
|
||||
SendError (GDB_EBADMEMDATASIZE);
|
||||
return;
|
||||
}
|
||||
TransferFromInBufToMem (Length, (unsigned char *)Address, InBufPtr);
|
||||
@@ -623,7 +623,7 @@ ParseBreakpointPacket (
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -644,12 +644,12 @@ GdbSendTSignal (
|
||||
//
|
||||
// replace _, or previous value, with Exception type
|
||||
//
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType >> 4];
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType >> 4];
|
||||
*TSignalPtr++ = mHexToStr [GdbExceptionType & 0x0f];
|
||||
|
||||
|
||||
ProcessorSendTSignal (SystemContext, GdbExceptionType, TSignalPtr, sizeof (TSignalBuffer) - 2);
|
||||
|
||||
SendPacket (TSignalBuffer);
|
||||
SendPacket (TSignalBuffer);
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -666,7 +666,7 @@ GdbFWrite (
|
||||
|
||||
for( ; ; ) {
|
||||
ReceivePacket (gInBuffer, MAX_BUF_SIZE);
|
||||
|
||||
|
||||
switch (gInBuffer[0]) {
|
||||
case 'm':
|
||||
ReadFromMemory (gInBuffer);
|
||||
@@ -697,20 +697,20 @@ GdbFPutString (
|
||||
/**
|
||||
Exception Hanldler for GDB. It will be called for all exceptions
|
||||
registered via the gExceptionType[] array.
|
||||
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINT8 GdbExceptionType;
|
||||
CHAR8 *Ptr;
|
||||
|
||||
|
||||
if (ProcessorControlC (ExceptionType, SystemContext)) {
|
||||
// We tried to process a control C handler and there is nothing to do
|
||||
return;
|
||||
@@ -718,37 +718,37 @@ GdbExceptionHandler (
|
||||
|
||||
GdbExceptionType = ConvertEFItoGDBtype (ExceptionType);
|
||||
GdbSendTSignal (SystemContext, GdbExceptionType);
|
||||
|
||||
|
||||
for( ; ; ) {
|
||||
ReceivePacket (gInBuffer, MAX_BUF_SIZE);
|
||||
|
||||
|
||||
switch (gInBuffer[0]) {
|
||||
case '?':
|
||||
GdbSendTSignal (SystemContext, GdbExceptionType);
|
||||
break;
|
||||
|
||||
|
||||
case 'c':
|
||||
ContinueAtAddress (SystemContext, gInBuffer);
|
||||
ContinueAtAddress (SystemContext, gInBuffer);
|
||||
return;
|
||||
|
||||
case 'D':
|
||||
// gdb wants to disconnect so return "OK" packet since.
|
||||
// gdb wants to disconnect so return "OK" packet since.
|
||||
SendSuccess ();
|
||||
return;
|
||||
|
||||
case 'g':
|
||||
ReadGeneralRegisters (SystemContext);
|
||||
break;
|
||||
|
||||
|
||||
case 'G':
|
||||
WriteGeneralRegisters (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
|
||||
case 'H':
|
||||
//Return "OK" packet since we don't have more than one thread.
|
||||
//Return "OK" packet since we don't have more than one thread.
|
||||
SendSuccess ();
|
||||
break;
|
||||
|
||||
|
||||
case 'm':
|
||||
ReadFromMemory (gInBuffer);
|
||||
break;
|
||||
@@ -764,7 +764,7 @@ GdbExceptionHandler (
|
||||
//
|
||||
// Still debugging this code. Not used in Darwin
|
||||
//
|
||||
case 'q':
|
||||
case 'q':
|
||||
// General Query Packets
|
||||
if (AsciiStrnCmp (gInBuffer, "qSupported", 10) == 0) {
|
||||
// return what we currently support, we don't parse what gdb suports
|
||||
@@ -774,7 +774,7 @@ GdbExceptionHandler (
|
||||
// <20>qXfer:libraries:read::offset,length
|
||||
// gInBuffer[22] is offset string, ++Ptr is length string<6E>
|
||||
for (Ptr = &gInBuffer[22]; *Ptr != ','; Ptr++);
|
||||
|
||||
|
||||
// Not sure if multi-radix support is required. Currently only support decimal
|
||||
QxferLibrary (AsciiStrHexToUintn (&gInBuffer[22]), AsciiStrHexToUintn (++Ptr));
|
||||
} else if (AsciiStrnCmp (gInBuffer, "qOffsets", 8) == 0) {
|
||||
@@ -790,18 +790,18 @@ GdbExceptionHandler (
|
||||
break;
|
||||
|
||||
case 's':
|
||||
SingleStep (SystemContext, gInBuffer);
|
||||
SingleStep (SystemContext, gInBuffer);
|
||||
return;
|
||||
|
||||
|
||||
case 'z':
|
||||
RemoveBreakPoint (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
|
||||
case 'Z':
|
||||
InsertBreakPoint (SystemContext, gInBuffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
//Send empty packet
|
||||
SendNotSupported ();
|
||||
break;
|
||||
|
@@ -34,7 +34,7 @@
|
||||
extern CONST CHAR8 mHexToStr[];
|
||||
|
||||
// maximum size of input and output buffers
|
||||
// This value came from the show remote command of the gdb we tested against
|
||||
// This value came from the show remote command of the gdb we tested against
|
||||
#define MAX_BUF_SIZE 2000
|
||||
|
||||
// maximum size of address buffer
|
||||
@@ -57,11 +57,11 @@ extern CONST CHAR8 mHexToStr[];
|
||||
// GDB Signal definitions - generic names for interrupts
|
||||
//
|
||||
#define GDB_SIGINT 2 // Interrupt process via ctrl-c
|
||||
#define GDB_SIGILL 4 // Illegal instruction
|
||||
#define GDB_SIGILL 4 // Illegal instruction
|
||||
#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)
|
||||
#define GDB_SIGEMT 7 // Emulator Trap
|
||||
#define GDB_SIGFPE 8 // Floating point exception
|
||||
#define GDB_SIGSEGV 11 // Setgment violation, page fault
|
||||
#define GDB_SIGSEGV 11 // Setgment violation, page fault
|
||||
|
||||
|
||||
//
|
||||
@@ -69,9 +69,9 @@ extern CONST CHAR8 mHexToStr[];
|
||||
// Includes all general GDB Unix like error values
|
||||
//
|
||||
#define GDB_EBADMEMADDRBUFSIZE 11 // the buffer that stores memory Address to be read from/written to is not the right size
|
||||
#define GDB_EBADMEMLENGBUFSIZE 12 // the buffer that stores Length is not the right size
|
||||
#define GDB_EBADMEMLENGBUFSIZE 12 // the buffer that stores Length is not the right size
|
||||
#define GDB_EBADMEMLENGTH 13 // Length, the given number of bytes to read or write, is not the right size
|
||||
#define GDB_EBADMEMDATA 14 // one of the bytes or nibbles of the memory is leess than 0
|
||||
#define GDB_EBADMEMDATA 14 // one of the bytes or nibbles of the memory is leess than 0
|
||||
#define GDB_EBADMEMDATASIZE 15 // the memory data, 'XX..', is too short or too long
|
||||
#define GDB_EBADBUFSIZE 21 // the buffer created is not the correct size
|
||||
#define GDB_EINVALIDARG 31 // argument is invalid
|
||||
@@ -91,7 +91,7 @@ extern CONST CHAR8 mHexToStr[];
|
||||
//
|
||||
//Define Register size for different architectures
|
||||
//
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#define REG_SIZE 32
|
||||
#elif defined (MDE_CPU_X64)
|
||||
#define REG_SIZE 64
|
||||
@@ -119,7 +119,7 @@ typedef union {
|
||||
UINT32 B1:1; // Breakpoint condition detected
|
||||
UINT32 B2:1; // Breakpoint condition detected
|
||||
UINT32 B3:1; // Breakpoint condition detected
|
||||
UINT32 Reserved_1:9; // Reserved
|
||||
UINT32 Reserved_1:9; // Reserved
|
||||
UINT32 BD:1; // Debug register access detected
|
||||
UINT32 BS:1; // Single step
|
||||
UINT32 BT:1; // Task switch
|
||||
@@ -186,8 +186,8 @@ extern BOOLEAN gProcessingFPacket;
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -196,9 +196,9 @@ MaxEfiException (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
|
||||
@retval TRUE if Isa is supported,
|
||||
FALSE otherwise.
|
||||
**/
|
||||
@@ -210,7 +210,7 @@ CheckIsa (
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -224,29 +224,29 @@ GdbSendTSignal (
|
||||
|
||||
/**
|
||||
Translates the EFI mapping to GDB mapping
|
||||
|
||||
|
||||
@param EFIExceptionType EFI Exception that is being processed
|
||||
@retval UINTN that corresponds to EFIExceptionType's GDB exception type number
|
||||
**/
|
||||
UINT8
|
||||
ConvertEFItoGDBtype (
|
||||
ConvertEFItoGDBtype (
|
||||
IN EFI_EXCEPTION_TYPE EFIExceptionType
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Empties the given buffer
|
||||
Empties the given buffer
|
||||
@param *Buf pointer to the first element in buffer to be emptied
|
||||
**/
|
||||
VOID
|
||||
EmptyBuffer (
|
||||
EmptyBuffer (
|
||||
IN CHAR8 *Buf
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Converts an 8-bit Hex Char into a INTN.
|
||||
|
||||
|
||||
@param Char - the hex character to be converted into UINTN
|
||||
@retval a INTN, from 0 to 15, that corressponds to Char
|
||||
-1 if Char is not a hex character
|
||||
@@ -261,7 +261,7 @@ HexCharToInt (
|
||||
Send an error with the given error number after converting to hex.
|
||||
The error number is put into the buffer in hex. '255' is the biggest errno we can send.
|
||||
ex: 162 will be sent as A2.
|
||||
|
||||
|
||||
@param errno the error number that will be sent
|
||||
**/
|
||||
VOID
|
||||
@@ -288,8 +288,8 @@ SendNotSupported (
|
||||
VOID
|
||||
);
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer This is the input buffer received from gdb server
|
||||
**/
|
||||
@@ -300,12 +300,12 @@ ReadNthRegister (
|
||||
);
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
@@ -336,10 +336,10 @@ WriteGeneralRegisters (
|
||||
|
||||
|
||||
/** ‘m addr,length ’
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
Find the Length of the area to read and the start addres. Finally, pass them to
|
||||
another function, TransferFromMemToOutBufAndSend, that will read from that memory space and
|
||||
send it as a packet.
|
||||
|
||||
|
||||
@param *PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
VOID
|
||||
@@ -349,10 +349,10 @@ ReadFromMemory (
|
||||
|
||||
|
||||
/** ‘M addr,length :XX...’
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
Find the Length of the area in bytes to write and the start addres. Finally, pass them to
|
||||
another function, TransferFromInBufToMem, that will write to that memory space the info in
|
||||
the input buffer.
|
||||
|
||||
|
||||
@param PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
VOID
|
||||
@@ -361,11 +361,11 @@ WriteToMemory (
|
||||
);
|
||||
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param *PacketData Pointer to PacketData
|
||||
**/
|
||||
|
||||
@@ -377,9 +377,9 @@ ContinueAtAddress (
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param PacketData Pointer to Payload data for the packet
|
||||
**/
|
||||
@@ -389,27 +389,27 @@ SingleStep (
|
||||
IN CHAR8 *PacketData
|
||||
);
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
AddSingleStep (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
RemoveSingleStep (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
‘Z1, [addr], [length]’
|
||||
‘Z2, [addr], [length]’
|
||||
@@ -453,36 +453,36 @@ RemoveBreakPoint(
|
||||
/**
|
||||
Exception Hanldler for GDB. It will be called for all exceptions
|
||||
registered via the gExceptionType[] array.
|
||||
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbExceptionHandler (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
Periodic callback for GDB. This function is used to catch a ctrl-c or other
|
||||
break in type command from GDB.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the call
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
GdbPeriodicCallBack (
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Make two serail consoles: 1) StdIn and StdOut via GDB. 2) StdErr via GDB.
|
||||
|
||||
|
||||
These console show up on the remote system running GDB
|
||||
|
||||
**/
|
||||
@@ -495,15 +495,15 @@ GdbInitializeSerialConsole (
|
||||
|
||||
/**
|
||||
Send a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
|
||||
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up
|
||||
in an infinit loop. This is so if you unplug the debugger code just keeps running
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data sent.
|
||||
|
||||
**/
|
||||
@@ -511,21 +511,21 @@ UINTN
|
||||
SendPacket (
|
||||
IN CHAR8 *PacketData
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Receive a GDB Remote Serial Protocol Packet
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
|
||||
$PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',
|
||||
the packet teminating character '#' and the two digit checksum.
|
||||
|
||||
|
||||
If host re-starts sending a packet without ending the previous packet, only the last valid packet is proccessed.
|
||||
(In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)
|
||||
|
||||
|
||||
If an ack '+' is not sent resend the packet
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
|
||||
@param PacketData Payload data for the packet
|
||||
|
||||
@retval Number of bytes of packet data received.
|
||||
|
||||
**/
|
||||
@@ -534,15 +534,15 @@ ReceivePacket (
|
||||
OUT CHAR8 *PacketData,
|
||||
IN UINTN PacketDataSize
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates
|
||||
the end of a file. On error -1 is returned. If count is zero, GdbRead returns zero.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that were read
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes read.
|
||||
@@ -554,15 +554,15 @@ GdbRead (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates
|
||||
nothing was written. On error -1 is returned.
|
||||
|
||||
@param FileDescriptor Device to talk to.
|
||||
@param Buffer Buffer to hold Count bytes that are to be written
|
||||
@param Count Number of bytes to transfer.
|
||||
@param Count Number of bytes to transfer.
|
||||
|
||||
@retval -1 Error
|
||||
@retval {other} Number of bytes written.
|
||||
@@ -575,13 +575,13 @@ GdbWrite (
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
UINTN *
|
||||
UINTN *
|
||||
FindPointerToRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
);
|
||||
|
||||
CHAR8 *
|
||||
CHAR8 *
|
||||
BasicReadRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber,
|
||||
@@ -608,7 +608,7 @@ BasicWriteRegister (
|
||||
IN CHAR8 *InBufPtr
|
||||
);
|
||||
|
||||
VOID
|
||||
VOID
|
||||
PrintReg (
|
||||
EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
@@ -624,7 +624,7 @@ ParseBreakpointPacket (
|
||||
UINTN
|
||||
GetBreakpointDataAddress (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN BreakpointNumber
|
||||
IN UINTN BreakpointNumber
|
||||
);
|
||||
|
||||
UINTN
|
||||
@@ -635,7 +635,7 @@ GetBreakpointDetected (
|
||||
BREAK_TYPE
|
||||
GetBreakpointType (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN BreakpointNumber
|
||||
IN UINTN BreakpointNumber
|
||||
);
|
||||
|
||||
UINTN
|
||||
@@ -680,7 +680,7 @@ InitializeProcessor (
|
||||
|
||||
/**
|
||||
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param GdbExceptionType GDB exception type
|
||||
**/
|
||||
@@ -694,17 +694,17 @@ ProcessorSendTSignal (
|
||||
|
||||
/**
|
||||
Check to see if this exception is related to ctrl-c handling.
|
||||
|
||||
|
||||
@param ExceptionType Exception that is being processed
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@return TRUE This was a ctrl-c check that did not find a ctrl-c
|
||||
@return FALSE This was not a ctrl-c check or some one hit ctrl-c
|
||||
**/
|
||||
BOOLEAN
|
||||
ProcessorControlC (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
ProcessorControlC (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
);
|
||||
|
||||
|
||||
|
@@ -51,10 +51,10 @@
|
||||
ArmPkg/ArmPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
PcdLib
|
||||
BaseLib
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
PcdLib
|
||||
GdbSerialLib
|
||||
CacheMaintenanceLib
|
||||
DebugAgentTimerLib
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -20,7 +20,7 @@
|
||||
// {EFI mapping, GDB mapping}
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_IA32_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_IA32_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_IA32_DEBUG, GDB_SIGTRAP },
|
||||
{ EXCEPT_IA32_NMI, GDB_SIGEMT },
|
||||
{ EXCEPT_IA32_BREAKPOINT, GDB_SIGTRAP },
|
||||
@@ -62,7 +62,7 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
|
||||
//Debug only..
|
||||
VOID
|
||||
VOID
|
||||
PrintReg (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
@@ -80,7 +80,7 @@ PrintReg (
|
||||
}
|
||||
|
||||
//Debug only..
|
||||
VOID
|
||||
VOID
|
||||
PrintDRreg (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
@@ -96,8 +96,8 @@ PrintDRreg (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -109,9 +109,9 @@ MaxEfiException (
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
|
||||
@retval TRUE if Isa is supported,
|
||||
FALSE otherwise.
|
||||
**/
|
||||
@@ -128,14 +128,14 @@ CheckIsa (
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the IA32 member
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister(
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -160,7 +160,7 @@ BasicReadRegister (
|
||||
)
|
||||
{
|
||||
UINTN RegSize;
|
||||
|
||||
|
||||
RegSize = 0;
|
||||
while (RegSize < REG_SIZE) {
|
||||
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
|
||||
@@ -171,8 +171,8 @@ BasicReadRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
@@ -187,7 +187,7 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[9]; // 1 reg=8 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
if ((RegNumber < 0) || (RegNumber >= sizeof (gRegisterOffsets)/sizeof (UINTN))) {
|
||||
@@ -203,14 +203,14 @@ ReadNthRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ ReadGeneralRegisters (
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
for(i = 0 ; i < sizeof (gRegisterOffsets)/sizeof (UINTN) ; i++) { // there are only 16 registers to read
|
||||
for(i = 0 ; i < sizeof (gRegisterOffsets)/sizeof (UINTN) ; i++) { // there are only 16 registers to read
|
||||
OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
|
||||
}
|
||||
|
||||
@@ -246,26 +246,26 @@ BasicWriteRegister (
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT32 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
NewValue = 0;
|
||||
RegSize = 0;
|
||||
while (RegSize < REG_SIZE) {
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
|
||||
@@ -290,19 +290,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if ((RegNumber < 0) || (RegNumber >= sizeof (gRegisterOffsets)/sizeof (UINTN))) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -327,16 +327,16 @@ WriteGeneralRegisters (
|
||||
UINTN i;
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 129
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 129
|
||||
if (AsciiStrLen(InBuffer) != 129) { // 16 regs, 8 hex chars each, and the end '\0' (escape seq)
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for(i=0; i < sizeof (gRegisterOffsets)/sizeof (UINTN); i++) { // there are only 16 registers to write
|
||||
@@ -346,11 +346,11 @@ WriteGeneralRegisters (
|
||||
SendSuccess();
|
||||
}
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -361,15 +361,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextIa32->Eip = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -421,9 +421,9 @@ GetBreakpointDataAddress (
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@retval {1-4} Currently detected breakpoint value
|
||||
@retval {1-4} Currently detected breakpoint value
|
||||
@retval 0 No breakpoint detected.
|
||||
|
||||
|
||||
**/
|
||||
UINTN
|
||||
GetBreakpointDetected (
|
||||
@@ -444,7 +444,7 @@ GetBreakpointDetected (
|
||||
} else if (Dr6.Bits.B3 == 1) {
|
||||
BreakpointNumber = 4;
|
||||
} else {
|
||||
BreakpointNumber = 0; //No breakpoint detected
|
||||
BreakpointNumber = 0; //No breakpoint detected
|
||||
}
|
||||
|
||||
return BreakpointNumber;
|
||||
@@ -454,13 +454,13 @@ GetBreakpointDetected (
|
||||
/**
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead or DataReadWrite)
|
||||
based on the Breakpoint number
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn field
|
||||
For unknown value, it returns NotSupported.
|
||||
|
||||
|
||||
**/
|
||||
BREAK_TYPE
|
||||
GetBreakpointType (
|
||||
@@ -474,22 +474,22 @@ GetBreakpointType (
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if (BreakpointNumber == 1) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW0;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW0;
|
||||
} else if (BreakpointNumber == 2) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW1;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW1;
|
||||
} else if (BreakpointNumber == 3) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW2;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW2;
|
||||
} else if (BreakpointNumber == 4) {
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW3;
|
||||
Type = (BREAK_TYPE) Dr7.Bits.RW3;
|
||||
}
|
||||
|
||||
return Type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Parses Length and returns the length which DR7 LENn field accepts.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
Zero gets written to DR7 LENn field.
|
||||
|
||||
@param Length Breakpoint length in Bytes (1 byte, 2 byte, 4 byte)
|
||||
@@ -502,7 +502,7 @@ ConvertLengthData (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 1) { //1-Byte length
|
||||
if (Length == 1) { //1-Byte length
|
||||
return 0;
|
||||
} else if (Length == 2) { //2-Byte length
|
||||
return 1;
|
||||
@@ -515,8 +515,8 @@ ConvertLengthData (
|
||||
|
||||
|
||||
/**
|
||||
Finds the next free debug register. If all the registers are occupied then
|
||||
EFI_OUT_OF_RESOURCES is returned.
|
||||
Finds the next free debug register. If all the registers are occupied then
|
||||
EFI_OUT_OF_RESOURCES is returned.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3 for the first free debug register)
|
||||
@@ -553,11 +553,11 @@ FindNextFreeDebugRegister (
|
||||
/**
|
||||
Enables the debug register. Writes Address value to appropriate DR0-3 register.
|
||||
Sets LENn, Gn, RWn bits in DR7 register.
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3)
|
||||
@param Register Register value (0 - 3)
|
||||
@param Address Breakpoint address value
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
or write etc.)
|
||||
|
||||
@retval EFI_STATUS Appropriate status value.
|
||||
@@ -577,15 +577,15 @@ EnableDebugRegister (
|
||||
//Convert length data
|
||||
Length = ConvertLengthData (Length);
|
||||
|
||||
//For Instruction execution, length should be 0
|
||||
//For Instruction execution, length should be 0
|
||||
//(Ref. Intel reference manual 18.2.4)
|
||||
if ((Type == 0) && (Length != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -617,7 +617,7 @@ EnableDebugRegister (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//Update Dr7 with appropriate Gn, RWn and LENn bits
|
||||
//Update Dr7 with appropriate Gn, RWn and LENn bits
|
||||
SystemContext.SystemContextIa32->Dr7 = Dr7.UintN;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -633,7 +633,7 @@ EnableDebugRegister (
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Address Breakpoint address value
|
||||
@param Length Breakpoint length value
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
Data read or write etc.)
|
||||
@param Register Register value to be returned
|
||||
|
||||
@@ -653,7 +653,7 @@ FindMatchingDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -663,24 +663,24 @@ FindMatchingDebugRegister (
|
||||
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
(Dr7.Bits.LEN0 == Length) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr0)) {
|
||||
*Register = 0;
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
(Dr7.Bits.LEN1 == Length) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr1)) {
|
||||
*Register = 1;
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
(Dr7.Bits.LEN2 == Length) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr2)) {
|
||||
*Register = 2;
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
(Dr7.Bits.LEN3 == Length) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr3)) {
|
||||
*Register = 3;
|
||||
} else {
|
||||
@@ -704,12 +704,12 @@ FindMatchingDebugRegister (
|
||||
EFI_STATUS
|
||||
DisableDebugRegister (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN Register
|
||||
IN UINTN Register
|
||||
)
|
||||
{
|
||||
IA32_DR7 Dr7;
|
||||
UINTN Address = 0;
|
||||
|
||||
|
||||
//Read DR7 register so appropriate Gn, RWn and LENn bits can be turned off.
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
@@ -863,15 +863,15 @@ RemoveBreakPoint (
|
||||
}
|
||||
|
||||
switch (Type) {
|
||||
|
||||
|
||||
case 0: //Software breakpoint
|
||||
BreakType = SoftwareBreakpoint;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //Hardware breakpoint
|
||||
BreakType = InstructionExecution;
|
||||
break;
|
||||
|
||||
|
||||
case 2: //Write watchpoint
|
||||
BreakType = DataWrite;
|
||||
break;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Processor specific parts of the GDB stub
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -19,7 +19,7 @@
|
||||
// Array of exception types that need to be hooked by the debugger
|
||||
//
|
||||
EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
{ EXCEPT_X64_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_X64_DIVIDE_ERROR, GDB_SIGFPE },
|
||||
{ EXCEPT_X64_DEBUG, GDB_SIGTRAP },
|
||||
{ EXCEPT_X64_NMI, GDB_SIGEMT },
|
||||
{ EXCEPT_X64_BREAKPOINT, GDB_SIGTRAP },
|
||||
@@ -37,7 +37,7 @@ EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {
|
||||
|
||||
|
||||
// The offsets of registers SystemContextX64.
|
||||
// The fields in the array are in the gdb ordering.
|
||||
// The fields in the array are in the gdb ordering.
|
||||
// HAVE TO DOUBLE-CHECK THE ORDER of the 24 regs
|
||||
//
|
||||
UINTN gRegisterOffsets[] = {
|
||||
@@ -70,8 +70,8 @@ UINTN gRegisterOffsets[] = {
|
||||
|
||||
/**
|
||||
Return the number of entries in the gExceptionType[]
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
|
||||
@retval UINTN, the number of entries in the gExceptionType[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxEfiException (
|
||||
@@ -84,8 +84,8 @@ MaxEfiException (
|
||||
|
||||
/**
|
||||
Return the number of entries in the gRegisters[]
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
|
||||
@retval UINTN, the number of entries (registers) in the gRegisters[] array.
|
||||
**/
|
||||
UINTN
|
||||
MaxRegisterCount (
|
||||
@@ -95,9 +95,9 @@ MaxRegisterCount (
|
||||
return sizeof (gRegisterOffsets)/sizeof (UINTN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the ISA is supported.
|
||||
Check to see if the ISA is supported.
|
||||
ISA = Instruction Set Architecture
|
||||
|
||||
@retval TRUE if Isa is supported
|
||||
@@ -114,14 +114,14 @@ CheckIsa (
|
||||
/**
|
||||
This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering
|
||||
It is, by default, set to find the register pointer of the X64 member
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param RegNumber The register to which we want to find a pointer
|
||||
@retval the pointer to the RegNumber-th pointer
|
||||
**/
|
||||
UINTN *
|
||||
FindPointerToRegister(
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext,
|
||||
IN UINTN RegNumber
|
||||
IN UINTN RegNumber
|
||||
)
|
||||
{
|
||||
UINT8 *TempPtr;
|
||||
@@ -145,7 +145,7 @@ BasicReadRegister (
|
||||
)
|
||||
{
|
||||
UINTN RegSize;
|
||||
|
||||
|
||||
RegSize = 0;
|
||||
while (RegSize < 64) {
|
||||
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
|
||||
@@ -156,8 +156,8 @@ BasicReadRegister (
|
||||
}
|
||||
|
||||
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
/** ‘p n’
|
||||
Reads the n-th register's value into an output buffer and sends it as a packet
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param InBuffer Pointer to the input buffer received from gdb server
|
||||
**/
|
||||
@@ -170,42 +170,42 @@ ReadNthRegister (
|
||||
UINTN RegNumber;
|
||||
CHAR8 OutBuffer[17]; // 1 reg=16 hex chars, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
|
||||
|
||||
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
OutBufPtr = BasicReadRegister(SystemContext, RegNumber, OutBufPtr);
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket (OutBuffer);
|
||||
}
|
||||
|
||||
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
/** ‘g’
|
||||
Reads the general registers into an output buffer and sends it as a packet
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ReadGeneralRegisters (
|
||||
ReadGeneralRegisters (
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINTN i;
|
||||
CHAR8 OutBuffer[385]; // 24 regs, 16 hex chars each, and the end '\0' (escape seq)
|
||||
CHAR8 *OutBufPtr; // pointer to the output buffer
|
||||
|
||||
|
||||
OutBufPtr = OutBuffer;
|
||||
for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 24 registers to read
|
||||
for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 24 registers to read
|
||||
OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
|
||||
}
|
||||
|
||||
|
||||
*OutBufPtr = '\0'; // the end of the buffer
|
||||
SendPacket (OutBuffer);
|
||||
}
|
||||
@@ -229,26 +229,26 @@ BasicWriteRegister (
|
||||
UINTN RegSize;
|
||||
UINTN TempValue; // the value transferred from a hex char
|
||||
UINT64 NewValue; // the new value of the RegNumber-th Register
|
||||
|
||||
|
||||
NewValue = 0;
|
||||
RegSize = 0;
|
||||
while (RegSize < 64) {
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
NewValue += (TempValue << (RegSize+4));
|
||||
TempValue = HexCharToInt(*InBufPtr++);
|
||||
|
||||
|
||||
if (TempValue < 0) {
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
SendError (GDB_EBADMEMDATA);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
|
||||
NewValue += (TempValue << RegSize);
|
||||
RegSize = RegSize + 8;
|
||||
}
|
||||
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
|
||||
@@ -273,19 +273,19 @@ WriteNthRegister (
|
||||
CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE]; // put the 'n..' part of the message into this array
|
||||
CHAR8 *RegNumBufPtr;
|
||||
CHAR8 *InBufPtr; // pointer to the input buffer
|
||||
|
||||
|
||||
// find the register number to write
|
||||
InBufPtr = &InBuffer[1];
|
||||
RegNumBufPtr = RegNumBuffer;
|
||||
while (*InBufPtr != '=') {
|
||||
*RegNumBufPtr++ = *InBufPtr++;
|
||||
}
|
||||
}
|
||||
*RegNumBufPtr = '\0';
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
|
||||
|
||||
// check if this is a valid Register Number
|
||||
if ((RegNumber < 0) || (RegNumber >= MaxRegisterCount())) {
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
SendError (GDB_EINVALIDREGNUM);
|
||||
return;
|
||||
}
|
||||
InBufPtr++; // skips the '=' character
|
||||
@@ -309,30 +309,30 @@ WriteGeneralRegisters (
|
||||
{
|
||||
UINTN i;
|
||||
CHAR8 *InBufPtr; /// pointer to the input buffer
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 385
|
||||
|
||||
// check to see if the buffer is the right size which is
|
||||
// 1 (for 'G') + 16 (for 16 registers) * 8 ( for 8 hex chars each) = 385
|
||||
if (AsciiStrLen(InBuffer) != 385) { // 24 regs, 16 hex chars each, and the end '\0' (escape seq)
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
//Bad message. Message is not the right length
|
||||
SendError (GDB_EBADBUFSIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InBufPtr = &InBuffer[1];
|
||||
|
||||
|
||||
// Read the new values for the registers from the input buffer to an array, NewValueArray.
|
||||
// The values in the array are in the gdb ordering
|
||||
for(i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
|
||||
InBufPtr = BasicWriteRegister(SystemContext, i, InBufPtr);
|
||||
}
|
||||
|
||||
|
||||
SendSuccess();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Insert Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -343,11 +343,11 @@ AddSingleStep (
|
||||
SystemContext.SystemContextX64->Rflags |= TF_BIT; //Setting the TF bit.
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
/**
|
||||
Remove Single Step in the SystemContext
|
||||
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
@@ -360,11 +360,11 @@ RemoveSingleStep (
|
||||
|
||||
|
||||
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
/** ‘c [addr ]’
|
||||
Continue. addr is Address to resume. If addr is omitted, resume at current
|
||||
Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -375,15 +375,15 @@ ContinueAtAddress (
|
||||
{
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn(&PacketData[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ‘s [addr ]’
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
Single step. addr is the Address at which to resume. If addr is omitted, resume
|
||||
at same Address.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -395,19 +395,19 @@ SingleStep (
|
||||
if (PacketData[1] != '\0') {
|
||||
SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn (&PacketData[1]);
|
||||
}
|
||||
|
||||
|
||||
AddSingleStep (SystemContext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns breakpoint data address from DR0-DR3 based on the input breakpoint
|
||||
Returns breakpoint data address from DR0-DR3 based on the input breakpoint
|
||||
number
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
@retval Address Data address from DR0-DR3 based on the
|
||||
@retval Address Data address from DR0-DR3 based on the
|
||||
breakpoint number.
|
||||
|
||||
**/
|
||||
@@ -435,7 +435,7 @@ GetBreakpointDataAddress (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns currently detected breakpoint value based on the register
|
||||
Returns currently detected breakpoint value based on the register
|
||||
DR6 B0-B3 field.
|
||||
If no breakpoint is detected then it returns 0.
|
||||
|
||||
@@ -471,13 +471,13 @@ GetBreakpointDetected (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead
|
||||
Returns Breakpoint type (InstructionExecution, DataWrite, DataRead
|
||||
or DataReadWrite) based on the Breakpoint number
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param BreakpointNumber Breakpoint number
|
||||
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn
|
||||
@retval BREAK_TYPE Breakpoint type value read from register DR7 RWn
|
||||
field. For unknown value, it returns NotSupported.
|
||||
|
||||
**/
|
||||
@@ -506,9 +506,9 @@ GetBreakpointType (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Parses Length and returns the length which DR7 LENn field accepts.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
For example: If we receive 1-Byte length then we should return 0.
|
||||
Zero gets written to DR7 LENn field.
|
||||
|
||||
@param Length Breakpoint length in Bytes (1 byte, 2 byte, 4 byte)
|
||||
@@ -521,7 +521,7 @@ ConvertLengthData (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 1) { //1-Byte length
|
||||
if (Length == 1) { //1-Byte length
|
||||
return 0;
|
||||
} else if (Length == 2) { //2-Byte length
|
||||
return 1;
|
||||
@@ -576,7 +576,7 @@ FindNextFreeDebugRegister (
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Register Register value (0 - 3)
|
||||
@param Address Breakpoint address value
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
@param Type Breakpoint type (Instruction, Data write,
|
||||
Data read or write etc.)
|
||||
|
||||
@retval EFI_STATUS Appropriate status value.
|
||||
@@ -596,7 +596,7 @@ EnableDebugRegister (
|
||||
//Convert length data
|
||||
Length = ConvertLengthData (Length);
|
||||
|
||||
//For Instruction execution, length should be 0
|
||||
//For Instruction execution, length should be 0
|
||||
//(Ref. Intel reference manual 18.2.4)
|
||||
if ((Type == 0) && (Length != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -604,7 +604,7 @@ EnableDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -643,14 +643,14 @@ EnableDebugRegister (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns register number 0 - 3 for the maching debug register.
|
||||
This function compares incoming Address, Type, Length and
|
||||
/**
|
||||
Returns register number 0 - 3 for the maching debug register.
|
||||
This function compares incoming Address, Type, Length and
|
||||
if there is a match then it returns the appropriate register number.
|
||||
In case of mismatch, function returns EFI_NOT_FOUND message.
|
||||
|
||||
@param SystemContext Register content at time of the exception
|
||||
@param Address Breakpoint address value
|
||||
@param Address Breakpoint address value
|
||||
@param Length Breakpoint length value
|
||||
@param Type Breakpoint type (Instruction, Data write, Data read
|
||||
or write etc.)
|
||||
@@ -672,7 +672,7 @@ FindMatchingDebugRegister (
|
||||
|
||||
//Hardware doesn't support ReadWatch (z3 packet) type. GDB can handle
|
||||
//software breakpoint. We should send empty packet in both these cases.
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
if ((Type == (BREAK_TYPE)DataRead) ||
|
||||
(Type == (BREAK_TYPE)SoftwareBreakpoint)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -682,24 +682,24 @@ FindMatchingDebugRegister (
|
||||
|
||||
Dr7.UintN = SystemContext.SystemContextIa32->Dr7;
|
||||
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
if ((Dr7.Bits.G0 == 1) &&
|
||||
(Dr7.Bits.LEN0 == Length) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Dr7.Bits.RW0 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr0)) {
|
||||
*Register = 0;
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
} else if ((Dr7.Bits.G1 == 1) &&
|
||||
(Dr7.Bits.LEN1 == Length) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Dr7.Bits.RW1 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr1)) {
|
||||
*Register = 1;
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
} else if ((Dr7.Bits.G2 == 1) &&
|
||||
(Dr7.Bits.LEN2 == Length) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Dr7.Bits.RW2 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr2)) {
|
||||
*Register = 2;
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
} else if ((Dr7.Bits.G3 == 1) &&
|
||||
(Dr7.Bits.LEN3 == Length) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Dr7.Bits.RW3 == Type) &&
|
||||
(Address == SystemContext.SystemContextIa32->Dr3)) {
|
||||
*Register = 3;
|
||||
} else {
|
||||
@@ -884,15 +884,15 @@ RemoveBreakPoint (
|
||||
}
|
||||
|
||||
switch (Type) {
|
||||
|
||||
|
||||
case 0: //Software breakpoint
|
||||
BreakType = SoftwareBreakpoint;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //Hardware breakpoint
|
||||
BreakType = InstructionExecution;
|
||||
break;
|
||||
|
||||
|
||||
case 2: //Write watchpoint
|
||||
BreakType = DataWrite;
|
||||
break;
|
||||
@@ -954,8 +954,8 @@ ValidateAddress (
|
||||
|
||||
BOOLEAN
|
||||
ValidateException (
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE ExceptionType,
|
||||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Basic serial IO abstaction for GDB
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -28,10 +28,10 @@ UINTN gTimeOut = 0;
|
||||
|
||||
/**
|
||||
The constructor function initializes the UART.
|
||||
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
@@ -43,20 +43,20 @@ GdbSerialLibDebugPortConstructor (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&gDebugPort);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gTimeOut = PcdGet32 (PcdGdbMaxPacketRetryCount);
|
||||
gDebugPort->Reset (gDebugPort);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data buts, and stop bits on a serial device. This call is optional as the serial
|
||||
port will be set up with defaults base on PCD values.
|
||||
|
||||
@@ -77,14 +77,14 @@ GdbSerialLibDebugPortConstructor (
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
GdbSerialInit (
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Status = gDebugPort->Reset (gDebugPort);
|
||||
return Status;
|
||||
}
|
||||
@@ -96,18 +96,18 @@ GdbSerialInit (
|
||||
|
||||
@return TRUE - Character availible
|
||||
@return FALSE - Character not availible
|
||||
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GdbIsCharAvailable (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Status = gDebugPort->Poll (gDebugPort);
|
||||
|
||||
|
||||
return (Status == EFI_SUCCESS ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ GdbIsCharAvailable (
|
||||
Get a character from GDB. This function must be able to run in interrupt context.
|
||||
|
||||
@return A character from GDB
|
||||
|
||||
|
||||
**/
|
||||
CHAR8
|
||||
EFIAPI
|
||||
@@ -127,12 +127,12 @@ GdbGetChar (
|
||||
EFI_STATUS Status;
|
||||
CHAR8 Char;
|
||||
UINTN BufferSize;
|
||||
|
||||
|
||||
do {
|
||||
BufferSize = sizeof (Char);
|
||||
Status = gDebugPort->Read (gDebugPort, gTimeOut, &BufferSize, &Char);
|
||||
} while (EFI_ERROR (Status) || BufferSize != sizeof (Char));
|
||||
|
||||
|
||||
return Char;
|
||||
}
|
||||
|
||||
@@ -153,12 +153,12 @@ GdbPutChar (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
|
||||
|
||||
do {
|
||||
BufferSize = sizeof (Char);
|
||||
Status = gDebugPort->Write (gDebugPort, gTimeOut, &BufferSize, &Char);
|
||||
} while (EFI_ERROR (Status) || BufferSize != sizeof (Char));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
|
||||
[Protocols.common]
|
||||
gEfiDebugPortProtocolGuid
|
||||
|
||||
|
||||
[FixedPcd.common]
|
||||
gEmbeddedTokenSpaceGuid.PcdGdbBaudRate|115200
|
||||
gEmbeddedTokenSpaceGuid.PcdGdbDataBits|8
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Basic serial IO abstaction for GDB
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -54,10 +54,10 @@ UINTN gPort;
|
||||
|
||||
/**
|
||||
The constructor function initializes the UART.
|
||||
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
@@ -72,9 +72,9 @@ GdbSerialLibConstructor (
|
||||
UINT8 DataBits;
|
||||
UINT8 Parity;
|
||||
UINT8 StopBits;
|
||||
|
||||
|
||||
gPort = (UINTN)PcdGet32 (PcdGdbUartPort);
|
||||
|
||||
|
||||
BaudRate = PcdGet64 (PcdGdbBaudRate);
|
||||
Parity = PcdGet8 (PcdGdbParity);
|
||||
DataBits = PcdGet8 (PcdGdbDataBits);
|
||||
@@ -86,7 +86,7 @@ GdbSerialLibConstructor (
|
||||
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data buts, and stop bits on a serial device. This call is optional as the serial
|
||||
port will be set up with defaults base on PCD values.
|
||||
|
||||
@@ -107,10 +107,10 @@ GdbSerialLibConstructor (
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
GdbSerialInit (
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT8 Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN UINT8 StopBits
|
||||
)
|
||||
{
|
||||
UINTN Divisor;
|
||||
@@ -121,7 +121,7 @@ GdbSerialInit (
|
||||
//
|
||||
// We assume the UART has been turned on to decode gPort address range
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Map 5..8 to 0..3
|
||||
//
|
||||
@@ -130,8 +130,8 @@ GdbSerialInit (
|
||||
//
|
||||
// Calculate divisor for baud generator
|
||||
//
|
||||
Divisor = 115200/(UINTN)BaudRate;
|
||||
|
||||
Divisor = 115200/(UINTN)BaudRate;
|
||||
|
||||
//
|
||||
// Set communications format
|
||||
//
|
||||
@@ -167,18 +167,18 @@ GdbSerialInit (
|
||||
|
||||
@return TRUE - Character availible
|
||||
@return FALSE - Character not availible
|
||||
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GdbIsCharAvailable (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
UINT8 Data;
|
||||
|
||||
|
||||
Data = IoRead8 (gPort + LSR_OFFSET);
|
||||
|
||||
|
||||
return ((Data & LSR_RXDA) == LSR_RXDA);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ GdbIsCharAvailable (
|
||||
Get a character from GDB. This function must be able to run in interrupt context.
|
||||
|
||||
@return A character from GDB
|
||||
|
||||
|
||||
**/
|
||||
CHAR8
|
||||
EFIAPI
|
||||
@@ -204,7 +204,7 @@ GdbGetChar (
|
||||
} while ((Data & LSR_RXDA) == 0);
|
||||
|
||||
Char = IoRead8 (gPort);
|
||||
|
||||
|
||||
// Make this an EFI_D_INFO after we get everything debugged.
|
||||
DEBUG ((EFI_D_ERROR, "<%c<", Char));
|
||||
return Char;
|
||||
@@ -226,15 +226,15 @@ GdbPutChar (
|
||||
)
|
||||
{
|
||||
UINT8 Data;
|
||||
|
||||
|
||||
// Make this an EFI_D_INFO after we get everything debugged.
|
||||
DEBUG ((EFI_D_ERROR, ">%c>", Char));
|
||||
|
||||
|
||||
// Wait for the serial port to be ready
|
||||
do {
|
||||
Data = IoRead8 (gPort + LSR_OFFSET);
|
||||
} while ((Data & LSR_TXRDY) == 0);
|
||||
|
||||
|
||||
IoWrite8 (gPort, Char);
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Generic Capsule services
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -19,7 +19,7 @@
|
||||
//
|
||||
//Max size capsule services support are platform policy,to populate capsules we just need
|
||||
//memory to maintain them across reset,it is not a problem. And to special capsules ,for
|
||||
//example,update flash,it is mostly decided by the platform. Here is a sample size for
|
||||
//example,update flash,it is mostly decided by the platform. Here is a sample size for
|
||||
//different type capsules.
|
||||
//
|
||||
#define MAX_SIZE_POPULATE (0)
|
||||
@@ -34,8 +34,8 @@ SupportUpdateCapsuleRest (
|
||||
)
|
||||
{
|
||||
//
|
||||
//If the platform has a way to guarantee the memory integrity across a system reset, return
|
||||
//TRUE, else FALSE.
|
||||
//If the platform has a way to guarantee the memory integrity across a system reset, return
|
||||
//TRUE, else FALSE.
|
||||
//
|
||||
return FALSE;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ SupportCapsuleSize (
|
||||
//
|
||||
*MaxSizePopulate = MAX_SIZE_POPULATE;
|
||||
*MaxSizeNonPopulate = MAX_SIZE_NON_POPULATE;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ Arguments:
|
||||
CapsuleHeaderArray A array of pointers to capsule headers passed in
|
||||
CapsuleCount The number of capsule
|
||||
ScatterGatherList Physical address of datablock list points to capsule
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI STATUS
|
||||
@@ -85,8 +85,8 @@ Returns:
|
||||
not set, the capsule has been successfully processed by the firmware.
|
||||
If it set, the ScattlerGatherList is successfully to be set.
|
||||
EFI_INVALID_PARAMETER CapsuleCount is less than 1,CapsuleGuid is not supported.
|
||||
EFI_DEVICE_ERROR Failed to SetVariable or AllocatePool or ProcessFirmwareVolume.
|
||||
|
||||
EFI_DEVICE_ERROR Failed to SetVariable or AllocatePool or ProcessFirmwareVolume.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN CapsuleSize;
|
||||
@@ -110,17 +110,17 @@ Returns:
|
||||
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
|
||||
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
|
||||
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (!CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiCapsuleGuid)) {
|
||||
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//Assume that capsules have the same flags on reseting or not.
|
||||
//Assume that capsules have the same flags on reseting or not.
|
||||
//
|
||||
CapsuleHeader = CapsuleHeaderArray[0];
|
||||
|
||||
@@ -131,28 +131,28 @@ Returns:
|
||||
if (!SupportUpdateCapsuleRest()) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
if (ScatterGatherList == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = EfiSetVariable (
|
||||
EFI_CAPSULE_VARIABLE_NAME,
|
||||
&gEfiCapsuleVendorGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (UINTN),
|
||||
(VOID *) &ScatterGatherList
|
||||
EFI_CAPSULE_VARIABLE_NAME,
|
||||
&gEfiCapsuleVendorGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (UINTN),
|
||||
(VOID *) &ScatterGatherList
|
||||
);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
if (Status != EFI_SUCCESS) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//The rest occurs in the condition of non-reset mode
|
||||
//
|
||||
if (EfiAtRuntime ()) {
|
||||
if (EfiAtRuntime ()) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ Returns:
|
||||
gBS->CopyMem (BufferPtr, (UINT8*)CapsuleHeader+ CapsuleHeader->HeaderSize, CapsuleSize);
|
||||
|
||||
//
|
||||
//Call DXE service ProcessFirmwareVolume to process immediatelly
|
||||
//Call DXE service ProcessFirmwareVolume to process immediatelly
|
||||
//
|
||||
Status = gDS->ProcessFirmwareVolume (BufferPtr, CapsuleSize, &FvHandle);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
@@ -184,7 +184,7 @@ Returns:
|
||||
Done:
|
||||
if (BufferPtr != NULL) {
|
||||
gBS->FreePool (BufferPtr);
|
||||
}
|
||||
}
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@@ -231,10 +231,10 @@ Returns:
|
||||
|
||||
if ((MaxiumCapsuleSize == NULL) ||(ResetType == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
CapsuleHeader = NULL;
|
||||
|
||||
|
||||
//
|
||||
//Compare GUIDs with EFI_CAPSULE_GUID, if capsule header contains CAPSULE_FLAGS_PERSIST_ACROSS_RESET
|
||||
//and CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flags,whatever the GUID is ,the service supports.
|
||||
@@ -242,20 +242,20 @@ Returns:
|
||||
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
|
||||
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
|
||||
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (!CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiCapsuleGuid)) {
|
||||
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SupportCapsuleSize(&MaxSizePopulate,&MaxSizeNonPopulate);
|
||||
//
|
||||
//Assume that capsules have the same flags on reseting or not.
|
||||
//Assume that capsules have the same flags on reseting or not.
|
||||
//
|
||||
CapsuleHeader = CapsuleHeaderArray[0];
|
||||
CapsuleHeader = CapsuleHeaderArray[0];
|
||||
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
|
||||
//
|
||||
//Check if the platform supports update capsule across a system reset
|
||||
@@ -264,11 +264,11 @@ Returns:
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
*ResetType = EfiResetWarm;
|
||||
*MaxiumCapsuleSize = MaxSizePopulate;
|
||||
*MaxiumCapsuleSize = MaxSizePopulate;
|
||||
} else {
|
||||
*ResetType = EfiResetCold;
|
||||
*MaxiumCapsuleSize = MaxSizeNonPopulate;
|
||||
}
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS The event has been handled properly
|
||||
EFI_SUCCESS The event has been handled properly
|
||||
EFI_NOT_FOUND An error occurred updating the variable.
|
||||
|
||||
--*/
|
||||
@@ -106,7 +106,7 @@ LibMtcGetNextHighMonotonicCount (
|
||||
|
||||
*HighCount = (UINT32) RShiftU64 (mEfiMtc, 32) + 1;
|
||||
mEfiMtc = LShiftU64 (*HighCount, 32);
|
||||
|
||||
|
||||
if (!EfiAtRuntime ()) {
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Report status code lib on top of either SerialLib and/or EFI Serial Protocol.
|
||||
Based on PcdStatusCodeUseEfiSerial & PcdStatusCodeUseHardSerial settings
|
||||
|
||||
There is just a single runtime memory buffer that contans all the data.
|
||||
There is just a single runtime memory buffer that contans all the data.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
@@ -77,12 +77,12 @@ LibReportStatusCode (
|
||||
// Print DEBUG() information into output buffer.
|
||||
//
|
||||
CharCount = AsciiVSPrint (
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
Format,
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
Format,
|
||||
Marker
|
||||
);
|
||||
} else if (Data != NULL &&
|
||||
} else if (Data != NULL &&
|
||||
CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&
|
||||
(CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
|
||||
//
|
||||
@@ -98,19 +98,19 @@ LibReportStatusCode (
|
||||
// Print ERROR information into output buffer.
|
||||
//
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"ERROR: C%x:V%x I%x",
|
||||
CodeType,
|
||||
Value,
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"ERROR: C%x:V%x I%x",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
|
||||
//
|
||||
// Make sure we don't try to print values that weren't
|
||||
// Make sure we don't try to print values that weren't
|
||||
// intended to be printed, especially NULL GUID pointers.
|
||||
//
|
||||
|
||||
|
||||
if (CallerId != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
@@ -136,19 +136,19 @@ LibReportStatusCode (
|
||||
);
|
||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"PROGRESS CODE: V%x I%x\n\r",
|
||||
Value,
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"PROGRESS CODE: V%x I%x\n\r",
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
} else {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"Undefined: C%x:V%x I%x\n\r",
|
||||
CodeType,
|
||||
Value,
|
||||
Buffer,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
"Undefined: C%x:V%x I%x\n\r",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ LibReportStatusCode (
|
||||
gBS->LocateProtocol (&gEfiSerialIoProtocolGuid, NULL, (VOID **) &mSerialIoProtocol);
|
||||
}
|
||||
|
||||
if (mSerialIoProtocol == NULL) {
|
||||
if (mSerialIoProtocol == NULL) {
|
||||
mSerialIoProtocol->Write (
|
||||
mSerialIoProtocol,
|
||||
&CharCount,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -255,8 +255,8 @@ RtcTimeFieldsValid (
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
Returns:
|
||||
--*/
|
||||
// TODO: Time - add argument and description to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Variable services implemented from system memory
|
||||
|
||||
There is just a single runtime memory buffer that contans all the data.
|
||||
There is just a single runtime memory buffer that contans all the data.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -50,7 +50,7 @@ AddEntry (
|
||||
EFI_TPL CurrentTpl;
|
||||
|
||||
|
||||
SizeOfString = StrSize (VariableName);
|
||||
SizeOfString = StrSize (VariableName);
|
||||
Size = SizeOfString + sizeof (VARIABLE_ARRAY_ENTRY) + DataSize;
|
||||
if ((VARIABLE_ARRAY_ENTRY *)(((UINT8 *)mVariableArrayNextFree) + Size) > mVariableArrayEnd) {
|
||||
// ran out of space
|
||||
@@ -70,7 +70,7 @@ AddEntry (
|
||||
mVariableArrayNextFree = (VARIABLE_ARRAY_ENTRY *)(((UINT8 *)mVariableArrayNextFree) + SizeOfString);
|
||||
CopyMem (mVariableArrayNextFree, Data, DataSize);
|
||||
mVariableArrayNextFree = (VARIABLE_ARRAY_ENTRY *)(((UINT8 *)mVariableArrayNextFree) + DataSize);
|
||||
|
||||
|
||||
if (!EfiAtRuntime ()) {
|
||||
// Exit Critical section
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
@@ -78,7 +78,7 @@ AddEntry (
|
||||
|
||||
return Entry;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DeleteEntry (
|
||||
IN VARIABLE_ARRAY_ENTRY *Entry
|
||||
@@ -199,22 +199,22 @@ LibGetNextVariableName (
|
||||
if (Entry == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
// If we are at runtime skip variables that do not have the Runitme attribute set.
|
||||
Done = (EfiAtRuntime () && ((Entry->Attribute & EFI_VARIABLE_RUNTIME_ACCESS) == 0)) ? FALSE : TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
StringSize = StrSize ((CHAR16 *)(Entry + 1));
|
||||
Entry = (VARIABLE_ARRAY_ENTRY *)(((UINT8 *)Entry) + (StringSize + sizeof (VARIABLE_ARRAY_ENTRY) + Entry->DataSize));
|
||||
if (Entry >= mVariableArrayEnd) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
if (*VariableNameSize < StringSize) {
|
||||
*VariableNameSize = StringSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
|
||||
*VariableNameSize = StringSize;
|
||||
CopyMem (VariableName, (CHAR16 *)(Entry + 1), StringSize);
|
||||
CopyMem (VendorGuid, &Entry->VendorGuid, sizeof (EFI_GUID));
|
||||
@@ -298,9 +298,9 @@ LibVariableInitialize (VOID)
|
||||
ASSERT (mVariableArray != NULL);
|
||||
|
||||
mVariableArrayEnd = (VARIABLE_ARRAY_ENTRY *)(((UINT8 *)mVariableArray) + Size);
|
||||
|
||||
|
||||
mMaximumVariableStorageSize = Size - sizeof (VARIABLE_ARRAY_ENTRY);
|
||||
mRemainingVariableStorageSize = mMaximumVariableStorageSize;
|
||||
mMaximumVariableSize = mMaximumVariableStorageSize;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,17 +34,17 @@ LzmaDecompressLibConstructor (
|
||||
)
|
||||
{
|
||||
EXTRACT_SECTION_HOB *Hob;
|
||||
|
||||
|
||||
Hob = GetFirstGuidHob (&gLzmaCustomDecompressGuid);
|
||||
if (Hob == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Locate Guided Hob
|
||||
|
||||
// Locate Guided Hob
|
||||
|
||||
return ExtractGuidedSectionRegisterHandlers (
|
||||
&gLzmaCustomDecompressGuid,
|
||||
Hob->Data.SectionGetInfo,
|
||||
Hob->Data.SectionExtraction
|
||||
);
|
||||
);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
|
||||
#
|
||||
# It is based on the LZMA SDK 4.65.
|
||||
# LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
|
||||
# LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
|
||||
# It was released on the http://www.7-zip.org/sdk.html website.
|
||||
#
|
||||
# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Generic ARM implementation of DmaLib.h
|
||||
|
||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -20,25 +20,25 @@
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Provides the DMA controller-specific addresses needed to access system memory.
|
||||
|
||||
|
||||
Operation is relative to the DMA bus master.
|
||||
|
||||
|
||||
@param Operation Indicates if the bus master is going to read or write to system memory.
|
||||
@param HostAddress The system memory address to map to the DMA controller.
|
||||
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
|
||||
that were mapped.
|
||||
that were mapped.
|
||||
@param DeviceAddress The resulting map address for the bus master controller to use to
|
||||
access the hosts HostAddress.
|
||||
access the hosts HostAddress.
|
||||
@param Mapping A resulting value to pass to Unmap().
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
|
||||
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
||||
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -56,15 +56,15 @@ DmaMap (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Completes the DmaMapBusMasterRead(), DmaMapBusMasterWrite(), or DmaMapBusMasterCommonBuffer()
|
||||
operation and releases any corresponding resources.
|
||||
|
||||
|
||||
@param Mapping The mapping value returned from DmaMap*().
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The range was unmapped.
|
||||
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -75,22 +75,22 @@ DmaUnmap (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Allocates pages that are suitable for an DmaMap() of type MapOperationBusMasterCommonBuffer.
|
||||
mapping.
|
||||
|
||||
mapping.
|
||||
|
||||
@param MemoryType The type of memory to allocate, EfiBootServicesData or
|
||||
EfiRuntimeServicesData.
|
||||
@param Pages The number of pages to allocate.
|
||||
EfiRuntimeServicesData.
|
||||
@param Pages The number of pages to allocate.
|
||||
@param HostAddress A pointer to store the base system memory address of the
|
||||
allocated range.
|
||||
allocated range.
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were allocated.
|
||||
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
|
||||
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
||||
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -121,16 +121,16 @@ DmaAllocateBuffer (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Frees memory that was allocated with DmaAllocateBuffer().
|
||||
|
||||
@param Pages The number of pages to free.
|
||||
@param HostAddress The base system memory address of the allocated range.
|
||||
|
||||
|
||||
@param Pages The number of pages to free.
|
||||
@param HostAddress The base system memory address of the allocated range.
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were freed.
|
||||
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
|
||||
was not allocated with DmaAllocateBuffer().
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -141,8 +141,8 @@ DmaFreeBuffer (
|
||||
{
|
||||
if (HostAddress == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FreePages (HostAddress, Pages);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
@@ -17,7 +17,7 @@
|
||||
FILE_GUID = 0F2A0816-D319-4ee7-A6B8-D58524E4428F
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = DmaLib
|
||||
LIBRARY_CLASS = DmaLib
|
||||
|
||||
[Sources.common]
|
||||
NullDmaLib.c
|
||||
@@ -29,13 +29,13 @@
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
MemoryAllocationLib
|
||||
|
||||
|
||||
|
||||
|
||||
[Protocols]
|
||||
|
||||
|
||||
[Guids]
|
||||
|
||||
|
||||
[Pcd]
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
TRUE
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -38,7 +38,7 @@ GetSavedData (
|
||||
|
||||
GuidHob = GetFirstGuidHob(&SavedDataGuid);
|
||||
GuidHob++;
|
||||
|
||||
|
||||
return (PRE_PI_EXTRACT_GUIDED_SECTION_DATA *)GuidHob;
|
||||
}
|
||||
|
||||
@@ -78,21 +78,21 @@ ExtractGuidedSectionRegisterHandlers (
|
||||
SavedData->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check the global table is enough to contain new Handler.
|
||||
//
|
||||
if (SavedData->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) {
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Register new Handler and guid value.
|
||||
//
|
||||
CopyGuid (&SavedData->ExtractHandlerGuidTable [SavedData->NumberOfExtractHandler], SectionGuid);
|
||||
SavedData->ExtractDecodeHandlerTable [SavedData->NumberOfExtractHandler] = DecodeHandler;
|
||||
SavedData->ExtractGetInfoHandlerTable [SavedData->NumberOfExtractHandler++] = GetInfoHandler;
|
||||
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ ExtractGuidedSectionGetGuidList (
|
||||
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData;
|
||||
|
||||
ASSERT(ExtractHandlerGuidTable != NULL);
|
||||
|
||||
|
||||
SavedData = GetSavedData();
|
||||
|
||||
|
||||
*ExtractHandlerGuidTable = SavedData->ExtractHandlerGuidTable;
|
||||
return SavedData->NumberOfExtractHandler;
|
||||
}
|
||||
@@ -118,20 +118,20 @@ ExtractGuidedSectionGetInfo (
|
||||
IN CONST VOID *InputSection,
|
||||
OUT UINT32 *OutputBufferSize,
|
||||
OUT UINT32 *ScratchBufferSize,
|
||||
OUT UINT16 *SectionAttribute
|
||||
OUT UINT16 *SectionAttribute
|
||||
)
|
||||
{
|
||||
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData;
|
||||
UINT32 Index;
|
||||
|
||||
|
||||
if (InputSection == NULL) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
ASSERT (OutputBufferSize != NULL);
|
||||
ASSERT (ScratchBufferSize != NULL);
|
||||
ASSERT (SectionAttribute != NULL);
|
||||
|
||||
|
||||
SavedData = GetSavedData();
|
||||
|
||||
//
|
||||
@@ -144,7 +144,7 @@ ExtractGuidedSectionGetInfo (
|
||||
}
|
||||
|
||||
//
|
||||
// Not found, the input guided section is not supported.
|
||||
// Not found, the input guided section is not supported.
|
||||
//
|
||||
if (Index == SavedData->NumberOfExtractHandler) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
@@ -167,16 +167,16 @@ ExtractGuidedSectionDecode (
|
||||
IN CONST VOID *InputSection,
|
||||
OUT VOID **OutputBuffer,
|
||||
OUT VOID *ScratchBuffer, OPTIONAL
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
)
|
||||
{
|
||||
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData;
|
||||
UINT32 Index;
|
||||
|
||||
|
||||
if (InputSection == NULL) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
ASSERT (OutputBuffer != NULL);
|
||||
ASSERT (AuthenticationStatus != NULL);
|
||||
|
||||
@@ -192,7 +192,7 @@ ExtractGuidedSectionDecode (
|
||||
}
|
||||
|
||||
//
|
||||
// Not found, the input guided section is not supported.
|
||||
// Not found, the input guided section is not supported.
|
||||
//
|
||||
if (Index == SavedData->NumberOfExtractHandler) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
@@ -225,7 +225,7 @@ ExtractGuidedSectionLibConstructor (
|
||||
if (SavedData.ExtractHandlerGuidTable == NULL) {
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
SavedData.ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)AllocatePool(PcdGet32(PcdMaximumGuidedExtractHandler) * sizeof(EXTRACT_GUIDED_SECTION_DECODE_HANDLER));
|
||||
if (SavedData.ExtractDecodeHandlerTable == NULL) {
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
@@ -235,13 +235,13 @@ ExtractGuidedSectionLibConstructor (
|
||||
if (SavedData.ExtractGetInfoHandlerTable == NULL) {
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// the initialized number is Zero.
|
||||
//
|
||||
SavedData.NumberOfExtractHandler = 0;
|
||||
|
||||
|
||||
BuildGuidDataHob(&HobGuid, &SavedData, sizeof(SavedData));
|
||||
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
@@ -33,4 +33,4 @@
|
||||
DebugLib
|
||||
|
||||
[FixedPcd.common]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler
|
||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -193,7 +193,7 @@ CreateHobList (
|
||||
SetHobList (Hob);
|
||||
|
||||
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
|
||||
|
||||
|
||||
Attributes =(
|
||||
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||||
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||||
@@ -209,25 +209,25 @@ CreateHobList (
|
||||
BuildStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN)StackBase, ((UINTN)MemoryBegin + MemoryLength) - (UINTN)StackBase);
|
||||
|
||||
if (FeaturePcdGet (PcdPrePiProduceMemoryTypeInformationHob)) {
|
||||
// Optional feature that helps prevent EFI memory map fragmentation.
|
||||
// Optional feature that helps prevent EFI memory map fragmentation.
|
||||
BuildMemoryTypeInformationHob ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
BuildFvHobs (
|
||||
BuildFvHobs (
|
||||
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
|
||||
IN UINT64 NumberOfBytes,
|
||||
IN EFI_RESOURCE_ATTRIBUTE_TYPE *ResourceAttribute
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
EFI_RESOURCE_ATTRIBUTE_TYPE Resource;
|
||||
|
||||
|
||||
BuildFvHob (PhysicalStart, NumberOfBytes);
|
||||
|
||||
|
||||
if (ResourceAttribute == NULL) {
|
||||
Resource = (EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||||
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||||
@@ -236,14 +236,14 @@ BuildFvHobs (
|
||||
} else {
|
||||
Resource = *ResourceAttribute;
|
||||
}
|
||||
|
||||
|
||||
BuildResourceDescriptorHob (EFI_RESOURCE_FIRMWARE_DEVICE, Resource, PhysicalStart, NumberOfBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the next instance of a HOB type from the starting HOB.
|
||||
|
||||
This function searches the first instance of a HOB type from the starting HOB pointer.
|
||||
This function searches the first instance of a HOB type from the starting HOB pointer.
|
||||
If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
unconditionally: it returns HobStart back if HobStart itself meets the requirement;
|
||||
@@ -266,7 +266,7 @@ GetNextHob (
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
|
||||
ASSERT (HobStart != NULL);
|
||||
|
||||
|
||||
Hob.Raw = (UINT8 *) HobStart;
|
||||
//
|
||||
// Parse the HOB list until end of list or matching type is found.
|
||||
@@ -279,14 +279,14 @@ GetNextHob (
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Returns the first instance of a HOB type among the whole HOB list.
|
||||
|
||||
This function searches the first instance of a HOB type among the whole HOB list.
|
||||
If there does not exist such HOB type in the HOB list, it will return NULL.
|
||||
This function searches the first instance of a HOB type among the whole HOB list.
|
||||
If there does not exist such HOB type in the HOB list, it will return NULL.
|
||||
|
||||
@param Type The HOB type to return.
|
||||
|
||||
@@ -307,10 +307,10 @@ GetFirstHob (
|
||||
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB from the starting HOB pointer.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
This function searches the first instance of a HOB from the starting HOB pointer.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
|
||||
to extract the data section and its size info respectively.
|
||||
In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
|
||||
@@ -345,7 +345,7 @@ GetNextGuidHob (
|
||||
|
||||
|
||||
/**
|
||||
This function searches the first instance of a HOB among the whole HOB list.
|
||||
This function searches the first instance of a HOB among the whole HOB list.
|
||||
Such HOB should satisfy two conditions:
|
||||
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
|
||||
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
|
||||
@@ -374,7 +374,7 @@ GetFirstGuidHob (
|
||||
/**
|
||||
Get the Boot Mode from the HOB list.
|
||||
|
||||
This function returns the system boot mode information from the
|
||||
This function returns the system boot mode information from the
|
||||
PHIT HOB in HOB list.
|
||||
|
||||
@param VOID
|
||||
@@ -398,7 +398,7 @@ GetBootMode (
|
||||
/**
|
||||
Get the Boot Mode from the HOB list.
|
||||
|
||||
This function returns the system boot mode information from the
|
||||
This function returns the system boot mode information from the
|
||||
PHIT HOB in HOB list.
|
||||
|
||||
@param VOID
|
||||
@@ -459,7 +459,7 @@ BuildModuleHob (
|
||||
// Zero the reserved space to match HOB spec
|
||||
//
|
||||
ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));
|
||||
|
||||
|
||||
CopyGuid (&Hob->ModuleName, ModuleName);
|
||||
Hob->EntryPoint = EntryPoint;
|
||||
}
|
||||
@@ -467,8 +467,8 @@ BuildModuleHob (
|
||||
/**
|
||||
Builds a GUID HOB with a certain data length.
|
||||
|
||||
This function builds a customized HOB tagged with a GUID for identification
|
||||
and returns the start address of GUID HOB data so that caller can fill the customized data.
|
||||
This function builds a customized HOB tagged with a GUID for identification
|
||||
and returns the start address of GUID HOB data so that caller can fill the customized data.
|
||||
The HOB Header and Name field is already stripped.
|
||||
It can only be invoked during PEI phase;
|
||||
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
|
||||
@@ -580,7 +580,7 @@ BuildFvHob (
|
||||
@param Length The size of the Firmware Volume in bytes.
|
||||
@param FvName The name of the Firmware Volume.
|
||||
@param FileName The name of the file.
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
@@ -655,7 +655,7 @@ BuildCpuHob (
|
||||
//
|
||||
// Zero the reserved space to match HOB spec
|
||||
//
|
||||
ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
|
||||
ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
|
||||
}
|
||||
|
||||
|
||||
@@ -762,9 +762,9 @@ BuildMemoryAllocationHob (
|
||||
|
||||
ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
|
||||
((Length & (EFI_PAGE_SIZE - 1)) == 0));
|
||||
|
||||
|
||||
Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));
|
||||
|
||||
|
||||
ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
|
||||
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
|
||||
Hob->AllocDescriptor.MemoryLength = Length;
|
||||
@@ -786,7 +786,7 @@ BuildExtractSectionHob (
|
||||
)
|
||||
{
|
||||
EXTRACT_SECTION_DATA Data;
|
||||
|
||||
|
||||
Data.SectionGetInfo = SectionGetInfo;
|
||||
Data.SectionExtraction = SectionExtraction;
|
||||
BuildGuidDataHob (Guid, &Data, sizeof (Data));
|
||||
@@ -809,10 +809,10 @@ BuildPeCoffLoaderHob (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *Ptr;
|
||||
|
||||
VOID *Ptr;
|
||||
|
||||
Ptr = &gPeCoffProtocol;
|
||||
BuildGuidDataHob (&gPeCoffLoaderProtocolGuid, &Ptr, sizeof (VOID *));
|
||||
BuildGuidDataHob (&gPeCoffLoaderProtocolGuid, &Ptr, sizeof (VOID *));
|
||||
}
|
||||
|
||||
// May want to put this into a library so you only need the PCD setings if you are using the feature?
|
||||
|
@@ -19,7 +19,7 @@
|
||||
FILE_GUID = 1F3A3278-82EB-4C0D-86F1-5BCDA5846CB2
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = HobLib
|
||||
LIBRARY_CLASS = HobLib
|
||||
|
||||
|
||||
#
|
||||
@@ -40,7 +40,7 @@
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PrePiHobListPointerLib
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiHobMemoryAllocModuleGuid
|
||||
gEfiHobMemoryAllocStackGuid
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -52,7 +52,7 @@ PrePeiGetHobList (
|
||||
Updates the pointer to the HOB list.
|
||||
|
||||
@param HobList Hob list pointer to store
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -61,7 +61,7 @@ PrePeiSetHobList (
|
||||
)
|
||||
{
|
||||
gHobList = HobList;
|
||||
|
||||
|
||||
//
|
||||
// If this code is running from ROM this could fail
|
||||
//
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
# Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#**/
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
[LibraryClasses]
|
||||
#DebugLib
|
||||
|
||||
|
||||
[FixedPcd.common]
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/** @file
|
||||
Implementation of the 6 PEI Ffs (FV) APIs in library form.
|
||||
|
||||
|
||||
This code only knows about a FV if it has a EFI_HOB_TYPE_FV entry in the HOB list
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -25,11 +25,11 @@
|
||||
|
||||
/**
|
||||
Returns the highest bit set of the State field
|
||||
|
||||
|
||||
@param ErasePolarity Erase Polarity as defined by EFI_FVB2_ERASE_POLARITY
|
||||
in the Attributes field.
|
||||
@param FfsHeader Pointer to FFS File Header
|
||||
|
||||
|
||||
|
||||
@retval the highest bit in the State field
|
||||
|
||||
@@ -56,15 +56,15 @@ GetFileState(
|
||||
}
|
||||
|
||||
return HighestBit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Calculates the checksum of the header of a file.
|
||||
The header is a zero byte checksum, so zero means header is good
|
||||
|
||||
|
||||
@param FfsHeader Pointer to FFS File Header
|
||||
|
||||
|
||||
@retval Checksum of the header
|
||||
|
||||
**/
|
||||
@@ -77,7 +77,7 @@ CalculateHeaderChecksum (
|
||||
UINT8 *Ptr;
|
||||
UINTN Index;
|
||||
UINT8 Sum;
|
||||
|
||||
|
||||
Sum = 0;
|
||||
Ptr = (UINT8 *)FileHeader;
|
||||
|
||||
@@ -91,9 +91,9 @@ CalculateHeaderChecksum (
|
||||
for (; Index < sizeof(EFI_FFS_FILE_HEADER); Index++) {
|
||||
Sum = (UINT8)(Sum + Ptr[Index]);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// State field (since this indicates the different state of file).
|
||||
// State field (since this indicates the different state of file).
|
||||
//
|
||||
Sum = (UINT8)(Sum - FileHeader->State);
|
||||
//
|
||||
@@ -107,10 +107,10 @@ CalculateHeaderChecksum (
|
||||
|
||||
/**
|
||||
Given a FileHandle return the VolumeHandle
|
||||
|
||||
|
||||
@param FileHandle File handle to look up
|
||||
@param VolumeHandle Match for FileHandle
|
||||
|
||||
|
||||
@retval TRUE VolumeHandle is valid
|
||||
|
||||
**/
|
||||
@@ -129,7 +129,7 @@ FileHandleToVolume (
|
||||
if (Hob.Raw == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, Hob.Raw);
|
||||
if (Hob.Raw != NULL) {
|
||||
@@ -143,7 +143,7 @@ FileHandleToVolume (
|
||||
Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, GET_NEXT_HOB (Hob));
|
||||
}
|
||||
} while (Hob.Raw != NULL);
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -153,10 +153,10 @@ FileHandleToVolume (
|
||||
Given the input file pointer, search for the next matching file in the
|
||||
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
||||
the Firmware Volume defined by FwVolHeader.
|
||||
|
||||
|
||||
@param FileHandle File handle to look up
|
||||
@param VolumeHandle Match for FileHandle
|
||||
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -208,13 +208,13 @@ FindFileEx (
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize);
|
||||
}
|
||||
|
||||
|
||||
FileOffset = (UINT32) ((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
|
||||
ASSERT (FileOffset <= 0xFFFFFFFF);
|
||||
|
||||
while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
|
||||
//
|
||||
// Get FileState which is the highest bit of the State
|
||||
// Get FileState which is the highest bit of the State
|
||||
//
|
||||
FileState = GetFileState (ErasePolarity, FfsFileHeader);
|
||||
|
||||
@@ -224,7 +224,7 @@ FindFileEx (
|
||||
FileOffset += sizeof(EFI_FFS_FILE_HEADER);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + sizeof(EFI_FFS_FILE_HEADER));
|
||||
break;
|
||||
|
||||
|
||||
case EFI_FILE_DATA_VALID:
|
||||
case EFI_FILE_MARKED_FOR_UPDATE:
|
||||
if (CalculateHeaderChecksum (FfsFileHeader) != 0) {
|
||||
@@ -241,16 +241,16 @@ FindFileEx (
|
||||
*FileHeader = FfsFileHeader;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
} else if (((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) &&
|
||||
(FfsFileHeader->Type != EFI_FV_FILETYPE_FFS_PAD)) {
|
||||
} else if (((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) &&
|
||||
(FfsFileHeader->Type != EFI_FV_FILETYPE_FFS_PAD)) {
|
||||
*FileHeader = FfsFileHeader;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
FileOffset += FileOccupiedSize;
|
||||
FileOffset += FileOccupiedSize;
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
|
||||
break;
|
||||
|
||||
|
||||
case EFI_FILE_DELETED:
|
||||
FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE(FileLength, 8);
|
||||
@@ -261,24 +261,24 @@ FindFileEx (
|
||||
default:
|
||||
*FileHeader = NULL;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
*FileHeader = NULL;
|
||||
return EFI_NOT_FOUND;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Go through the file to search SectionType section,
|
||||
when meeting an encapsuled section.
|
||||
|
||||
when meeting an encapsuled section.
|
||||
|
||||
@param SectionType - Filter to find only section of this type.
|
||||
@param Section - From where to search.
|
||||
@param SectionSize - The file size to search.
|
||||
@param OutputBuffer - Pointer to the section to search.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -310,11 +310,11 @@ FfsProcessSection (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
} else if ((Section->Type == EFI_SECTION_COMPRESSION) || (Section->Type == EFI_SECTION_GUID_DEFINED)) {
|
||||
|
||||
|
||||
if (Section->Type == EFI_SECTION_COMPRESSION) {
|
||||
CompressionSection = (EFI_COMPRESSION_SECTION *) Section;
|
||||
SectionLength = *(UINT32 *)Section->Size & 0x00FFFFFF;
|
||||
|
||||
|
||||
if (CompressionSection->CompressionType != EFI_STANDARD_COMPRESSION) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
@@ -333,7 +333,7 @@ FfsProcessSection (
|
||||
&SectionAttribute
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// GetInfo failed
|
||||
@@ -349,7 +349,7 @@ FfsProcessSection (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
//
|
||||
// Allocate destination buffer, extra one page for adjustment
|
||||
// Allocate destination buffer, extra one page for adjustment
|
||||
//
|
||||
DstBuffer = (VOID *)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize) + 1);
|
||||
if (DstBuffer == NULL) {
|
||||
@@ -377,7 +377,7 @@ FfsProcessSection (
|
||||
&AuthenticationStatus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Decompress failed
|
||||
@@ -386,16 +386,16 @@ FfsProcessSection (
|
||||
return EFI_NOT_FOUND;
|
||||
} else {
|
||||
return FfsProcessSection (
|
||||
SectionType,
|
||||
DstBuffer,
|
||||
DstBufferSize,
|
||||
OutputBuffer
|
||||
SectionType,
|
||||
DstBuffer,
|
||||
DstBufferSize,
|
||||
OutputBuffer
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// SectionLength is adjusted it is 4 byte aligned.
|
||||
// Go to the next section
|
||||
//
|
||||
@@ -405,7 +405,7 @@ FfsProcessSection (
|
||||
ParsedLength += SectionLength;
|
||||
Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);
|
||||
}
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ FfsFindSectionData (
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)(FileHandle);
|
||||
|
||||
//
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// Does not include FfsFileHeader header size
|
||||
// FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.
|
||||
//
|
||||
@@ -447,9 +447,9 @@ FfsFindSectionData (
|
||||
FileSize -= sizeof (EFI_FFS_FILE_HEADER);
|
||||
|
||||
return FfsProcessSection (
|
||||
SectionType,
|
||||
Section,
|
||||
FileSize,
|
||||
SectionType,
|
||||
Section,
|
||||
FileSize,
|
||||
SectionData
|
||||
);
|
||||
}
|
||||
@@ -503,13 +503,13 @@ FfsFindNextVolume (
|
||||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
|
||||
|
||||
|
||||
Hob.Raw = GetHobList ();
|
||||
if (Hob.Raw == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, Hob.Raw);
|
||||
if (Hob.Raw != NULL) {
|
||||
@@ -521,7 +521,7 @@ FfsFindNextVolume (
|
||||
Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, GET_NEXT_HOB (Hob));
|
||||
}
|
||||
} while (Hob.Raw != NULL);
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
}
|
||||
@@ -529,7 +529,7 @@ FfsFindNextVolume (
|
||||
|
||||
/**
|
||||
Find a file in the volume by name
|
||||
|
||||
|
||||
@param FileName A pointer to the name of the file to
|
||||
find within the firmware volume.
|
||||
|
||||
@@ -546,7 +546,7 @@ FfsFindNextVolume (
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EFIAPI
|
||||
FfsFindFileByName (
|
||||
IN CONST EFI_GUID *FileName,
|
||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||
@@ -576,15 +576,15 @@ FfsFindFileByName (
|
||||
information.
|
||||
|
||||
@retval EFI_SUCCESS File information returned.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileHandle does not
|
||||
represent a valid file.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EFIAPI
|
||||
FfsGetFileInfo (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
OUT EFI_FV_FILE_INFO *FileInfo
|
||||
@@ -614,14 +614,14 @@ FfsGetFileInfo (
|
||||
}
|
||||
|
||||
//
|
||||
// Get FileState which is the highest bit of the State
|
||||
// Get FileState which is the highest bit of the State
|
||||
//
|
||||
FileState = GetFileState (ErasePolarity, (EFI_FFS_FILE_HEADER*)FileHandle);
|
||||
|
||||
switch (FileState) {
|
||||
case EFI_FILE_DATA_VALID:
|
||||
case EFI_FILE_MARKED_FOR_UPDATE:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -645,15 +645,15 @@ FfsGetFileInfo (
|
||||
information.
|
||||
|
||||
@retval EFI_SUCCESS File information returned.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileHandle does not
|
||||
represent a valid file.
|
||||
|
||||
|
||||
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EFIAPI
|
||||
FfsGetVolumeInfo (
|
||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||
OUT EFI_FV_INFO *VolumeInfo
|
||||
@@ -665,10 +665,10 @@ FfsGetVolumeInfo (
|
||||
if (VolumeInfo == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// VolumeHandle may not align at 8 byte,
|
||||
// but FvLength is UINT64 type, which requires FvHeader align at least 8 byte.
|
||||
// VolumeHandle may not align at 8 byte,
|
||||
// but FvLength is UINT64 type, which requires FvHeader align at least 8 byte.
|
||||
// So, Copy FvHeader into the local FvHeader structure.
|
||||
//
|
||||
CopyMem (&FwVolHeader, VolumeHandle, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
|
||||
@@ -698,7 +698,7 @@ FfsGetVolumeInfo (
|
||||
@param FileType File handle of a Fv type file.
|
||||
@param Volumehandle On succes Volume Handle of the match
|
||||
@param FileHandle On success File Handle of the match
|
||||
|
||||
|
||||
@retval EFI_NOT_FOUND FV image can't be found.
|
||||
@retval EFI_SUCCESS Successfully found FileType
|
||||
|
||||
@@ -734,7 +734,7 @@ FfsAnyFvFindFirstFile (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -788,14 +788,14 @@ FfsProcessFvFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Collect FvImage Info.
|
||||
//
|
||||
ZeroMem (&FvImageInfo, sizeof (FvImageInfo));
|
||||
Status = FfsGetVolumeInfo (FvImageHandle, &FvImageInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
//
|
||||
// FvAlignment must be more than 8 bytes required by FvHeader structure.
|
||||
//
|
||||
@@ -803,7 +803,7 @@ FfsProcessFvFile (
|
||||
if (FvAlignment < 8) {
|
||||
FvAlignment = 8;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check FvImage
|
||||
//
|
||||
@@ -824,7 +824,7 @@ FfsProcessFvFile (
|
||||
// Inform HOB consumer phase, i.e. DXE core, the existance of this FV
|
||||
//
|
||||
BuildFvHob ((EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart, FvImageInfo.FvSize);
|
||||
|
||||
|
||||
//
|
||||
// Makes the encapsulated volume show up in DXE phase to skip processing of
|
||||
// encapsulated file again.
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#define END_OF_HOB_LIST(Hob) (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_END_OF_HOB_LIST)
|
||||
|
||||
//
|
||||
// Get the data and data size field of GUID
|
||||
// Get the data and data size field of GUID
|
||||
//
|
||||
#define GET_GUID_HOB_DATA(GuidHob) ((VOID *) (((UINT8 *) &((GuidHob)->Name)) + sizeof (EFI_GUID)))
|
||||
#define GET_GUID_HOB_DATA_SIZE(GuidHob) (((GuidHob)->Header).HobLength - sizeof (EFI_HOB_GUID_TYPE))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -43,13 +43,13 @@ LoadPeCoffImage (
|
||||
VOID *Buffer;
|
||||
|
||||
ZeroMem (&ImageContext, sizeof (ImageContext));
|
||||
|
||||
|
||||
ImageContext.Handle = PeCoffImage;
|
||||
ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
||||
|
||||
Status = PeCoffLoaderGetImageInfo (&ImageContext);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Allocate Memory for the image
|
||||
@@ -88,7 +88,7 @@ LoadPeCoffImage (
|
||||
|
||||
|
||||
|
||||
typedef
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *DXE_CORE_ENTRY_POINT) (
|
||||
IN VOID *HobStart
|
||||
@@ -116,7 +116,7 @@ LoadDxeCoreFromFfsFile (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Status = LoadPeCoffImage (PeCoffImage, &ImageAddress, &ImageSize, &EntryPoint);
|
||||
// For NT32 Debug Status = SecWinNtPeiLoadFile (PeCoffImage, &ImageAddress, &ImageSize, &EntryPoint);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -128,22 +128,22 @@ LoadDxeCoreFromFfsFile (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
BuildModuleHob (&FvFileInfo.FileName, (EFI_PHYSICAL_ADDRESS)(UINTN)ImageAddress, EFI_SIZE_TO_PAGES ((UINT32) ImageSize) * EFI_PAGE_SIZE, EntryPoint);
|
||||
|
||||
|
||||
DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DxeCore at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)EntryPoint));
|
||||
|
||||
Hob = GetHobList ();
|
||||
if (StackSize == 0) {
|
||||
// User the current stack
|
||||
|
||||
|
||||
((DXE_CORE_ENTRY_POINT)(UINTN)EntryPoint) (Hob);
|
||||
} else {
|
||||
|
||||
|
||||
//
|
||||
// Allocate 128KB for the Stack
|
||||
//
|
||||
BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (StackSize));
|
||||
ASSERT (BaseOfStack != NULL);
|
||||
|
||||
|
||||
//
|
||||
// Compute the top of the stack we were allocated. Pre-allocate a UINTN
|
||||
// for safety.
|
||||
@@ -153,7 +153,7 @@ LoadDxeCoreFromFfsFile (
|
||||
|
||||
//
|
||||
// Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.
|
||||
//
|
||||
//
|
||||
UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, StackSize);
|
||||
|
||||
SwitchStack (
|
||||
@@ -164,11 +164,11 @@ LoadDxeCoreFromFfsFile (
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Should never get here as DXE Core does not return
|
||||
DEBUG ((EFI_D_ERROR, "DxeCore returned\n"));
|
||||
ASSERT (FALSE);
|
||||
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@@ -199,9 +199,9 @@ LoadDxeCoreFromFv (
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return LoadDxeCoreFromFfsFile (FileHandle, StackSize);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ DecompressFirstFv (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = FfsProcessFvFile (FileHandle);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#/** @file
|
||||
# Component description file for Apple Pre PI Library
|
||||
#
|
||||
# LIbrary helps you build a platform that skips PEI and loads DXE Core
|
||||
# LIbrary helps you build a platform that skips PEI and loads DXE Core
|
||||
# directly. Helps building HOBs, reading data from the FV, and doing
|
||||
# decompression.
|
||||
# decompression.
|
||||
#
|
||||
# Copyright (c) 2008, Apple Inc. All rights reserved.<BR>
|
||||
#
|
||||
@@ -23,7 +23,7 @@
|
||||
FILE_GUID = 1F3A3278-82EB-4C0D-86F1-5BCDA5846CB2
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PrePiLib
|
||||
LIBRARY_CLASS = PrePiLib
|
||||
|
||||
|
||||
#
|
||||
@@ -65,7 +65,7 @@
|
||||
[Protocols]
|
||||
gEfiStatusCodeRuntimeProtocolGuid
|
||||
gPeCoffLoaderProtocolGuid
|
||||
|
||||
|
||||
|
||||
[FixedPcd.common]
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Library that helps implement monolithic PEI
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -34,8 +34,8 @@ SerialReportStatusCode (
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS_CODE_PROTOCOL gStatusCode = {
|
||||
(EFI_REPORT_STATUS_CODE)SerialReportStatusCode
|
||||
EFI_STATUS_CODE_PROTOCOL gStatusCode = {
|
||||
(EFI_REPORT_STATUS_CODE)SerialReportStatusCode
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ SerialReportStatusCode (
|
||||
|
||||
} else if (Data != NULL &&
|
||||
ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
|
||||
|
||||
|
||||
//
|
||||
// Print DEBUG() information into output buffer.
|
||||
//
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Implementation of the 6 PEI Ffs (FV) APIs in library form.
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -180,7 +180,7 @@ AllocatePool (
|
||||
|
||||
Hob = GetHobList ();
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Verify that there is sufficient memory to satisfy the allocation
|
||||
//
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/** @file
|
||||
Implement EFI RealTimeClock runtime services via RTC Lib.
|
||||
|
||||
|
||||
Currently this driver does not support runtime virtual calling.
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -164,7 +164,7 @@ LibRtcVirtualNotifyEvent (
|
||||
{
|
||||
//
|
||||
// Only needed if you are going to support the OS calling RTC functions in virtual mode.
|
||||
// You will need to call EfiConvertPointer (). To convert any stored physical addresses
|
||||
// You will need to call EfiConvertPointer (). To convert any stored physical addresses
|
||||
// to virtual address. After the OS transistions to calling in virtual mode, all future
|
||||
// runtime calls will be made in virtual mode.
|
||||
//
|
||||
|
@@ -34,4 +34,3 @@
|
||||
[LibraryClasses]
|
||||
IoLib
|
||||
DebugLib
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Template library implementation to support ResetSystem Runtime call.
|
||||
|
||||
|
||||
Fill in the templates with what ever makes you system reset.
|
||||
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -46,30 +46,30 @@ LibResetSystem (
|
||||
{
|
||||
UINTN Address;
|
||||
UINT8 Data;
|
||||
|
||||
|
||||
|
||||
|
||||
switch (ResetType) {
|
||||
case EfiResetCold:
|
||||
// system power cycle
|
||||
|
||||
|
||||
// Example using IoLib functions to do IO.
|
||||
Address = 0x12345678;
|
||||
Data = MmioRead8 (Address);
|
||||
MmioWrite8 (Address, Data | 0x01);
|
||||
|
||||
|
||||
// Note this is a bad example asa MmioOr8 (Address, 0x01) does the same thing
|
||||
break;
|
||||
|
||||
|
||||
case EfiResetWarm:
|
||||
// not a full power cycle, maybe memory stays around.
|
||||
// not a full power cycle, maybe memory stays around.
|
||||
// if not support do the same thing as EfiResetCold.
|
||||
break;
|
||||
|
||||
|
||||
case EfiResetShutdown:
|
||||
// turn off the system.
|
||||
// if not support do the same thing as EfiResetCold.
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ LibResetSystem (
|
||||
//
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ LibResetSystem (
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Extended Serial I/O Port library functions
|
||||
|
||||
Copyright (c) 2012, ARM Ltd. All rights reserved.
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2012, ARM Ltd. All rights reserved.
|
||||
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -82,7 +82,7 @@ SerialPortRead (
|
||||
Poll the serial device to see if there is any data waiting.
|
||||
|
||||
If there is data waiting to be read from the serial port, then return
|
||||
TRUE. If there is no data waiting to be read from the serial port, then
|
||||
TRUE. If there is no data waiting to be read from the serial port, then
|
||||
return FALSE.
|
||||
|
||||
@retval TRUE Data is waiting to be read.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#/** @file
|
||||
#
|
||||
#
|
||||
# Component description file for Bds module
|
||||
#
|
||||
# Copyright (c) 2008, Apple Inc. All rights reserved.
|
||||
@@ -9,10 +9,10 @@
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
@@ -42,9 +42,9 @@
|
||||
|
||||
[FixedPcd]
|
||||
gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiMetronomeArchProtocolGuid
|
||||
gEfiMetronomeArchProtocolGuid
|
||||
|
||||
[depex]
|
||||
TRUE
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user