summaryrefslogtreecommitdiff
path: root/kernel/memlayout.h
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-10 13:46:25 +0800
committerMole Shang <[email protected]>2024-02-10 13:50:34 +0800
commit3673a2cdfb30e1e3936e695a3fb8adee74488d6b (patch)
tree282b4677f47bbb15949e24b3bfa455b173a38a29 /kernel/memlayout.h
parentf379c1c4c80947365eb6c4046c3ab165629dc8cd (diff)
parentc9284cd93525436cc823258ab309c1b27eeec714 (diff)
downloadxv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.tar.gz
xv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.tar.bz2
xv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.zip
Merge branch 'pgtbl' into traps
Conflicts: .gitignore Makefile conf/lab.mk
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