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 <SupportDefs.h> 10 11 12 // For use with mmu_map_physical_memory() 13 static const uint32 kDefaultPageFlags = 0x3; // present, R/W 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 extern void mmu_init(void); 20 extern void mmu_init_for_kernel(void); 21 extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags); 22 extern void *mmu_allocate(void *virtualAddress, size_t size); 23 extern void mmu_free(void *virtualAddress, size_t size); 24 25 struct boot_mmu_ops { 26 void (*initialize)(void); 27 /* len=0 to disable */ 28 status_t (*set_tt)(int which, addr_t pa, size_t len, uint32 perms); 29 /* load root pointers */ 30 status_t (*load_rp)(addr_t pa); 31 status_t (*enable_paging)(void); 32 33 }; 34 35 extern const struct boot_mmu_ops k030MMUOps; 36 extern const struct boot_mmu_ops k040MMUOps; 37 extern const struct boot_mmu_ops k060MMUOps; 38 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* MMU_H */ 45