diff options
author | Alex Auvolat <alex@adnab.me> | 2015-03-14 16:36:31 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2015-03-14 16:36:31 +0100 |
commit | 3e2a3170501fb02b5b46a342c47d2ba8b1a6e244 (patch) | |
tree | 6cd0a3f3ded016de581e3b3841ab19f1e511dd86 /src/lib/include/user_region.h | |
parent | 57c5eceb846f3109d017b4e6d4cbd7c507c0d098 (diff) | |
download | kogata-3e2a3170501fb02b5b46a342c47d2ba8b1a6e244.tar.gz kogata-3e2a3170501fb02b5b46a342c47d2ba8b1a6e244.zip |
Factorize region allocator between kernel and user processes (same code was there twice)
Diffstat (limited to 'src/lib/include/user_region.h')
-rw-r--r-- | src/lib/include/user_region.h | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/lib/include/user_region.h b/src/lib/include/user_region.h deleted file mode 100644 index 8a4c490..0000000 --- a/src/lib/include/user_region.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -// User virtual memory region allocator - -// This is entirely thread-safe - -#include <stdint.h> -#include <stddef.h> -#include <stdbool.h> - -#include <syscall.h> - -#define PAGE_SIZE 0x1000 -#define PAGE_MASK 0xFFFFF000 -#define PAGE_ALIGN_DOWN(x) (((size_t)x) & PAGE_MASK) -#define PAGE_ALIGN_UP(x) ((((size_t)x)&(~PAGE_MASK)) == 0 ? ((size_t)x) : (((size_t)x) & PAGE_MASK) + PAGE_SIZE) - -struct region_info; - -typedef struct region_info { - void* addr; - size_t size; - char* type; -} region_info_t; - -void region_allocator_init(void* begin, void* end); - -void* region_alloc(size_t size, char* type); // returns 0 on error -region_info_t *find_region(void* addr); -void region_free(void* addr); - -void dbg_print_region_info(); - -/* vim: set ts=4 sw=4 tw=0 noet :*/ |