summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ia32/Ia32Math.asm4
-rw-r--r--MdePkg/Library/BasePciCf8Lib/PciLib.c18
-rw-r--r--MdePkg/Library/BasePciExpressLib/PciLib.c18
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLib.c10
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c22
-rw-r--r--MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c22
6 files changed, 61 insertions, 33 deletions
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/Ia32Math.asm b/EdkModulePkg/Universal/Ebc/Dxe/Ia32/Ia32Math.asm
index 4c91a2730b..1d0bd2f2e6 100644
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/Ia32Math.asm
+++ b/EdkModulePkg/Universal/Ebc/Dxe/Ia32/Ia32Math.asm
@@ -134,8 +134,8 @@ _RightShiftU64_Calc:
mov eax, dword ptr Operand[0]
mov edx, dword ptr Operand[4]
- shrd edx, eax, cl
- shr eax, cl
+ shrd eax, edx, cl
+ shr edx, cl
cmp ecx, 32
jc short _RightShiftU64_Done
diff --git a/MdePkg/Library/BasePciCf8Lib/PciLib.c b/MdePkg/Library/BasePciCf8Lib/PciLib.c
index a3897bfaa4..9421d8b99d 100644
--- a/MdePkg/Library/BasePciCf8Lib/PciLib.c
+++ b/MdePkg/Library/BasePciCf8Lib/PciLib.c
@@ -1299,11 +1299,16 @@ PciCf8ReadBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
- ASSERT ((Buffer != NULL) || (Size == 0));
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size;
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
+ if ((StartAddress & 1) != 0) {
//
// Read a byte if StartAddress is byte aligned
//
@@ -1386,11 +1391,16 @@ PciCf8WriteBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
- ASSERT ((Buffer != NULL) || (Size == 0));
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != 0);
EndAddress = StartAddress + Size;
- if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
+ if ((StartAddress & 1)!= 0) {
//
// Write a byte if StartAddress is byte aligned
//
diff --git a/MdePkg/Library/BasePciExpressLib/PciLib.c b/MdePkg/Library/BasePciExpressLib/PciLib.c
index 036994aa7b..acd3103483 100644
--- a/MdePkg/Library/BasePciExpressLib/PciLib.c
+++ b/MdePkg/Library/BasePciExpressLib/PciLib.c
@@ -1196,11 +1196,16 @@ PciExpressReadBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
- ASSERT ((Buffer != NULL) || (Size == 0));
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size;
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
+ if ((StartAddress & 1) != 0) {
//
// Read a byte if StartAddress is byte aligned
//
@@ -1282,11 +1287,16 @@ PciExpressWriteBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
- ASSERT ((Buffer != NULL) || (Size == 0));
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size;
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
+ if ((StartAddress & 1) != 0) {
//
// Write a byte if StartAddress is byte aligned
//
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePrintLib/PrintLib.c
index d33f49d388..33da6cb6b0 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -236,7 +236,7 @@ BasePrintLibVSPrint (
Format -= BytesPerFormatCharacter;
Precision = 0;
//
- // break skiped on purpose.
+ // break skipped on purpose.
//
default:
Done = TRUE;
@@ -256,18 +256,22 @@ BasePrintLibVSPrint (
//
switch (FormatCharacter) {
case 'p':
+ //
+ // Flag space, +, 0, L & l are invalid for type p.
+ //
+ Flags &= ~(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);
if (sizeof (VOID *) > 4) {
Flags |= LONG_TYPE;
}
case 'X':
Flags |= PREFIX_ZERO;
//
- // break skiped on purpose
+ // break skipped on purpose
//
case 'x':
Flags |= RADIX_HEX;
//
- // break skiped on purpose
+ // break skipped on purpose
//
case 'd':
if ((Flags & LONG_TYPE) == 0) {
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
index 31a0462f07..e05736bbb7 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
@@ -496,24 +496,26 @@ FileDevicePath (
UINTN Size;
FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL;
Size = StrSize (FileName);
- FileDevicePathNode = CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- (UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)
- );
- if (FileDevicePathNode != NULL) {
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);
+ if (FileDevicePath != NULL) {
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;
CopyMem (&FilePath->PathName, FileName, Size);
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
+
if (Device != NULL) {
DevicePath = DevicePathFromHandle (Device);
}
- DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
- FreePool (FileDevicePathNode);
+
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
+ FreePool (FileDevicePath);
}
return DevicePath;
diff --git a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
index ec4325cf39..ec9b4aa321 100644
--- a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
+++ b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
@@ -321,24 +321,26 @@ FileDevicePath (
UINTN Size;
FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL;
Size = StrSize (FileName);
- FileDevicePathNode = CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- (UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)
- );
- if (FileDevicePathNode != NULL) {
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);
+ if (FileDevicePath != NULL) {
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;
CopyMem (&FilePath->PathName, FileName, Size);
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
+
if (Device != NULL) {
DevicePath = DevicePathFromHandle (Device);
}
- DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
- FreePool (FileDevicePathNode);
+
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
+ FreePool (FileDevicePath);
}
return DevicePath;