Simplify P2V and V2P macros - also makes them more useful

This commit is contained in:
Thomas Lovén 2018-01-04 00:53:47 +01:00
parent 8e47d7625f
commit 823560d3ae

View File

@ -6,8 +6,8 @@
#define P2V(a) ((a) + KERNEL_OFFSET) #define P2V(a) ((a) + KERNEL_OFFSET)
#else #else
#include <stdint.h> #include <stdint.h>
#define V2P(a) ((uintptr_t)(a) - KERNEL_OFFSET) #define V2P(a) ((uintptr_t)(a) & ~KERNEL_OFFSET)
#define P2V(a) ((void *)((uintptr_t)(a) + KERNEL_OFFSET)) #define P2V(a) ((void *)((uintptr_t)(a) | KERNEL_OFFSET))
#endif #endif
#define P1_OFFSET(a) (((a)>>12) & 0x1FF) #define P1_OFFSET(a) (((a)>>12) & 0x1FF)