summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-09-10 00:18:12 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-09-10 00:18:12 +0200
commit790ef9888a23fc257a66e742baf3b162b8c1f7c5 (patch)
tree77fbf1a1164462543356e69bf62c20624a2753d7
parent3e5ae795a265b8843c09cba310a5582c909f97a4 (diff)
hurd: Add missing round up size in map_dev_mem
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--src/x86_pci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/x86_pci.c b/src/x86_pci.c
index 1e70f35..2fba1e5 100644
--- a/src/x86_pci.c
+++ b/src/x86_pci.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Damien Zammit
* Copyright (c) 2017 Joan Lledó
- * Copyright (c) 2009, 2012 Samuel Thibault
+ * Copyright (c) 2009, 2012, 2020 Samuel Thibault
* Heavily inspired from the freebsd, netbsd, and openbsd backends
* (C) Copyright Eric Anholt 2006
* (C) Copyright IBM Corporation 2006
@@ -228,6 +228,7 @@ map_dev_mem(void **dest, size_t mem_offset, size_t mem_size, int write)
mach_port_t pager;
dev_mode_t mode = D_READ;
vm_prot_t prot = VM_PROT_READ;
+ int pagesize;
if (get_privileged_ports (NULL, &master_device)) {
*dest = 0;
@@ -243,6 +244,10 @@ map_dev_mem(void **dest, size_t mem_offset, size_t mem_size, int write)
if (err)
return err;
+ pagesize = getpagesize();
+ if (mem_size % pagesize)
+ mem_size += pagesize - (mem_size % pagesize);
+
err = device_map (devmem, prot, 0x0, mem_size, &pager, 0);
if (err)
return err;