summaryrefslogtreecommitdiff
path: root/kernel/memlayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/memlayout.h')
-rw-r--r--kernel/memlayout.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/memlayout.h b/kernel/memlayout.h
index ef5c1e1..c15e398 100644
--- a/kernel/memlayout.h
+++ b/kernel/memlayout.h
@@ -53,4 +53,15 @@
// map the trampoline page to the highest address,
// in both user and kernel space.
#define TRAMPOLINE (MAXVA - PGSIZE)
-#define KSTACK(p) (TRAMPOLINE - (p+1)* 2*PGSIZE)
+#define KSTACK(p) (TRAMPOLINE - ((p)+1)* 2*PGSIZE)
+
+// User memory layout.
+// Address zero first:
+// text
+// original data and bss
+// fixed-size stack
+// expandable heap
+// ...
+// TRAPFRAME (p->tf, used by the trampoline)
+// TRAMPOLINE (the same page as in the kernel)
+#define TRAPFRAME (TRAMPOLINE - PGSIZE)