diff options
author | rtm <rtm> | 2006-08-08 19:58:06 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-08-08 19:58:06 +0000 |
commit | 0e84a0ec6e7893dad13dff9a958c5bc987b79c82 (patch) | |
tree | 5739d0a2af8277db7a47c74e52975d9e9d81cef7 /proc.c | |
parent | e8d11c2e846ad15b32caacc8a919722b76d00f79 (diff) | |
download | xv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.tar.gz xv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.tar.bz2 xv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.zip |
fix race in holding() check in acquire()
give cpu1 a TSS and gdt for when it enters scheduler()
and a pseudo proc[] entry for each cpu
cpu0 waits for each other cpu to start up
read() for files
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -11,7 +11,7 @@ struct spinlock proc_table_lock = { "proc_table" }; struct proc proc[NPROC]; struct proc *curproc[NCPU]; -int next_pid = 1; +int next_pid = NCPU; extern void forkret(void); extern void forkret1(struct trapframe*); @@ -31,7 +31,7 @@ setupsegs(struct proc *p) // XXX it may be wrong to modify the current segment table! p->gdt[0] = SEG_NULL; - p->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); + p->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024, 0); // xxx p->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); p->gdt[SEG_TSS] = SEG16(STS_T32A, (uint) &p->ts, sizeof(p->ts), 0); @@ -134,8 +134,8 @@ scheduler(void) struct proc *p; int i; - cprintf("start scheduler on cpu %d jmpbuf %p\n", cpu(), &cpus[cpu()].jmpbuf); - cpus[cpu()].lastproc = &proc[0]; + cprintf("cpu%d: start scheduler jmpbuf %p\n", + cpu(), &cpus[cpu()].jmpbuf); if(cpus[cpu()].nlock != 0){ cprintf("la %x lr %x\n", cpus[cpu()].lastacquire, cpus[cpu()].lastrelease ); @@ -190,6 +190,8 @@ scheduler(void) panic("scheduler lock"); } + setupsegs(&proc[cpu()]); + // XXX if not holding proc_table_lock panic. } release(&proc_table_lock); |