diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-22 15:05:39 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-22 15:05:39 +0300 |
| commit | 5793a61eb824a7b97e9bab5913b595a778205cef (patch) | |
| tree | f31931b924058cb6474b80cd02472940ad8cfcd5 /include/apos/mem_regions.h | |
| parent | a4851206bef5ceecef18b3fde5be6918a67cca21 (diff) | |
| download | kmi-5793a61eb824a7b97e9bab5913b595a778205cef.tar.gz kmi-5793a61eb824a7b97e9bab5913b595a778205cef.zip | |
improved tcb handling in preparation for processes
Diffstat (limited to 'include/apos/mem_regions.h')
| -rw-r--r-- | include/apos/mem_regions.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h index efe0592..9f09eff 100644 --- a/include/apos/mem_regions.h +++ b/include/apos/mem_regions.h @@ -7,10 +7,12 @@ #include <arch/vmem.h> #define mem_container(ptr) container_of(ptr, struct mem_region, sp_n) +#define is_region_used(r) __is_set(r->flags, MR_USED) struct mem_region_root { struct sp_root free_regions; struct sp_root used_regions; + struct mem_region *first; }; struct mem_region { @@ -26,7 +28,7 @@ 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); +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); @@ -35,6 +37,7 @@ vm_t alloc_fixed_region(struct mem_region_root *r, vm_t start, size_t size, 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_first_region(struct mem_region_root *r); 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, vm_t start); |
