Use PHYSICAL_ADDRESS data type in MmAllocateHardwareMemory() routine as it is used in MmMapHardwareMemory() as well to avoid the need of data conversion
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 35s
Builds / ExectOS (i686) (push) Successful in 34s

This commit is contained in:
Rafal Kupiec 2024-07-13 15:54:10 +02:00
parent ceb36ae8ec
commit cb64235953
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ XTAPI
XTSTATUS XTSTATUS
MmAllocateHardwareMemory(IN PFN_NUMBER PageCount, MmAllocateHardwareMemory(IN PFN_NUMBER PageCount,
IN BOOLEAN Aligned, IN BOOLEAN Aligned,
OUT PULONG_PTR Buffer); OUT PPHYSICAL_ADDRESS Buffer);
XTAPI XTAPI
XTSTATUS XTSTATUS

View File

@ -29,7 +29,7 @@ XTAPI
XTSTATUS XTSTATUS
MmAllocateHardwareMemory(IN PFN_NUMBER PageCount, MmAllocateHardwareMemory(IN PFN_NUMBER PageCount,
IN BOOLEAN Aligned, IN BOOLEAN Aligned,
OUT PULONG_PTR Buffer) OUT PPHYSICAL_ADDRESS Buffer)
{ {
PLOADER_MEMORY_DESCRIPTOR Descriptor, ExtraDescriptor, HardwareDescriptor; PLOADER_MEMORY_DESCRIPTOR Descriptor, ExtraDescriptor, HardwareDescriptor;
PFN_NUMBER Alignment, MaxPage; PFN_NUMBER Alignment, MaxPage;
@ -37,7 +37,7 @@ MmAllocateHardwareMemory(IN PFN_NUMBER PageCount,
PLIST_ENTRY ListEntry; PLIST_ENTRY ListEntry;
/* Assume failure */ /* Assume failure */
*Buffer = 0; (*Buffer).QuadPart = 0;
/* Calculate maximum page address */ /* Calculate maximum page address */
MaxPage = MM_MAXIMUM_PHYSICAL_ADDRESS >> MM_PAGE_SHIFT; MaxPage = MM_MAXIMUM_PHYSICAL_ADDRESS >> MM_PAGE_SHIFT;
@ -135,7 +135,7 @@ MmAllocateHardwareMemory(IN PFN_NUMBER PageCount,
} }
/* Return physical address */ /* Return physical address */
*Buffer = PhysicalAddress; (*Buffer).QuadPart = PhysicalAddress;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }