summaryrefslogtreecommitdiff
path: root/kernel/memlayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/memlayout.h')
-rw-r--r--kernel/memlayout.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/memlayout.h b/kernel/memlayout.h
index cac3cb1..74d2fd4 100644
--- a/kernel/memlayout.h
+++ b/kernel/memlayout.h
@@ -25,6 +25,10 @@
#define VIRTIO0 0x10001000
#define VIRTIO0_IRQ 1
+#ifdef LAB_NET
+#define E1000_IRQ 33
+#endif
+
// core local interruptor (CLINT), which contains the timer.
#define CLINT 0x2000000L
#define CLINT_MTIMECMP(hartid) (CLINT + 0x4000 + 8*(hartid))
@@ -34,8 +38,11 @@
#define PLIC 0x0c000000L
#define PLIC_PRIORITY (PLIC + 0x0)
#define PLIC_PENDING (PLIC + 0x1000)
+#define PLIC_MENABLE(hart) (PLIC + 0x2000 + (hart)*0x100)
#define PLIC_SENABLE(hart) (PLIC + 0x2080 + (hart)*0x100)
+#define PLIC_MPRIORITY(hart) (PLIC + 0x200000 + (hart)*0x2000)
#define PLIC_SPRIORITY(hart) (PLIC + 0x201000 + (hart)*0x2000)
+#define PLIC_MCLAIM(hart) (PLIC + 0x200004 + (hart)*0x2000)
#define PLIC_SCLAIM(hart) (PLIC + 0x201004 + (hart)*0x2000)
// the kernel expects there to be RAM
@@ -50,7 +57,7 @@
// map kernel stacks beneath the trampoline,
// each surrounded by invalid guard pages.
-#define KSTACK(p) (TRAMPOLINE - ((p)+1)* 2*PGSIZE)
+#define KSTACK(p) (TRAMPOLINE - (p)*2*PGSIZE - 3*PGSIZE)
// User memory layout.
// Address zero first:
@@ -59,6 +66,14 @@
// fixed-size stack
// expandable heap
// ...
+// USYSCALL (shared with kernel)
// TRAPFRAME (p->trapframe, used by the trampoline)
// TRAMPOLINE (the same page as in the kernel)
#define TRAPFRAME (TRAMPOLINE - PGSIZE)
+#ifdef LAB_PGTBL
+#define USYSCALL (TRAPFRAME - PGSIZE)
+
+struct usyscall {
+ int pid; // Process ID
+};
+#endif