From 10ae2e6ebc7e9776b9f124c9fc530c79f5e84460 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 2 Dec 2022 21:12:11 +0200 Subject: initial shared memory working --- include/apos/mem_regions.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/apos/mem_regions.h') diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h index b94d15a..7231dbd 100644 --- a/include/apos/mem_regions.h +++ b/include/apos/mem_regions.h @@ -85,6 +85,9 @@ struct mem_region { * MR_SHARED, MR_OWNED, MR_COW, MR_KEEP. */ vmflags_t flags; + /** In shared regions, mark the other pid that shared the region. */ + id_t pid; + /** End address of memory region. */ vm_t end; @@ -124,6 +127,21 @@ stat_t destroy_region(struct mem_region_root *r); vm_t alloc_region(struct mem_region_root *r, size_t size, size_t *actual_size, vmflags_t flags); +/** + * Allocate memory region and associate it with some other process. + * Will allocate region of at least \c size bytes, with best possible location. + * + * @param r Memory region root. + * @param size Size of region to allocate. + * @param actual_size Size of region that was allocated. + * @param flags Memory flags. + * @param pid Process to associate with region. + * @return Address of allocated region on success, otherwise \c NULL. + */ +stat_t alloc_shared_region(struct mem_region_root *r, size_t size, + size_t *actual_size, + vmflags_t flags, id_t pid); + /** * Allocate fixed memory region. * Will allocate region that is at least \c size bytes, and includes \c start. -- cgit v1.3