summaryrefslogtreecommitdiff
path: root/memlayout.h
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2011-09-13 12:28:45 -0400
committerRobert Morris <[email protected]>2011-09-13 12:28:45 -0400
commit7e7cb106d0b2408794d814ae26ee945bdb83886a (patch)
treed009fbd789b78b1fb1f729d3bf10f24dae76367f /memlayout.h
parent90a81b32285ed8d9644b95777c1bc0c931cb69c5 (diff)
downloadxv6-labs-7e7cb106d0b2408794d814ae26ee945bdb83886a.tar.gz
xv6-labs-7e7cb106d0b2408794d814ae26ee945bdb83886a.tar.bz2
xv6-labs-7e7cb106d0b2408794d814ae26ee945bdb83886a.zip
more regular kmap[] and description
Diffstat (limited to 'memlayout.h')
-rw-r--r--memlayout.h8
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