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