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
@@ -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.
|
||||
|
Reference in New Issue
Block a user