提交 2baa83ea 创建 作者: Frans Kaashoek's avatar Frans Kaashoek

more dead ptable code

上级 0c0ab855
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "proc.h" #include "proc.h"
#include "xv6-mtrace.h" #include "xv6-mtrace.h"
struct ptable ptables[NCPU];
struct runq runqs[NCPU]; struct runq runqs[NCPU];
int idle[NCPU]; int idle[NCPU];
static struct proc *initproc; static struct proc *initproc;
...@@ -55,7 +54,6 @@ allocproc(void) ...@@ -55,7 +54,6 @@ allocproc(void)
initcondvar(&p->cv, "proc"); initcondvar(&p->cv, "proc");
p->state = EMBRYO; p->state = EMBRYO;
// p->pid = ptable->nextpid++;
p->pid = ns_allockey(nspid); p->pid = ns_allockey(nspid);
if (ns_insert(nspid, p->pid, (void *) p) < 0) if (ns_insert(nspid, p->pid, (void *) p) < 0)
panic("allocproc: ns_insert"); panic("allocproc: ns_insert");
...@@ -468,9 +466,7 @@ scheduler(void) ...@@ -468,9 +466,7 @@ scheduler(void)
struct proc *p; struct proc *p;
int pid; int pid;
acquire(&ptable->lock); pid = ns_allockey(nspid);
pid = ptable->nextpid++;
release(&ptable->lock);
// Enabling mtrace calls in scheduler generates many mtrace_call_entrys. // Enabling mtrace calls in scheduler generates many mtrace_call_entrys.
// mtrace_call_set(1, cpunum()); // mtrace_call_set(1, cpunum());
......
...@@ -110,7 +110,6 @@ struct cpu { ...@@ -110,7 +110,6 @@ struct cpu {
// Cpu-local storage variables; see below // Cpu-local storage variables; see below
struct cpu *cpu; struct cpu *cpu;
struct proc *proc; // The currently-running process. struct proc *proc; // The currently-running process.
struct ptable *ptable; // The per-core proc table
struct kmem *kmem; // The per-core memory table struct kmem *kmem; // The per-core memory table
struct runq *runq; // The per-core runq struct runq *runq; // The per-core runq
}; };
...@@ -121,20 +120,12 @@ struct runq { ...@@ -121,20 +120,12 @@ struct runq {
STAILQ_HEAD(runlist, proc) runq; STAILQ_HEAD(runlist, proc) runq;
}; };
struct ptable {
char name[MAXNAME];
struct spinlock lock;
struct proc *runq;
int nextpid;
};
struct condtab { struct condtab {
char name[MAXNAME]; char name[MAXNAME];
struct spinlock lock; struct spinlock lock;
struct condvar condtab[NPROC]; struct condvar condtab[NPROC];
}; };
extern struct ptable ptables[NCPU];
extern struct cpu cpus[NCPU]; extern struct cpu cpus[NCPU];
extern struct runq runqs[NCPU]; extern struct runq runqs[NCPU];
extern struct condtab condtabs[NCPU]; extern struct condtab condtabs[NCPU];
...@@ -150,6 +141,5 @@ extern int ncpu; ...@@ -150,6 +141,5 @@ extern int ncpu;
// in thread libraries such as Linux pthreads. // in thread libraries such as Linux pthreads.
extern struct cpu *cpu __asm("%gs:0"); // &cpus[cpunum()] extern struct cpu *cpu __asm("%gs:0"); // &cpus[cpunum()]
extern struct proc *proc __asm("%gs:4"); // cpus[cpunum()].proc extern struct proc *proc __asm("%gs:4"); // cpus[cpunum()].proc
extern struct ptable *ptable __asm("%gs:8"); // &ptables[cpunum()] extern struct kmem *kmem __asm("%gs:8"); // &kmems[cpunum()]
extern struct kmem *kmem __asm("%gs:12"); // &kmems[cpunum()] extern struct runq *runq __asm("%gs:12"); // &runqs[cpunum()]
extern struct runq *runq __asm("%gs:16"); // &runqs[cpunum()]
...@@ -31,8 +31,8 @@ seginit(void) ...@@ -31,8 +31,8 @@ seginit(void)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
// Map cpu, curproc, ptable, kmem, runq // Map cpu, curproc, kmem, runq
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 20, 0); c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 16, 0);
lgdt(c->gdt, sizeof(c->gdt)); lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3); loadgs(SEG_KCPU << 3);
...@@ -40,7 +40,6 @@ seginit(void) ...@@ -40,7 +40,6 @@ seginit(void)
// Initialize cpu-local storage. // Initialize cpu-local storage.
cpu = c; cpu = c;
proc = 0; proc = 0;
ptable = &ptables[cpunum()];
kmem = &kmems[cpunum()]; kmem = &kmems[cpunum()];
runq = &runqs[cpunum()]; runq = &runqs[cpunum()];
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论