summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EdkModulePkg/Core/Dxe/Dispatcher/dependency.c2
-rw-r--r--EdkModulePkg/Core/Dxe/Gcd/gcd.c4
-rw-r--r--EdkModulePkg/Core/Dxe/Mem/Page.c2
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c11
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c2
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c11
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h3
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c56
8 files changed, 61 insertions, 30 deletions
diff --git a/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c b/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c
index e6dc3282e6..c6ab876040 100644
--- a/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c
+++ b/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c
@@ -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;
}
diff --git a/EdkModulePkg/Core/Dxe/Gcd/gcd.c b/EdkModulePkg/Core/Dxe/Gcd/gcd.c
index 73037edb24..208c05a015 100644
--- a/EdkModulePkg/Core/Dxe/Gcd/gcd.c
+++ b/EdkModulePkg/Core/Dxe/Gcd/gcd.c
@@ -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;
diff --git a/EdkModulePkg/Core/Dxe/Mem/Page.c b/EdkModulePkg/Core/Dxe/Mem/Page.c
index e65b0283c6..d14468945f 100644
--- a/EdkModulePkg/Core/Dxe/Mem/Page.c
+++ b/EdkModulePkg/Core/Dxe/Mem/Page.c
@@ -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) {
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
index 27beba171b..88d0c7223d 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
@@ -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 (
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
index 9077ac63c2..6404c753ae 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
@@ -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;
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
index 07e3cbe459..0930292a9c 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
@@ -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;
}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
index c0022c88ad..ac692dbdd9 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
@@ -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
//
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c b/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c
index 7b15a1a84b..2a5d48a431 100644
--- a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c
+++ b/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c
@@ -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;
}
//