xref: /haiku/headers/private/kernel/arch/riscv64/arch_vm_translation_map.h (revision 7ef006297e181ea47ae4d1994817f5d516b44284)
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*
VirtFromPhys(phys_addr_t physAdr)16 VirtFromPhys(phys_addr_t physAdr)
17 {
18 	return (void*)(physAdr + gVirtFromPhysOffset);
19 }
20 
21 
22 static inline phys_addr_t
PhysFromVirt(void * virtAdr)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