{
Attributes |= (PAGE_NOCACHE | PAGE_WRITETHROUGH);
}
- for (i = 0; (i < ((NumberOfBytes + PAGE_SIZE - 1) / PAGE_SIZE)); i++)
+ for (i = 0; (i < (PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE)); i++)
{
Status =
MmCreateVirtualMappingForKernel(Result + (i * PAGE_SIZE),
MmUnmapIoSpace (IN PVOID BaseAddress,
IN ULONG NumberOfBytes)
{
- (VOID)MmFreeMemoryArea(&PsGetCurrentProcess()->AddressSpace,
- (PVOID)(((ULONG)BaseAddress / PAGE_SIZE) * PAGE_SIZE),
- NumberOfBytes,
- NULL,
- NULL);
+ MmLockAddressSpace(MmGetKernelAddressSpace());
+ MmFreeMemoryArea(MmGetKernelAddressSpace(),
+ (PVOID)(((ULONG)BaseAddress / PAGE_SIZE) * PAGE_SIZE),
+ NumberOfBytes,
+ NULL,
+ NULL);
+ MmUnlockAddressSpace(MmGetKernelAddressSpace());
}