fix code that depends on GCC's void* pointer arithmetic extension

svn path=/trunk/; revision=16419
This commit is contained in:
Thomas Bluemel 2005-07-04 23:05:17 +00:00
parent eea2c1d47c
commit a4a9299b16
12 changed files with 40 additions and 40 deletions

View file

@ -363,7 +363,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition =
CmResourceShareUndetermined;
Ptr = (char *)(((PVOID)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
Ptr = (char *)(((ULONG_PTR)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set instalation check data */
@ -460,7 +460,7 @@ SetHarddiskConfigurationData(FRLDRHKEY DiskKey,
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
/* Get pointer to geometry data */
DiskGeometry = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
DiskGeometry = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
/* Get the disk geometry */
ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
@ -648,7 +648,7 @@ DetectBiosDisks(FRLDRHKEY SystemKey,
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
/* Get harddisk Int13 geometry data */
Int13Drives = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
Int13Drives = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
for (i = 0; i < DiskCount; i++)
{
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
@ -744,7 +744,7 @@ GetInt1eTable(VOID)
PUSHORT SegPtr = (PUSHORT)0x7A;
PUSHORT OfsPtr = (PUSHORT)0x78;
return (PVOID)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr);
return (PVOID)((ULONG_PTR)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr));
}
@ -814,7 +814,7 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_FLOPPY_DEVICE_DATA);
FloppyData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
FloppyData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
FloppyData->Version = 2;
FloppyData->Revision = 0;
FloppyData->MaxDensity = MaxDensity[FloppyType];
@ -1691,7 +1691,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
KeyboardData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
KeyboardData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
KeyboardData->Version = 0;
KeyboardData->Revision = 0;
KeyboardData->Type = 4;

View file

@ -208,7 +208,7 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = Table->Size;
memcpy(((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR),
memcpy((PVOID)((ULONG_PTR)FullResourceDescriptor + sizeof(CM_FULL_RESOURCE_DESCRIPTOR)),
Table,
Table->Size);

View file

@ -258,7 +258,7 @@ static BOOL PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNumbe
// of checking the sector read count we will rely solely
// on the carry flag being set on error
Buffer += (NumberOfSectorsToRead * DriveGeometry.BytesPerSector);
Buffer = (PVOID)((ULONG_PTR)Buffer + (NumberOfSectorsToRead * DriveGeometry.BytesPerSector));
SectorCount -= NumberOfSectorsToRead;
SectorNumber += NumberOfSectorsToRead;
}

View file

@ -387,7 +387,7 @@ XboxDiskPolledRead(ULONG CommandPort,
if (Junk == FALSE)
{
IDEReadBlock(CommandPort, Buffer, IDE_SECTOR_BUF_SZ);
Buffer += IDE_SECTOR_BUF_SZ;
Buffer = (PVOID)((ULONG_PTR)Buffer + IDE_SECTOR_BUF_SZ);
}
else
{

View file

@ -164,14 +164,14 @@ BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount
// Copy the portion requested into the buffer
//
RtlCopyMemory(Buffer,
(CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
(PVOID)((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
(CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
DbgPrint((DPRINT_CACHE, "1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, (CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector)));
//
// Update the buffer address
//
Buffer += (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector);
Buffer = (PVOID)((ULONG_PTR)Buffer + (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
//
// Update the block count
@ -204,7 +204,7 @@ BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount
//
// Update the buffer address
//
Buffer += CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector;
Buffer = (PVOID)((ULONG_PTR)Buffer + (CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector));
//
// Update the block count
@ -237,7 +237,7 @@ BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount
//
// Update the buffer address
//
Buffer += SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector;
Buffer = (PVOID)((ULONG_PTR)Buffer + (SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector));
//
// Update the block count

View file

@ -298,7 +298,7 @@ BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize
for (CurrentOffset=0; CurrentOffset<DirectorySize; )
{
CurrentDirectoryEntry = (PEXT2_DIR_ENTRY)(DirectoryBuffer + CurrentOffset);
CurrentDirectoryEntry = (PEXT2_DIR_ENTRY)((ULONG_PTR)DirectoryBuffer + CurrentOffset);
if (CurrentDirectoryEntry->rec_len == 0)
{
@ -401,7 +401,7 @@ BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
DbgPrint((DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"));
// Copy the data from the link
RtlCopyMemory(Buffer, (PVOID)(Ext2FileInfo->Inode.i_block) + Ext2FileInfo->FilePointer, BytesToRead);
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.i_block), BytesToRead);
if (BytesRead != NULL)
{
@ -466,7 +466,7 @@ BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
}
BytesToRead -= LengthInBlock;
Ext2FileInfo->FilePointer += LengthInBlock;
Buffer += LengthInBlock;
Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInBlock);
}
//
@ -497,7 +497,7 @@ BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
}
BytesToRead -= Ext2BlockSizeInBytes;
Ext2FileInfo->FilePointer += Ext2BlockSizeInBytes;
Buffer += Ext2BlockSizeInBytes;
Buffer = (PVOID)((ULONG_PTR)Buffer + Ext2BlockSizeInBytes);
NumberOfBlocks--;
}
}
@ -523,7 +523,7 @@ BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead,
}
Ext2FileInfo->FilePointer += BytesToRead;
BytesToRead -= BytesToRead;
Buffer += BytesToRead;
Buffer = (PVOID)((ULONG_PTR)Buffer + (ULONG_PTR)BytesToRead);
}
return TRUE;
@ -878,7 +878,7 @@ BOOL Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length,
return FALSE;
}
memcpy(Buffer, ((PVOID)FILESYSBUFFER + StartingOffset), Length);
memcpy(Buffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + StartingOffset), Length);
return TRUE;
}

View file

@ -860,7 +860,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
}
}
fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
fat = *((USHORT *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset));
if (Cluster & 0x0001)
fat = fat >> 4; /* Cluster number is ODD */
else
@ -880,7 +880,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
return FALSE;
}
fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
fat = *((USHORT *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset));
break;
@ -897,7 +897,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
}
// Get the fat entry
fat = (*((ULONG *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
fat = (*((ULONG *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
break;
@ -1091,7 +1091,7 @@ BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID
//
// Increment buffer address by cluster size
//
Buffer += SectorsPerCluster * BytesPerSector;
Buffer = (PVOID)((ULONG_PTR)Buffer + (SectorsPerCluster * BytesPerSector));
//
// Get next cluster
@ -1132,7 +1132,7 @@ BOOL FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Leng
return FALSE;
}
memcpy(Buffer, ((PVOID)FILESYSBUFFER + StartingOffset), Length);
memcpy(Buffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + StartingOffset), Length);
return TRUE;
}
@ -1234,7 +1234,7 @@ BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
}
BytesToRead -= LengthInCluster;
FatFileInfo->FilePointer += LengthInCluster;
Buffer += LengthInCluster;
Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInCluster);
}
//
@ -1265,7 +1265,7 @@ BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
}
BytesToRead -= (NumberOfClusters * BytesPerCluster);
FatFileInfo->FilePointer += (NumberOfClusters * BytesPerCluster);
Buffer += (NumberOfClusters * BytesPerCluster);
Buffer = (PVOID)((ULONG_PTR)Buffer + (NumberOfClusters * BytesPerCluster));
}
}
@ -1290,7 +1290,7 @@ BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
}
FatFileInfo->FilePointer += BytesToRead;
BytesToRead -= BytesToRead;
Buffer += BytesToRead;
Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
}
return TRUE;

View file

@ -81,12 +81,12 @@ static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG Directo
while (TRUE)
{
Offset = Offset + Record->RecordLength;
Record = (PDIR_RECORD)(DirectoryBuffer + Offset);
Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);
if (Record->RecordLength == 0)
{
Offset = ROUND_UP(Offset, SECTORSIZE);
Record = (PDIR_RECORD)(DirectoryBuffer + Offset);
Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);
}
if (Offset >= DirectoryLength)
@ -159,7 +159,7 @@ static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLengt
//
// Now read directory contents into DirectoryBuffer
//
for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr += SECTORSIZE)
for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr = (PVOID)((ULONG_PTR)Ptr + SECTORSIZE))
{
if (!MachDiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
{
@ -377,14 +377,14 @@ BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
{
return FALSE;
}
RtlCopyMemory(Buffer, ((PVOID)DISKREADBUFFER + OffsetInSector), LengthInSector);
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)DISKREADBUFFER + OffsetInSector), LengthInSector);
if (BytesRead != NULL)
{
*BytesRead += LengthInSector;
}
BytesToRead -= LengthInSector;
IsoFileInfo->FilePointer += LengthInSector;
Buffer += LengthInSector;
Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInSector);
}
//
@ -417,7 +417,7 @@ BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
}
BytesToRead -= SECTORSIZE;
IsoFileInfo->FilePointer += SECTORSIZE;
Buffer += SECTORSIZE;
Buffer = (PVOID)((ULONG_PTR)Buffer + SECTORSIZE);
}
}
@ -442,7 +442,7 @@ BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Bu
}
IsoFileInfo->FilePointer += BytesToRead;
BytesToRead -= BytesToRead;
Buffer += BytesToRead;
Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
}
DbgPrint((DPRINT_FILESYSTEM, "IsoReadFile() done\n"));

View file

@ -346,7 +346,7 @@ BOOL LinuxReadSetupSector(PFILE LinuxKernelFile)
// Read in the rest of the linux setup sectors
FsSetFilePointer(LinuxKernelFile, 1024);
if (!FsReadFile(LinuxKernelFile, SetupSectorSize - 512, NULL, ((PVOID)LinuxSetupSector) + 512))
if (!FsReadFile(LinuxKernelFile, SetupSectorSize - 512, NULL, (PVOID)((ULONG_PTR)LinuxSetupSector + 512)))
{
return FALSE;
}
@ -400,7 +400,7 @@ BOOL LinuxReadKernel(PFILE LinuxKernelFile)
}
BytesLoaded += LINUX_READ_CHUNK_SIZE;
LoadAddress += LINUX_READ_CHUNK_SIZE;
LoadAddress = (PVOID)((ULONG_PTR)LoadAddress + LINUX_READ_CHUNK_SIZE);
UiDrawProgressBarCenter(BytesLoaded, LinuxKernelSize + LinuxInitrdSize, LinuxBootDescription);
}
@ -491,7 +491,7 @@ BOOL LinuxReadInitrd(PFILE LinuxInitrdFile)
}
BytesLoaded += LINUX_READ_CHUNK_SIZE;
LinuxInitrdLoadAddress += LINUX_READ_CHUNK_SIZE;
LinuxInitrdLoadAddress = (PVOID)((ULONG_PTR)LinuxInitrdLoadAddress + LINUX_READ_CHUNK_SIZE);
UiDrawProgressBarCenter(BytesLoaded + LinuxKernelSize, LinuxInitrdSize + LinuxKernelSize, LinuxBootDescription);
}

View file

@ -264,7 +264,7 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, PBIOS_ME
// Mark the pages that the lookup tabel occupies as reserved
PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
PageLookupTablePageCount = MmGetPageNumberFromAddress(PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE)) - PageLookupTableStartPage;
PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
DbgPrint((DPRINT_MEMORY, "Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount));
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, MEMTYPE_RESERVED);
}

View file

@ -72,7 +72,7 @@ PVOID MmAllocateMemory(ULONG MemorySize)
MemorySize = ROUND_UP(MemorySize, 4);
if (MemorySize <= SubAllocationRest)
{
MemPointer = SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest;
MemPointer = (PVOID)((ULONG_PTR)SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest);
SubAllocationRest -= MemorySize;
return MemPointer;
}

View file

@ -213,7 +213,7 @@ FrLdrSetupPae(ULONG Magic)
Ke386SetCr0(Ke386GetCr0() | X86_CR0_PG | X86_CR0_WP);
/* Jump to Kernel */
PagedJump = (ASMCODE)KernelEntryPoint;
PagedJump = (ASMCODE)(PVOID)(KernelEntryPoint);
PagedJump(Magic, &LoaderBlock);
}