diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index d6abfd32b960..9a4c715ea7d1 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -176,6 +176,7 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; + v &= ~PAGE_MASK; pmap_kenter((vm_offset_t)ptvmmap, v); o = (int)uio->uio_offset & PAGE_MASK; c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK)); diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index d6abfd32b960..9a4c715ea7d1 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -176,6 +176,7 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; + v &= ~PAGE_MASK; pmap_kenter((vm_offset_t)ptvmmap, v); o = (int)uio->uio_offset & PAGE_MASK; c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK));