diff options
author | Frans Kaashoek <[email protected]> | 2011-09-27 13:00:20 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2011-09-27 13:00:20 -0400 |
commit | 0ca1c0407d3da826ad8415e3204e1c53e394e204 (patch) | |
tree | 197b25b7f02b071369d2aa452848521e327a3f39 /memlayout.h | |
parent | 9b972c06b172531e5792fc0e05d83319d325e0ee (diff) | |
parent | 1e6f0146d2e194045188ba24826eaaaee05605cb (diff) | |
download | xv6-labs-0ca1c0407d3da826ad8415e3204e1c53e394e204.tar.gz xv6-labs-0ca1c0407d3da826ad8415e3204e1c53e394e204.tar.bz2 xv6-labs-0ca1c0407d3da826ad8415e3204e1c53e394e204.zip |
Merge branch 'master' of git+ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6
Diffstat (limited to 'memlayout.h')
-rw-r--r-- | memlayout.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/memlayout.h b/memlayout.h index cd4433d..6a62cd7 100644 --- a/memlayout.h +++ b/memlayout.h @@ -10,13 +10,13 @@ #ifndef __ASSEMBLER__ -static inline uint v2p(void *a) { return (uint) a - KERNBASE; } -static inline void *p2v(uint a) { return (void *) a + KERNBASE; } +static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } +static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } #endif -#define V2P(a) ((uint) a - KERNBASE) -#define P2V(a) ((void *) a + KERNBASE) +#define V2P(a) (((uint) (a)) - KERNBASE) +#define P2V(a) (((void *) (a)) + KERNBASE) #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts |