From 1ea7d9dec1b460ab76dfd6270596c8138c9c2b40 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 12 May 2022 15:52:25 +0300 Subject: initial workings of shared memory + Should document this better but essentially a server requests a shared buffer, and chan then share this buffer to a thread. Freeing the buffer is done through normal means. MR_SHARED is used for buffers that are shared, and MR_OWNED tells whoever is freeing that region that it is allowed to free the physical memory behind the shared buffer. --- include/apos/mem_regions.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/apos/mem_regions.h') diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h index e2ab64b..7841dde 100644 --- a/include/apos/mem_regions.h +++ b/include/apos/mem_regions.h @@ -28,10 +28,12 @@ struct mem_region { stat_t init_region(struct mem_region_root *r, vm_t start, size_t arena_size); void destroy_region(struct mem_region_root *r); -vm_t alloc_region(struct mem_region_root *r, size_t size, size_t *actual_size); +vm_t alloc_region(struct mem_region_root *r, size_t size, size_t *actual_size, + vmflags_t flags); vm_t alloc_fixed_region(struct mem_region_root *r, vm_t start, size_t size, - size_t *actual_size); + size_t *actual_size, vmflags_t flags); stat_t free_region(struct mem_region_root *r, vm_t start); +stat_t free_known_region(struct mem_region_root *r, struct mem_region *m); struct mem_region *find_used_region(struct mem_region_root *r, vm_t start); struct mem_region *find_closest_used_region(struct mem_region_root *r, -- cgit v1.3