1/* 2 * Copyright 2021, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#ifndef MMU_H 8#define MMU_H 9 10 11#include <SupportDefs.h> 12 13#include <boot/platform.h> 14#include <util/FixedWidthPointer.h> 15 16 17extern uint8* gMemBase; 18extern size_t gTotalMem; 19 20 21void mmu_init(); 22void mmu_init_for_kernel(addr_t& satp); 23 24 25inline addr_t 26fix_address(addr_t address) 27{ 28 addr_t result; 29 if (platform_bootloader_address_to_kernel_address((void *)address, &result) 30 != B_OK) 31 return address; 32 33 return result; 34} 35 36 37template<typename Type> 38inline void 39fix_address(FixedWidthPointer<Type>& p) 40{ 41 if (p != NULL) 42 p.SetTo(fix_address(p.Get())); 43} 44 45 46#endif /* MMU_H */ 47