kernel: implement cpu IDs and per-cpu variables

This commit is contained in:
2023-03-18 19:35:00 +00:00
parent 56bc47f570
commit 57eaf4e01c
14 changed files with 232 additions and 18 deletions

View File

@@ -4,11 +4,16 @@
#include <arch/gdt.h>
#include <arch/irq.h>
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
typedef struct ml_cpu_block {
struct ml_cpu_block *c_this;
struct gdt c_gdt;
struct gdt_ptr c_gdt_ptr;
struct idt_ptr c_idt_ptr;
unsigned int c_cpu_id;
} ml_cpu_block;
extern int ml_init_bootcpu(void);
@@ -18,5 +23,6 @@ extern int ml_cpu_block_use(ml_cpu_block *p);
/* defined in cpu_ctrl.S */
extern void ml_halt_cpu(void);
extern ml_cpu_block *ml_this_cpu(void);
#endif