summaryrefslogtreecommitdiff
path: root/proc.h
diff options
context:
space:
mode:
authorrsc <rsc>2007-09-27 20:29:50 +0000
committerrsc <rsc>2007-09-27 20:29:50 +0000
commitce2e7515552adca3a60e349de2931112736d17bf (patch)
tree4398d7aee836b939db83afa1f0c9f8e6bb1afb1f /proc.h
parentaefc13f8ba13475fa721d6da837db5e368ee1b0a (diff)
downloadxv6-labs-ce2e7515552adca3a60e349de2931112736d17bf.tar.gz
xv6-labs-ce2e7515552adca3a60e349de2931112736d17bf.tar.bz2
xv6-labs-ce2e7515552adca3a60e349de2931112736d17bf.zip
test: store curproc at top of stack
I don't actually think this is worthwhile, but I figured I would check it in before reverting it, so that it can be in the revision history. Pros: * curproc doesn't need to turn on/off interrupts * scheduler doesn't have to edit curproc anymore Cons: * it's ugly * all the stack computation is more complicated. * it doesn't actually simplify anything but curproc, and even curproc is harder to follow.
Diffstat (limited to 'proc.h')
-rw-r--r--proc.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/proc.h b/proc.h
index 2063baa..a2abb82 100644
--- a/proc.h
+++ b/proc.h
@@ -46,6 +46,10 @@ struct proc {
char name[16]; // Process name (debugging)
};
+// The word at kstack + KSTACKTOP is a pointer to the struct proc.
+#define KSTACKTOP (KSTACKSIZE-4)
+
+
// Process memory is laid out contiguously, low addresses first:
// text
// original data and bss
@@ -55,7 +59,6 @@ struct proc {
// Per-CPU state
struct cpu {
uchar apicid; // Local APIC ID
- struct proc *curproc; // Process currently running.
struct context context; // Switch here to enter scheduler
struct taskstate ts; // Used by x86 to find stack for interrupt
struct segdesc gdt[NSEGS]; // x86 global descriptor table