提交 93bde1e9 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Don't do mtrace stuff if not MTRACE.

上级 e2fb4373
......@@ -222,7 +222,9 @@ allocproc(void)
p->cpuid = mycpu()->id;
p->on_runq = -1;
p->cpu_pin = 0;
#if MTRACE
p->mtrace_stacks.curr = -1;
#endif
snprintf(p->lockname, sizeof(p->lockname), "cv:proc:%d", p->pid);
initlock(&p->lock, p->lockname+3);
......
......@@ -52,16 +52,17 @@ struct context {
} __attribute__((packed));
// Per-process, per-stack meta data for mtrace
#if MTRACE
#define MTRACE_NSTACKS 16
#define MTRACE_TAGSHIFT 28
#if NCPU > 16
#error Oops -- decrease MTRACE_TAGSHIFT
#endif
struct mtrace_stacks {
int curr;
unsigned long tag[MTRACE_NSTACKS];
};
#endif
enum procstate { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE };
......@@ -93,7 +94,9 @@ struct proc {
char lockname[16];
int on_runq;
int cpu_pin;
#if MTRACE
struct mtrace_stacks mtrace_stacks;
#endif
};
extern struct ns *nspid;
......@@ -63,9 +63,11 @@ trap(struct trapframe *tf)
return;
}
#if MTRACE
if (myproc()->mtrace_stacks.curr >= 0)
mtrace_kstack_pause(myproc());
mtrace_kstack_start(trap, myproc());
#endif
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
......@@ -113,9 +115,11 @@ trap(struct trapframe *tf)
if(tf->trapno == T_PGFLT){
if(pagefault(myproc()->vmap, rcr2(), tf->err) >= 0){
#if MTRACE
mtrace_kstack_stop(myproc());
if (myproc()->mtrace_stacks.curr >= 0)
mtrace_kstack_resume(myproc());
#endif
return;
}
}
......@@ -143,9 +147,11 @@ trap(struct trapframe *tf)
if(myproc() && myproc()->killed && (tf->cs&3) == 0x3)
exit();
#if MTRACE
mtrace_kstack_stop(myproc());
if (myproc()->mtrace_stacks.curr >= 0)
mtrace_kstack_resume(myproc());
#endif
}
void
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论