summaryrefslogtreecommitdiff
path: root/kernel/memlayout.h
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-16 10:20:27 +0800
committerMole Shang <[email protected]>2024-02-16 10:20:27 +0800
commita98c56a811142e5ede3332a7a444cca45f628769 (patch)
treec93ff7090da7b6ef911932be283818c2f6a03784 /kernel/memlayout.h
parent0d65be5d1d880afafbf08c2adb605cf9f72216e2 (diff)
parent99015f3a985b2fd051606636743a2a2969b216e8 (diff)
downloadxv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.gz
xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.bz2
xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.zip
Merge branch 'lock' into thread
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