diff options
Diffstat (limited to 'kernel/inc/mm.h')
-rw-r--r-- | kernel/inc/mm.h | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/kernel/inc/mm.h b/kernel/inc/mm.h index e680ab7..6d3714d 100644 --- a/kernel/inc/mm.h +++ b/kernel/inc/mm.h @@ -6,12 +6,15 @@ #include <boot.h> #include <def.h> +struct memory_range { + u32 base; + u32 size; +}; + /** * Physical */ -u32 physical_alloc(u32 n); - /** * Virtual */ @@ -66,10 +69,11 @@ struct page_dir { } PACKED; u32 virtual_to_physical(struct page_dir *dir, u32 vaddr); -void virtual_map(struct page_dir *dir, u32 vaddr, u32 paddr, u32 n, u8 user); +void virtual_map(struct page_dir *dir, struct memory_range prange, u32 vaddr, u32 flags); struct memory_range virtual_alloc(struct page_dir *dir, struct memory_range physical_range, u32 flags); -void paging_install(struct mem_info *mem_info); +struct page_dir *virtual_create_dir(void); +struct page_dir *virtual_kernel_dir(void); /** * Memory wrappers @@ -80,19 +84,13 @@ void paging_install(struct mem_info *mem_info); #define MEMORY_CLEAR (1 << 1) #define memory_range(base, size) ((struct memory_range){ (base), (size) }) -struct memory_range { - u32 base; - u32 size; -}; - -struct memory_range memory_range_from_address(u32 base, u32 size); -struct memory_range memory_range_around_address(u32 base, u32 size); +struct memory_range memory_range_from(u32 base, u32 size); +struct memory_range memory_range_around(u32 base, u32 size); -struct page_dir *memory_dir_create(void); -void memory_dir_switch(struct page_dir *dir); -// TODO: Remove these wrappers completely? -/* void memory_alloc(struct page_dir *dir, u32 size, u32 flags, u32 *out); */ -/* void memory_map(struct page_dir *dir, struct memory_range range, u32 flags); */ -struct page_dir *memory_kernel_dir(void); +void memory_install(struct mem_info *mem_info); +void *memory_alloc(struct page_dir *dir, u32 size, u32 flags); +void *memory_alloc_identity(struct page_dir *dir, u32 flags); +void memory_free(struct page_dir *dir, struct memory_range vrange); +void memory_switch_dir(struct page_dir *dir); #endif |