summaryrefslogtreecommitdiff
path: root/memlayout.h
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-08-07 12:30:34 -0400
committerFrans Kaashoek <[email protected]>2011-08-07 12:30:34 -0400
commit67d4254d15313ce24ef37c6e92b4630211c2229b (patch)
treef78ae74db6e9190b68911f149d413696b51205f2 /memlayout.h
parent547c28fc1e0cd834b2f1ab56a5c74e6b7839c582 (diff)
downloadxv6-labs-67d4254d15313ce24ef37c6e92b4630211c2229b.tar.gz
xv6-labs-67d4254d15313ce24ef37c6e92b4630211c2229b.tar.bz2
xv6-labs-67d4254d15313ce24ef37c6e92b4630211c2229b.zip
oops
Diffstat (limited to 'memlayout.h')
-rw-r--r--memlayout.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/memlayout.h b/memlayout.h
new file mode 100644
index 0000000..3958062
--- /dev/null
+++ b/memlayout.h
@@ -0,0 +1,26 @@
+// Memory layout
+
+#define PGSIZE 4096 // bytes mapped by a page
+#define PGSHIFT 12 // log2(PGSIZE)
+
+#define KSTKSIZE (8*PGSIZE) // size of a kernel stack
+
+#define IOSPACEB 0x0A0000 // begin IO space
+#define IOSPACEE 0x100000 // end IO space
+#define PHYSTOP 0xE000000 // use phys mem up to here as free pool
+
+// Key addresses for address space layout (see kmap in vm.c for the actual layout)
+#define KERNBASE 0xF0000000 // First kernel virtual address
+#define USERTOP (KERNBASE-PGSIZE) // Highest user virtual address
+#define KERNLINK 0xF0100000 // Address where kernel is linked
+
+#ifndef __ASSEMBLER__
+
+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)
+