summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-09 22:28:58 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-09 22:43:01 +0200
commit2dbf108457d0a0057cc63d5b3b89fd4da48d2a72 (patch)
tree7de245e353f736224b07609dfa81b637c1fb2cf4 /include
parentd7d9a1e104c21183506935f26d59bb00161bd797 (diff)
Add vm_allocate_contiguous RPC
This allows privileged userland drivers to allocate buffers for e.g. DMA, and thus need them to be physically contiguous and get their physical address. Initial work by Zheng Da, reworked by Richard Braun, Damien Zammit, and myself. * doc/mach.texi (vm_allocate_contiguous): New RPC. * i386/include/mach/i386/machine_types.defs (rpc_phys_addr_t): New type. * i386/include/mach/i386/vm_types.h [!MACH_KERNEL] (phys_addr_t): Set type to 64bits. (rpc_phys_addr_t): New type, always 64bits. * include/mach/gnumach.defs (vm_allocate_contiguous):New RPC. * vm/vm_user.c (vm_allocate_contiguous): New function.
Diffstat (limited to 'include')
-rw-r--r--include/mach/gnumach.defs24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs
index 97ab573c..d423a10a 100644
--- a/include/mach/gnumach.defs
+++ b/include/mach/gnumach.defs
@@ -165,3 +165,27 @@ routine vm_msync(
address : vm_address_t;
size : vm_size_t;
sync_flags : vm_sync_t);
+
+/*
+ * This routine is created for allocating DMA buffers.
+ * We are going to get a contiguous physical memory
+ * and its physical address in addition to the virtual address.
+ * We can specify physical memory range limits and alignment.
+ * NB:
+ * pmax is defined as the byte after the maximum address,
+ * eg 0x100000000 for 4GiB limit.
+ */
+/* XXX
+ * Future work: the RPC should return a special
+ * memory object (similar to device_map() ), which can then be mapped into
+ * the process address space with vm_map() like any other memory object.
+ */
+routine vm_allocate_contiguous(
+ host_priv : host_priv_t;
+ target_task : vm_task_t;
+ out vaddr : vm_address_t;
+ out paddr : rpc_phys_addr_t;
+ size : vm_size_t;
+ pmin : rpc_phys_addr_t;
+ pmax : rpc_phys_addr_t;
+ palign : rpc_phys_addr_t);