For PciRead/WriteBuffer(): A fix to handle boundary cases when Size is 0;
DevicePathLib:
For FileDevicePath(): Change to use AppendDevicePath () in place of AppendDevicePathNode().
PrintLib:
For type %p, according to current MWG, it should ignore flag 0, +, space, l, & L
Misc:
Fix a bug in EBC interpreter for Ia32.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@796
6f19259b-4bc3-4df7-8a09-
765794883524
mov eax, dword ptr Operand[0]\r
mov edx, dword ptr Operand[4]\r
\r
- shrd edx, eax, cl\r
- shr eax, cl\r
+ shrd eax, edx, cl\r
+ shr edx, cl\r
cmp ecx, 32\r
jc short _RightShiftU64_Done\r
\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
- ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+ if (Size == 0) {\r
+ return 0;\r
+ }\r
+\r
+ ASSERT (Buffer != NULL);\r
\r
EndAddress = StartAddress + Size;\r
\r
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {\r
+ if ((StartAddress & 1) != 0) {\r
//\r
// Read a byte if StartAddress is byte aligned\r
//\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
- ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+ if (Size == 0) {\r
+ return 0;\r
+ }\r
+\r
+ ASSERT (Buffer != 0);\r
\r
EndAddress = StartAddress + Size;\r
\r
- if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {\r
+ if ((StartAddress & 1)!= 0) {\r
//\r
// Write a byte if StartAddress is byte aligned\r
//\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
- ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+ if (Size == 0) {\r
+ return 0;\r
+ }\r
+\r
+ ASSERT (Buffer != NULL);\r
\r
EndAddress = StartAddress + Size;\r
\r
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {\r
+ if ((StartAddress & 1) != 0) {\r
//\r
// Read a byte if StartAddress is byte aligned\r
//\r
\r
ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
- ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+ if (Size == 0) {\r
+ return 0;\r
+ }\r
+\r
+ ASSERT (Buffer != NULL);\r
\r
EndAddress = StartAddress + Size;\r
\r
- if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {\r
+ if ((StartAddress & 1) != 0) {\r
//\r
// Write a byte if StartAddress is byte aligned\r
//\r
Format -= BytesPerFormatCharacter;\r
Precision = 0;\r
//\r
- // break skiped on purpose.\r
+ // break skipped on purpose.\r
//\r
default:\r
Done = TRUE;\r
//\r
switch (FormatCharacter) {\r
case 'p':\r
+ //\r
+ // Flag space, +, 0, L & l are invalid for type p.\r
+ //\r
+ Flags &= ~(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);\r
if (sizeof (VOID *) > 4) {\r
Flags |= LONG_TYPE;\r
}\r
case 'X':\r
Flags |= PREFIX_ZERO;\r
//\r
- // break skiped on purpose\r
+ // break skipped on purpose\r
//\r
case 'x':\r
Flags |= RADIX_HEX;\r
//\r
- // break skiped on purpose\r
+ // break skipped on purpose\r
//\r
case 'd':\r
if ((Flags & LONG_TYPE) == 0) {\r
UINTN Size;\r
FILEPATH_DEVICE_PATH *FilePath;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;\r
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;\r
\r
DevicePath = NULL;\r
\r
Size = StrSize (FileName);\r
- FileDevicePathNode = CreateDeviceNode (\r
- MEDIA_DEVICE_PATH,\r
- MEDIA_FILEPATH_DP,\r
- (UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)\r
- );\r
- if (FileDevicePathNode != NULL) {\r
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;\r
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);\r
+ if (FileDevicePath != NULL) {\r
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;\r
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;\r
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;\r
CopyMem (&FilePath->PathName, FileName, Size);\r
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);\r
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));\r
+\r
if (Device != NULL) {\r
DevicePath = DevicePathFromHandle (Device);\r
}\r
- DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);\r
- FreePool (FileDevicePathNode);\r
+\r
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);\r
+ FreePool (FileDevicePath);\r
}\r
\r
return DevicePath;\r
UINTN Size;\r
FILEPATH_DEVICE_PATH *FilePath;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;\r
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;\r
\r
DevicePath = NULL;\r
\r
Size = StrSize (FileName);\r
- FileDevicePathNode = CreateDeviceNode (\r
- MEDIA_DEVICE_PATH,\r
- MEDIA_FILEPATH_DP,\r
- (UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)\r
- );\r
- if (FileDevicePathNode != NULL) {\r
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;\r
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);\r
+ if (FileDevicePath != NULL) {\r
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;\r
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;\r
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;\r
CopyMem (&FilePath->PathName, FileName, Size);\r
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);\r
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));\r
+\r
if (Device != NULL) {\r
DevicePath = DevicePathFromHandle (Device);\r
}\r
- DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);\r
- FreePool (FileDevicePathNode);\r
+\r
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);\r
+ FreePool (FileDevicePath);\r
}\r
\r
return DevicePath;\r