diff --git a/lib/proc.c b/lib/proc.c index aa28a41..73aec31 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -2,18 +2,7 @@ struct Cpu cpus[NCPU]; -// Must be called with interrupts disabled, -// to prevent race with process being moved -// to a different CPU. -int cpuid() { - int id = r_tp(); - return id; -} - -// Return this CPU's cpu struct. -// Interrupts must be disabled. -struct Cpu *mycpu(void) { - int id = cpuid(); - struct Cpu *c = &cpus[id]; - return c; -} +/** + * Return this CPU's cpu struct. Interrupts must be disabled. + */ +inline struct Cpu *mycpu(void) { return &cpus[r_tp()]; } diff --git a/lib/proc.h b/lib/proc.h index 67749a2..1208b2b 100644 --- a/lib/proc.h +++ b/lib/proc.h @@ -3,7 +3,6 @@ #include #include -int cpuid(void); struct Cpu *mycpu(void); /** Saved registers for kernel context switches. */