Revert to legacy mycpu() and cpuid()
This commit is contained in:
parent
2aa06778b3
commit
d855404c01
1 changed files with 14 additions and 1 deletions
15
lib/proc.c
15
lib/proc.c
|
@ -2,7 +2,20 @@
|
||||||
|
|
||||||
struct Cpu cpus[NCPU];
|
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 = read_tp();
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return this CPU's cpu struct. Interrupts must be disabled.
|
* Return this CPU's cpu struct. Interrupts must be disabled.
|
||||||
*/
|
*/
|
||||||
inline struct Cpu *mycpu(void) { return &cpus[read_tp()]; }
|
struct Cpu *mycpu(void) {
|
||||||
|
int id = cpuid();
|
||||||
|
struct Cpu *c = &cpus[id];
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue