diff options
author | rsc <rsc> | 2007-08-10 16:37:27 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-10 16:37:27 +0000 |
commit | b6095304b7ee2b69d2ee4a9a7265999d1a2b9675 (patch) | |
tree | 3193df85e9fc228f512010d4bddf3aeb31e9993e /proc.h | |
parent | 3bbbaca14db70c6f255139c66a62b4cd5191462c (diff) | |
download | xv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.tar.gz xv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.tar.bz2 xv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.zip |
Make cp a magic symbol.
Diffstat (limited to 'proc.h')
-rw-r--r-- | proc.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -50,7 +50,17 @@ struct proc { // expandable heap extern struct proc proc[]; + +// If xv6 was only for uniprocessors, this could be +// struct proc *cp; +// Instead we have an array curproc, one per +// processor, and #define cp to the right element +// in the array. In general such preprocessor +// subterfuge is to be avoided, but cp is used +// so often that having the shorthand is worth the ugliness. extern struct proc *curproc[NCPU]; // Current (running) process per CPU +#define cp (curproc[cpu()]) // Current process on this CPU + #define MPSTACK 512 |