Revert to legacy mycpu() and cpuid()

This commit is contained in:
Imbus 2025-06-26 13:51:06 +02:00
parent 2aa06778b3
commit d855404c01

View file

@ -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;
}