mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: add a helper to retrieve the bsp CPU
This is useful to be able to e.g. set affinity for the BSP CPU.
This commit is contained in:
@@ -124,3 +124,7 @@ void kernel_entry() {
|
||||
sched_runinit();
|
||||
sched_threadexit();
|
||||
}
|
||||
|
||||
cpu_t *_bsp(void) {
|
||||
return &bsp_cpu;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ static inline uint16_t be_to_cpu_w(uint16_t w) {
|
||||
return __builtin_bswap16(w);
|
||||
}
|
||||
|
||||
cpu_t *_bsp(void);
|
||||
|
||||
static inline cpu_t *_cpu() {
|
||||
cpu_t *cpu;
|
||||
asm volatile ("mov %%gs:0, %%rax" : "=a"(cpu) : : "memory");
|
||||
|
||||
Reference in New Issue
Block a user