diff options
author | Robert Morris <[email protected]> | 2011-09-13 12:28:45 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2011-09-13 12:28:45 -0400 |
commit | 7e7cb106d0b2408794d814ae26ee945bdb83886a (patch) | |
tree | d009fbd789b78b1fb1f729d3bf10f24dae76367f /memlayout.h | |
parent | 90a81b32285ed8d9644b95777c1bc0c931cb69c5 (diff) | |
download | xv6-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.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 |