mirror of https://github.com/acidanthera/audk.git
I fixed following bugs.
1. In dependency.c, DXE Dispatcher doesn't check the dependency expression boundary correctly. 2. In page.c, a misspelling code in DXE core memory service code, duplicate code. 3. In gcd.c, according to DXE CIS 0-91 spec, When GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp or EfiGcdAllocateMaxAddressSearchTopDown, then the GCD memory space map is searched from the lowest address up to BaseAddress (or from BaseAddress down to the lowest address) looking for unallocated memory ranges of Length bytes. Here, BaseAddress itself is inclusive, that is, any range in [0, BaseAddress] is allowable. But current code BaseAddress to be exclusive. 4. In Ebcinit.c, EbcDebugRegisterPeriodicCallback() not check whether it is already registered. 5. In Ebcinit.c, EbcDebugRegisterExceptionCallback() not check whether it is already registered. 6. In Ebcinit.c, EbcDebugSignalException() does not assign value to EbcContext.ControlFlags. 7. In Ebcinit.c, EBC: StatusCodeValue should use EFI_SOFTWARE_EBC_EXCEPTION. 8. In Ebcinit.c, EbcDebugRegisterExceptionCallback() does not check ExceptionType 9. In ElTorito.c, BlockIo and DiskIo failed in SCT when there is CD in CD-ROM. 10. In Mbr.c, MBR code can't handle some situations. That is when there are 3 partitions in HD, if delete the first partition, it will not be able to recognize the other two partitions, and if delete the second partition, it will not be able to recognize the third partition. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1749 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
fc773f6aa7
commit
3114b33496
|
@ -303,7 +303,7 @@ Returns:
|
|||
// Check to see if we are attempting to fetch dependency expression instructions
|
||||
// past the end of the dependency expression.
|
||||
//
|
||||
if (((UINTN)Iterator - (UINTN)DriverEntry->Depex) > DriverEntry->DepexSize) {
|
||||
if (((UINTN)Iterator - (UINTN)DriverEntry->Depex) >= DriverEntry->DepexSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1094,7 +1094,7 @@ Returns:
|
|||
//
|
||||
if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
|
||||
GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
|
||||
MaxAddress = *BaseAddress - 1;
|
||||
MaxAddress = *BaseAddress;
|
||||
} else {
|
||||
MaxAddress = Entry->EndAddress;
|
||||
}
|
||||
|
@ -1103,7 +1103,7 @@ Returns:
|
|||
// Verify that the list of descriptors are unallocated memory matching GcdMemoryType.
|
||||
//
|
||||
if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
|
||||
GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
|
||||
GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
|
||||
Link = Map->BackLink;
|
||||
} else {
|
||||
Link = Map->ForwardLink;
|
||||
|
|
|
@ -1392,7 +1392,7 @@ Returns:
|
|||
|
||||
MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress;
|
||||
MemoryMap->VirtualStart = 0;
|
||||
MemoryMap->NumberOfPages = MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT);
|
||||
MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT);
|
||||
MemoryMap->Attribute = GcdMapEntry->Attributes & ~EFI_MEMORY_PORT_IO;
|
||||
|
||||
if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) {
|
||||
|
|
|
@ -133,7 +133,7 @@ Returns:
|
|||
// the 32-bit numerical values is stored in Both-byte orders
|
||||
//
|
||||
if (VolDescriptor->Type == CDVOL_TYPE_CODED) {
|
||||
VolSpaceSize = VolDescriptor->VolSpaceSize[1];
|
||||
VolSpaceSize = VolDescriptor->VolSpaceSize[0];
|
||||
}
|
||||
//
|
||||
// Is it an El Torito volume descriptor?
|
||||
|
@ -242,7 +242,14 @@ Returns:
|
|||
BootEntry++;
|
||||
CdDev.PartitionStart = Catalog->Boot.Lba;
|
||||
if (SectorCount < 2) {
|
||||
CdDev.PartitionSize = VolSpaceSize;
|
||||
//
|
||||
// When the SectorCount < 2, set the Partition as the whole CD.
|
||||
//
|
||||
if (VolSpaceSize > (Media->LastBlock + 1)) {
|
||||
CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1);
|
||||
} else {
|
||||
CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);
|
||||
}
|
||||
} else {
|
||||
CdDev.PartitionSize = DivU64x32 (
|
||||
MultU64x32 (
|
||||
|
|
|
@ -154,7 +154,7 @@ Returns:
|
|||
// Verify that the Protective MBR is valid
|
||||
//
|
||||
if (ProtectiveMbr->Partition[0].BootIndicator != 0x00 ||
|
||||
ProtectiveMbr->Partition[0].OSIndicator != 0xEE ||
|
||||
ProtectiveMbr->Partition[0].OSIndicator != PMBR_GPT_PARTITION ||
|
||||
UNPACK_UINT32 (ProtectiveMbr->Partition[0].StartingLBA) != 1
|
||||
) {
|
||||
goto Done;
|
||||
|
|
|
@ -209,7 +209,7 @@ Returns:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Mbr->Partition[Index].OSIndicator == 0xEE) {
|
||||
if (Mbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION) {
|
||||
//
|
||||
// This is the guard MBR for the GPT. If you ever see a GPT disk with zero partitions you can get here.
|
||||
// We can not produce an MBR BlockIo for this device as the MBR spans the GPT headers. So formating
|
||||
|
@ -265,6 +265,11 @@ Returns:
|
|||
break;
|
||||
}
|
||||
|
||||
if ((Mbr->Partition[0].OSIndicator == EXTENDED_DOS_PARTITION) ||
|
||||
(Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION)) {
|
||||
ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
|
||||
continue;
|
||||
}
|
||||
HdDev.PartitionNumber = PartitionNumber ++;
|
||||
HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart;
|
||||
HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA);
|
||||
|
@ -294,8 +299,8 @@ Returns:
|
|||
Found = TRUE;
|
||||
}
|
||||
|
||||
if (Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION &&
|
||||
Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION
|
||||
if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) &&
|
||||
(Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ Revision History
|
|||
#define EXTENDED_WINDOWS_PARTITION 0x0F
|
||||
#define MAX_MBR_PARTITIONS 4
|
||||
|
||||
#define EFI_PARTITION 0xef
|
||||
#define PMBR_GPT_PARTITION 0xEE
|
||||
#define EFI_PARTITION 0xEF
|
||||
#define MBR_SIZE 512
|
||||
|
||||
//
|
||||
|
|
|
@ -154,8 +154,8 @@ static EBC_ICACHE_FLUSH mEbcICacheFlush;
|
|||
//
|
||||
// These get set via calls by the debug agent
|
||||
//
|
||||
static EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
|
||||
static EFI_EXCEPTION_CALLBACK mDebugExceptionCallback = NULL;
|
||||
static EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
|
||||
static EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};
|
||||
static EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -405,6 +405,13 @@ Returns:
|
|||
|
||||
--*/
|
||||
{
|
||||
if ((mDebugPeriodicCallback == NULL) && (PeriodicCallback == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if ((mDebugPeriodicCallback != NULL) && (PeriodicCallback != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
mDebugPeriodicCallback = PeriodicCallback;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -437,7 +444,16 @@ Returns:
|
|||
|
||||
--*/
|
||||
{
|
||||
mDebugExceptionCallback = ExceptionCallback;
|
||||
if ((ExceptionType < 0) || (ExceptionType > MAX_EBC_EXCEPTION)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if ((mDebugExceptionCallback[ExceptionType] == NULL) && (ExceptionCallback == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if ((mDebugExceptionCallback[ExceptionType] != NULL) && (ExceptionCallback != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
mDebugExceptionCallback[ExceptionType] = ExceptionCallback;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -519,13 +535,15 @@ Returns:
|
|||
EbcContext.R7 = VmPtr->R[7];
|
||||
EbcContext.Ip = (UINT64) (UINTN) VmPtr->Ip;
|
||||
EbcContext.Flags = VmPtr->Flags;
|
||||
EbcContext.ControlFlags = 0;
|
||||
SystemContext.SystemContextEbc = &EbcContext;
|
||||
//
|
||||
// If someone's registered for exception callbacks, then call them.
|
||||
// Otherwise report the status code via the status code API
|
||||
//
|
||||
if (mDebugExceptionCallback != NULL) {
|
||||
mDebugExceptionCallback (ExceptionType, SystemContext);
|
||||
if ((ExceptionType >= 0) && (ExceptionType <= MAX_EBC_EXCEPTION) &&
|
||||
(mDebugExceptionCallback[ExceptionType] != NULL)) {
|
||||
mDebugExceptionCallback[ExceptionType] (ExceptionType, SystemContext);
|
||||
}
|
||||
//
|
||||
// Determine if we should report the exception. We report all of them by default,
|
||||
|
@ -536,50 +554,50 @@ Returns:
|
|||
Report = TRUE;
|
||||
switch (ExceptionType) {
|
||||
case EXCEPT_EBC_UNDEFINED:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_UNDEFINED;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_UNDEFINED;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_DIVIDE_ERROR:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_DIVIDE_ERROR;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_DIVIDE_ERROR;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_DEBUG:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_DEBUG;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback == NULL) ? TRUE : FALSE);
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_DEBUG;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback[ExceptionType] == NULL) ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_BREAKPOINT:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_BREAKPOINT;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback == NULL) ? TRUE : FALSE);
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_BREAKPOINT;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback[ExceptionType] == NULL) ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_INVALID_OPCODE:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_INVALID_OPCODE;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_INVALID_OPCODE;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_STACK_FAULT:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_STACK_FAULT;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_STACK_FAULT;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_ALIGNMENT_CHECK:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_ALIGNMENT_CHECK;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_ALIGNMENT_CHECK;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_INSTRUCTION_ENCODING:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_INSTRUCTION_ENCODING;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_INSTRUCTION_ENCODING;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_BAD_BREAK:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_BAD_BREAK;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_BAD_BREAK;
|
||||
break;
|
||||
|
||||
case EXCEPT_EBC_STEP:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_EBC_STEP;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback == NULL) ? TRUE : FALSE);
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_EBC_STEP;
|
||||
Report = (BOOLEAN) ((mDebugExceptionCallback[ExceptionType] == NULL) ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
StatusCodeValue = EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_NON_SPECIFIC;
|
||||
StatusCodeValue = EFI_SOFTWARE_EBC_EXCEPTION | EFI_SW_EC_NON_SPECIFIC;
|
||||
break;
|
||||
}
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue