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 18extern segment_descriptor gBootGDT[BOOT_GDT_SEGMENT_COUNT]; 19 20 21// For use with mmu_map_physical_memory() 22static const uint32 kDefaultPageFlags = 0x3; // present, R/W 23 24#ifdef __cplusplus 25extern "C" { 26#endif 27 28extern void mmu_init(void); 29extern void mmu_init_for_kernel(void); 30extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags); 31extern void *mmu_allocate(void *virtualAddress, size_t size); 32extern void *mmu_allocate_page(addr_t *_physicalAddress); 33extern bool mmu_allocate_physical(addr_t base, size_t size); 34extern void mmu_free(void *virtualAddress, size_t size); 35 36// Used by the long mode switch code 37extern size_t mmu_get_virtual_usage(); 38extern 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