1 /* 2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KERNEL_ARCH_RISCV64_VM_TRANSLATION_MAP_H 6 #define _KERNEL_ARCH_RISCV64_VM_TRANSLATION_MAP_H 7 8 #include <arch/vm_translation_map.h> 9 10 11 //gVirtFromPhysOffset = virtAdr - physAdr; 12 extern ssize_t gVirtFromPhysOffset; 13 14 15 static inline void* 16 VirtFromPhys(phys_addr_t physAdr) 17 { 18 return (void*)(physAdr + gVirtFromPhysOffset); 19 } 20 21 22 static inline phys_addr_t 23 PhysFromVirt(void* virtAdr) 24 { 25 return (phys_addr_t)virtAdr - gVirtFromPhysOffset; 26 } 27 28 29 #endif /* _KERNEL_ARCH_RISCV64_VM_TRANSLATION_MAP_H */ 30