summaryrefslogtreecommitdiff
path: root/mp.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-07-12 11:15:38 +0000
committerrtm <rtm>2006-07-12 11:15:38 +0000
commit8148b6ee535b85e97f3b5f3a850b70fdfbbcaf2d (patch)
treeea279d5ca141449bb8f363594c57d7e8fc142db0 /mp.c
parent664324745e2257289f7a61e43892ce6e8b8ed9b7 (diff)
downloadxv6-labs-8148b6ee535b85e97f3b5f3a850b70fdfbbcaf2d.tar.gz
xv6-labs-8148b6ee535b85e97f3b5f3a850b70fdfbbcaf2d.tar.bz2
xv6-labs-8148b6ee535b85e97f3b5f3a850b70fdfbbcaf2d.zip
i think my cmpxchg use was wrong in acquire
nesting cli/sti: release shouldn't always enable interrupts separate setup of lapic from starting of other cpus, so cpu() works earlier flag to disable locking in console output make locks work even when curproc==0 (still crashes in clock interrupt)
Diffstat (limited to 'mp.c')
-rw-r--r--mp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mp.c b/mp.c
index 4258aba..068d036 100644
--- a/mp.c
+++ b/mp.c
@@ -325,8 +325,6 @@ mp_init()
struct MPCTB *mpctb;
struct MPPE *proc;
struct MPBE *bus;
- int c;
- extern int main();
int i;
ncpu = 0;
@@ -386,13 +384,20 @@ mp_init()
lapic_init(bcpu-cpus);
cprintf("ncpu: %d boot %d\n", ncpu, bcpu-cpus);
+}
+void
+mp_startthem()
+{
extern uint8_t _binary_bootother_start[], _binary_bootother_size[];
+ extern int main();
+ int c;
+
memmove((void *) APBOOTCODE,_binary_bootother_start,
(uint32_t) _binary_bootother_size);
for(c = 0; c < ncpu; c++){
- if (cpus+c == bcpu) continue;
+ if (c == cpu()) continue;
cprintf ("starting processor %d\n", c);
*(unsigned *)(APBOOTCODE-4) = (unsigned) (cpus[c].mpstack) + MPSTACK; // tell it what to use for %esp
*(unsigned *)(APBOOTCODE-8) = (unsigned)&main; // tell it where to jump to