diff options
Diffstat (limited to 'kernel/include/mm')
| -rw-r--r-- | kernel/include/mm/memory_map.h | 9 | ||||
| -rw-r--r-- | kernel/include/mm/multiboot.h | 8 | ||||
| -rw-r--r-- | kernel/include/mm/page_table_allocator.h | 9 | ||||
| -rw-r--r-- | kernel/include/mm/physical.h | 2 | ||||
| -rw-r--r-- | kernel/include/mm/physical_mm.h | 25 | ||||
| -rw-r--r-- | kernel/include/mm/virtual_mm.h | 23 |
6 files changed, 25 insertions, 51 deletions
diff --git a/kernel/include/mm/memory_map.h b/kernel/include/mm/memory_map.h index de8296b..ec67b64 100644 --- a/kernel/include/mm/memory_map.h +++ b/kernel/include/mm/memory_map.h @@ -30,12 +30,7 @@ typedef struct { multiboot_memory_map_t *region_list[MAX_FREE_REGIONS]; } free_memory_regions_t; -namespace MemoryMap -{ - -void load(multiboot_info_t *mmap); -free_memory_regions_t *get_free_regions(void); - -} +void mmap_load(multiboot_info_t *mmap); +free_memory_regions_t *mmap_get_free_regions(void); #endif diff --git a/kernel/include/mm/multiboot.h b/kernel/include/mm/multiboot.h index d95ab55..d7cd8cc 100644 --- a/kernel/include/mm/multiboot.h +++ b/kernel/include/mm/multiboot.h @@ -94,10 +94,6 @@ #ifndef ASM_FILE -#ifdef __cplusplus -extern "C" { -#endif - typedef uint8_t multiboot_uint8_t; typedef uint16_t multiboot_uint16_t; typedef uint32_t multiboot_uint32_t; @@ -271,10 +267,6 @@ struct multiboot_apm_info { multiboot_uint16_t dseg_len; }; -#ifdef __cplusplus -} -#endif - #endif /* ! ASM_FILE */ #endif /* ! MULTIBOOT_HEADER */ diff --git a/kernel/include/mm/page_table_allocator.h b/kernel/include/mm/page_table_allocator.h index 4a0b0fb..80de80e 100644 --- a/kernel/include/mm/page_table_allocator.h +++ b/kernel/include/mm/page_table_allocator.h @@ -21,12 +21,7 @@ #include <stdint.h> -namespace PageTableAllocator -{ - -uint32_t *allocate(void); -void initialize(void); - -} +uint32_t *pta_allocate(void); +void pta_initialize(void); #endif diff --git a/kernel/include/mm/physical.h b/kernel/include/mm/physical.h new file mode 100644 index 0000000..8f79e1c --- /dev/null +++ b/kernel/include/mm/physical.h @@ -0,0 +1,2 @@ + +pmm_initialize diff --git a/kernel/include/mm/physical_mm.h b/kernel/include/mm/physical_mm.h index abdf178..d10b010 100644 --- a/kernel/include/mm/physical_mm.h +++ b/kernel/include/mm/physical_mm.h @@ -34,40 +34,35 @@ */ #define MAX_BLOCKS 1048576 -namespace PhysicalMM -{ - /* Initialize the memory map by getting all free regions, setting all blocks to * used, initializing regions marked free by the memory map provided by * multiboot, and deinitializing the memory used by the kernel */ -void initialize(void); +void pmm_initialize(void); /* Find and allocate a free memory block, returning the physical address of the * block */ -void *allocate_block(void); +void *pmm_allocate_block(void); /* Free an allocated memory block, given the physical address (from * allocate_block) */ -void free_block(void *physical_address); +void pmm_free_block(void *physical_address); /*-- BITMAP --*/ /* Marks the block as 'used' */ -void set_used(const uint32_t bit, - uint32_t *total_free_blocks, - uint32_t *memory_map); +void pmm_set_used(const uint32_t bit, + uint32_t *total_free_blocks, + uint32_t *memory_map); /* Marks the block as 'unused' */ -void set_usable(const uint32_t bit, - uint32_t *total_free_blocks, - uint32_t *memory_map); +void pmm_set_usable(const uint32_t bit, + uint32_t *total_free_blocks, + uint32_t *memory_map); /* Returns: * True if the bit is set (block is in use) * False if the bit is unset (block isn't in use) */ -bool test_bit(const uint32_t bit, uint32_t *memory_map); - -} +bool pmm_test_bit(const uint32_t bit, uint32_t *memory_map); #endif diff --git a/kernel/include/mm/virtual_mm.h b/kernel/include/mm/virtual_mm.h index 818ce8b..4583fc0 100644 --- a/kernel/include/mm/virtual_mm.h +++ b/kernel/include/mm/virtual_mm.h @@ -69,51 +69,46 @@ #define VIRTUAL_ADDRESS(pd_index, pt_index) \ (((pd_index) << 22) | ((pt_index) << 12)) -namespace VirtualMM -{ - -uint32_t *get_page_directory(void); +uint32_t *vmm_get_page_directory(void); /* * Loads a given page directory into CR0 */ -void load_page_directory(uint32_t *page_directory); +void vmm_load_page_directory(uint32_t *page_directory); /* * Switches the current page directory to a given page directory */ -bool switch_page_directory(uint32_t *page_directory); +bool vmm_switch_page_directory(uint32_t *page_directory); /* * Initialize the virtual memory manager */ -void initialize(void); +void vmm_initialize(void); /* * Map a physical address to a virtual address */ -void map_page(void *physical_address, void *virtual_address); +void vmm_map_page(void *physical_address, void *virtual_address); /* * Unmap a page starting at virtual address */ -void unmap_page(void *virtual_address); +void vmm_unmap_page(void *virtual_address); /* * Find a virtual address with n consecutive free addresses. */ -void *find_free_pages(uint32_t n_pages); +void *vmm_find_free_pages(uint32_t n_pages); /* * Allocate and map n pages. */ -void *alloc_pages(uint32_t n_pages); +void *vmm_alloc_pages(uint32_t n_pages); /* * Free n pages from the starting address. */ -void free_pages(void *starting_address, uint32_t n_pages); - -} +void vmm_free_pages(void *starting_address, uint32_t n_pages); #endif |
