proc.c: Simplify mycpu(), remove cpuid() for now as it is only a front for r_tp()
This commit is contained in:
parent
697a84b370
commit
be50854251
2 changed files with 4 additions and 16 deletions
19
lib/proc.c
19
lib/proc.c
|
@ -2,18 +2,7 @@
|
||||||
|
|
||||||
struct Cpu cpus[NCPU];
|
struct Cpu cpus[NCPU];
|
||||||
|
|
||||||
// Must be called with interrupts disabled,
|
/**
|
||||||
// to prevent race with process being moved
|
* Return this CPU's cpu struct. Interrupts must be disabled.
|
||||||
// to a different CPU.
|
*/
|
||||||
int cpuid() {
|
inline struct Cpu *mycpu(void) { return &cpus[r_tp()]; }
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <riscv.h>
|
#include <riscv.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
int cpuid(void);
|
|
||||||
struct Cpu *mycpu(void);
|
struct Cpu *mycpu(void);
|
||||||
|
|
||||||
/** Saved registers for kernel context switches. */
|
/** Saved registers for kernel context switches. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue