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
This commit is contained in:
qhuang8
2006-07-06 10:37:49 +00:00
parent df569f61e3
commit 28c73f6ef7
6 changed files with 61 additions and 33 deletions

View File

@ -134,8 +134,8 @@ _RightShiftU64_Calc:
mov eax, dword ptr Operand[0] mov eax, dword ptr Operand[0]
mov edx, dword ptr Operand[4] mov edx, dword ptr Operand[4]
shrd edx, eax, cl shrd eax, edx, cl
shr eax, cl shr edx, cl
cmp ecx, 32 cmp ecx, 32
jc short _RightShiftU64_Done jc short _RightShiftU64_Done

View File

@ -1299,11 +1299,16 @@ PciCf8ReadBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
ASSERT ((Buffer != NULL) || (Size == 0));
if (Size == 0) {
return 0;
}
ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) { if ((StartAddress & 1) != 0) {
// //
// Read a byte if StartAddress is byte aligned // Read a byte if StartAddress is byte aligned
// //
@ -1386,11 +1391,16 @@ PciCf8WriteBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
ASSERT ((Buffer != NULL) || (Size == 0));
if (Size == 0) {
return 0;
}
ASSERT (Buffer != 0);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) { if ((StartAddress & 1)!= 0) {
// //
// Write a byte if StartAddress is byte aligned // Write a byte if StartAddress is byte aligned
// //

View File

@ -1196,11 +1196,16 @@ PciExpressReadBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress); ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((Buffer != NULL) || (Size == 0));
if (Size == 0) {
return 0;
}
ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) { if ((StartAddress & 1) != 0) {
// //
// Read a byte if StartAddress is byte aligned // Read a byte if StartAddress is byte aligned
// //
@ -1282,11 +1287,16 @@ PciExpressWriteBuffer (
ASSERT_INVALID_PCI_ADDRESS (StartAddress); ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((Buffer != NULL) || (Size == 0));
if (Size == 0) {
return 0;
}
ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) { if ((StartAddress & 1) != 0) {
// //
// Write a byte if StartAddress is byte aligned // Write a byte if StartAddress is byte aligned
// //

View File

@ -236,7 +236,7 @@ BasePrintLibVSPrint (
Format -= BytesPerFormatCharacter; Format -= BytesPerFormatCharacter;
Precision = 0; Precision = 0;
// //
// break skiped on purpose. // break skipped on purpose.
// //
default: default:
Done = TRUE; Done = TRUE;
@ -256,18 +256,22 @@ BasePrintLibVSPrint (
// //
switch (FormatCharacter) { switch (FormatCharacter) {
case 'p': 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) { if (sizeof (VOID *) > 4) {
Flags |= LONG_TYPE; Flags |= LONG_TYPE;
} }
case 'X': case 'X':
Flags |= PREFIX_ZERO; Flags |= PREFIX_ZERO;
// //
// break skiped on purpose // break skipped on purpose
// //
case 'x': case 'x':
Flags |= RADIX_HEX; Flags |= RADIX_HEX;
// //
// break skiped on purpose // break skipped on purpose
// //
case 'd': case 'd':
if ((Flags & LONG_TYPE) == 0) { if ((Flags & LONG_TYPE) == 0) {

View File

@ -496,24 +496,26 @@ FileDevicePath (
UINTN Size; UINTN Size;
FILEPATH_DEVICE_PATH *FilePath; FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode; EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL; DevicePath = NULL;
Size = StrSize (FileName); Size = StrSize (FileName);
FileDevicePathNode = CreateDeviceNode ( FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);
MEDIA_DEVICE_PATH, if (FileDevicePath != NULL) {
MEDIA_FILEPATH_DP, FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
(UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH) FilePath->Header.Type = MEDIA_DEVICE_PATH;
); FilePath->Header.SubType = MEDIA_FILEPATH_DP;
if (FileDevicePathNode != NULL) {
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
CopyMem (&FilePath->PathName, FileName, Size); CopyMem (&FilePath->PathName, FileName, Size);
SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
if (Device != NULL) { if (Device != NULL) {
DevicePath = DevicePathFromHandle (Device); DevicePath = DevicePathFromHandle (Device);
} }
DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
FreePool (FileDevicePathNode); DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
FreePool (FileDevicePath);
} }
return DevicePath; return DevicePath;

View File

@ -321,24 +321,26 @@ FileDevicePath (
UINTN Size; UINTN Size;
FILEPATH_DEVICE_PATH *FilePath; FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode; EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL; DevicePath = NULL;
Size = StrSize (FileName); Size = StrSize (FileName);
FileDevicePathNode = CreateDeviceNode ( FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);
MEDIA_DEVICE_PATH, if (FileDevicePath != NULL) {
MEDIA_FILEPATH_DP, FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
(UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH) FilePath->Header.Type = MEDIA_DEVICE_PATH;
); FilePath->Header.SubType = MEDIA_FILEPATH_DP;
if (FileDevicePathNode != NULL) {
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
CopyMem (&FilePath->PathName, FileName, Size); CopyMem (&FilePath->PathName, FileName, Size);
SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
if (Device != NULL) { if (Device != NULL) {
DevicePath = DevicePathFromHandle (Device); DevicePath = DevicePathFromHandle (Device);
} }
DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
FreePool (FileDevicePathNode); DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
FreePool (FileDevicePath);
} }
return DevicePath; return DevicePath;