diff options
author | rtm <rtm> | 2006-07-12 11:15:38 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-07-12 11:15:38 +0000 |
commit | 8148b6ee535b85e97f3b5f3a850b70fdfbbcaf2d (patch) | |
tree | ea279d5ca141449bb8f363594c57d7e8fc142db0 /main.c | |
parent | 664324745e2257289f7a61e43892ce6e8b8ed9b7 (diff) | |
download | xv6-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 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -8,6 +8,7 @@ #include "syscall.h" #include "elf.h" #include "param.h" +#include "spinlock.h" extern char edata[], end[]; extern int acpu; @@ -15,23 +16,33 @@ extern char _binary_user1_start[], _binary_user1_size[]; extern char _binary_usertests_start[], _binary_usertests_size[]; extern char _binary_userfs_start[], _binary_userfs_size[]; +extern use_printf_lock; + int main() { struct proc *p; if (acpu) { + cpus[cpu()].clis = 1; cprintf("an application processor\n"); idtinit(); // CPU's idt lapic_init(cpu()); lapic_timerinit(); lapic_enableintr(); + sti(); scheduler(); } acpu = 1; + // clear BSS memset(edata, 0, end - edata); + mp_init(); // just set up apic so cpu() works + use_printf_lock = 1; + + cpus[cpu()].clis = 1; // cpu starts as if we had called cli() + cprintf("\nxV6\n\n"); pic_init(); // initialize PIC @@ -56,7 +67,7 @@ main() p->ppid = 0; setupsegs(p); - mp_init(); // multiprocessor + mp_startthem(); // turn on timer and enable interrupts on the local APIC lapic_timerinit(); |