22#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
23 (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
27DebugAgentVectorTable (
45 IN UINT8 ErasePolarity,
49 EFI_FFS_FILE_STATE FileState;
50 EFI_FFS_FILE_STATE HighestBit;
52 FileState = FfsHeader->State;
54 if (ErasePolarity != 0) {
55 FileState = (EFI_FFS_FILE_STATE) ~FileState;
59 while (HighestBit != 0 && (HighestBit & FileState) == 0) {
87 Sum = (UINT8)(Sum - FileHeader->State);
90 Sum = (UINT8)(Sum - FileHeader->IntegrityCheck.Checksum.File);
98 IN EFI_FV_FILETYPE FileType,
108 UINT32 FileOccupiedSize;
110 ASSERT (FwVolHeader->Signature == EFI_FVH_SIGNATURE);
112 FvLength = FwVolHeader->FvLength;
114 FileOffset = FwVolHeader->HeaderLength;
116 if (FwVolHeader->Attributes & EFI_FVB2_ERASE_POLARITY) {
124 FileState =
GetFileState (ErasePolarity, FfsFileHeader);
127 case EFI_FILE_HEADER_INVALID:
132 case EFI_FILE_DATA_VALID:
133 case EFI_FILE_MARKED_FOR_UPDATE:
136 return EFI_NOT_FOUND;
139 if (FfsFileHeader->
Type == FileType) {
140 *FileHeader = FfsFileHeader;
144 FileLength = *(UINT32 *)(FfsFileHeader->
Size) & 0x00FFFFFF;
145 FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
147 FileOffset += FileOccupiedSize;
151 case EFI_FILE_DELETED:
152 FileLength = *(UINT32 *)(FfsFileHeader->
Size) & 0x00FFFFFF;
153 FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
154 FileOffset += FileOccupiedSize;
159 return EFI_NOT_FOUND;
163 return EFI_NOT_FOUND;
180 VOID *CodeViewEntryPointer;
183 SectionSize = *(UINT32 *)(FfsHeader->Size) & 0x00FFFFFF;
188 while (ParsedLength < SectionSize) {
189 if ((Section->Type ==
EFI_SECTION_PE32) || (Section->Type == EFI_SECTION_TE)) {
199 SectionLength = *(UINT32 *)Section->
Size & 0x00FFFFFF;
200 SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
201 ASSERT (SectionLength != 0);
202 ParsedLength += SectionLength;
206 if (EfiImage ==
NULL) {
207 return EFI_NOT_FOUND;
212 ImageContext->Handle = EfiImage;
216 if (!EFI_ERROR (Status) && ((VOID *)(
UINTN)ImageContext->DebugDirectoryEntryRva !=
NULL)) {
217 ImageAddress = ImageContext->ImageAddress;
218 if (ImageContext->IsTeImage) {
224 CodeViewEntryPointer = (VOID *)(ImageAddress + (
UINTN)DebugEntry->
RVA);
225 switch (*(UINT32 *)CodeViewEntryPointer) {
270 IN VOID *Context OPTIONAL,
281 if (InitFlag == DEBUG_AGENT_INIT_PREMEM_SEC) {
286 if (!EFI_ERROR (Status)) {
287 Status = GetImageContext (FfsHeader, &ImageContext);
288 if (!EFI_ERROR (Status)) {
292 }
else if (InitFlag == DEBUG_AGENT_INIT_POSTMEM_SEC) {
297 if (!EFI_ERROR (Status)) {
298 Status = GetImageContext (FfsHeader, &ImageContext);
299 if (!EFI_ERROR (Status)) {
308 if (!EFI_ERROR (Status)) {
309 Status = GetImageContext (FfsHeader, &ImageContext);
310 if (!EFI_ERROR (Status)) {
332 IN BOOLEAN EnableStatus
UINT8 EFIAPI CalculateSum8(IN CONST UINT8 *Buffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID(EFIAPI * DEBUG_AGENT_CONTINUE)(IN VOID *Context)
STATIC EFI_FFS_FILE_STATE GetFileState(IN UINT8 ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
BOOLEAN EFIAPI SaveAndSetDebugTimerInterrupt(IN BOOLEAN EnableStatus)
VOID EFIAPI InitializeDebugAgent(IN UINT32 InitFlag, IN VOID *Context OPTIONAL, IN DEBUG_AGENT_CONTINUE Function OPTIONAL)
STATIC UINT8 CalculateHeaderChecksum(IN EFI_FFS_FILE_HEADER *FileHeader)
#define PcdGet64(TokenName)
RETURN_STATUS EFIAPI PeCoffLoaderGetImageInfo(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderImageReadFromMemory(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
#define CODEVIEW_SIGNATURE_NB10
#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW
The Visual C++ debug information.
#define CODEVIEW_SIGNATURE_RSDS
#define CODEVIEW_SIGNATURE_MTOC
UINT32 RVA
The address of the debug data when loaded, relative to the image base.