* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: iospace.c,v 1.10 2001/04/09 02:45:04 dwelch Exp $
+/* $Id: iospace.c,v 1.11 2001/05/01 23:08:20 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/iospace.c
{
Attributes |= (PAGE_NOCACHE | PAGE_WRITETHROUGH);
}
- for (i = 0; (i <= (NumberOfBytes / PAGESIZE)); i++)
+ for (i = 0; (i < ((NumberOfBytes + PAGESIZE - 1) / PAGESIZE)); i++)
{
Status =
- MmCreateVirtualMapping (NULL,
- (Result + (i * PAGESIZE)),
+ MmCreateVirtualMappingForKernel (
+ (Result + (i * PAGESIZE)),
Attributes,
PhysicalAddress.u.LowPart + (i * PAGESIZE));
if (!NT_SUCCESS(Status))
KeBugCheck(0);
}
}
- return ((PVOID)Result);
+ return ((PVOID)(Result + PhysicalAddress.QuadPart % PAGESIZE));
}
IN ULONG NumberOfBytes)
{
(VOID)MmFreeMemoryArea(&PsGetCurrentProcess()->AddressSpace,
- BaseAddress,
+ (PVOID)(((ULONG)BaseAddress / PAGESIZE) * PAGESIZE),
NumberOfBytes,
NULL,
NULL);