diff options
author | rtm <rtm> | 2006-08-10 22:08:14 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-08-10 22:08:14 +0000 |
commit | 5be0039ce9e22f140a29e167526c64c723c5be3c (patch) | |
tree | 4096ed2b728cbee37dd2adee06e83f0e908f72b6 /main.c | |
parent | 8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3 (diff) | |
download | xv6-labs-5be0039ce9e22f140a29e167526c64c723c5be3c.tar.gz xv6-labs-5be0039ce9e22f140a29e167526c64c723c5be3c.tar.bz2 xv6-labs-5be0039ce9e22f140a29e167526c64c723c5be3c.zip |
interrupts could be recursive since lapic_eoi() called before rti
so fast interrupts overflow the kernel stack
fix: cli() before lapic_eoi()
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -15,8 +15,6 @@ extern uchar _binary_user1_start[], _binary_user1_size[]; extern uchar _binary_usertests_start[], _binary_usertests_size[]; extern uchar _binary_userfs_start[], _binary_userfs_size[]; -extern int use_console_lock; - // CPU 0 starts running C code here. // This is called main0 not main so that it can have // a void return type. Gcc can't handle functions named @@ -27,28 +25,36 @@ main0(void) int i; struct proc *p; + lcr4(0); // xxx copy of cpu # + // clear BSS memset(edata, 0, end - edata); // Make sure interrupts stay disabled on all processors // until each signals it is ready, by pretending to hold // an extra lock. - for(i=0; i<NCPU; i++) + // xxx maybe replace w/ acquire remembering if FL_IF + for(i=0; i<NCPU; i++){ cpus[i].nlock++; + cpus[i].guard1 = 0xdeadbeef; + cpus[i].guard2 = 0xdeadbeef; + } mp_init(); // collect info about this machine - use_console_lock = 1; - lapic_init(mp_bcpu()); cprintf("\n\ncpu%d: booting xv6\n\n", cpu()); + pinit(); + binit(); pic_init(); // initialize PIC ioapic_init(); kinit(); // physical memory allocator tvinit(); // trap vectors idtinit(); // this CPU's idt register + fd_init(); + iinit(); // create a fake process per CPU // so each CPU always has a tss and a gdt @@ -101,6 +107,8 @@ main0(void) void mpmain(void) { + lcr4(1); // xxx copy of cpu # + cprintf("cpu%d: starting\n", cpu()); idtinit(); // CPU's idt if(cpu() == 0) |