1 /* 2 * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef MMU_H 6 #define MMU_H 7 8 9 #include <arch/x86/descriptors.h> 10 11 12 #ifndef _ASSEMBLER 13 14 15 #include <SupportDefs.h> 16 17 18 extern segment_descriptor gBootGDT[BOOT_GDT_SEGMENT_COUNT]; 19 20 21 // For use with mmu_map_physical_memory() 22 static const uint32 kDefaultPageFlags = 0x3; // present, R/W 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 extern void mmu_init(void); 29 extern void mmu_init_for_kernel(void); 30 extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags); 31 extern void *mmu_allocate(void *virtualAddress, size_t size); 32 extern void *mmu_allocate_page(addr_t *_physicalAddress); 33 extern bool mmu_allocate_physical(addr_t base, size_t size); 34 extern void mmu_free(void *virtualAddress, size_t size); 35 36 // Used by the long mode switch code 37 extern size_t mmu_get_virtual_usage(); 38 extern bool mmu_get_virtual_mapping(addr_t virtualAddress, 39 addr_t *_physicalAddress); 40 41 #ifdef __cplusplus 42 } 43 #endif 44 45 #endif // !_ASSEMBLER 46 47 #endif /* MMU_H */ 48