kernel: string.h, gdt, msr, cpu and ist

This commit is contained in:
Matheus
2023-04-08 17:17:03 -03:00
parent f78650f42e
commit 320cc13d75
7 changed files with 214 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#ifndef _CPU_H
#define _CPU_H
#include <stddef.h>
#include <stdint.h>
#include <arch/msr.h>
#include <arch/ist.h>
typedef struct {
uint64_t gdt[7];
ist_t ist;
int lapicid;
} cpu_t;
static inline cpu_t *_cpu() {
return (cpu_t *)rdmsr(MSR_GSBASE);
}
static inline void cpu_set(cpu_t *ptr) {
wrmsr(MSR_GSBASE, (uint64_t)ptr);
}
#endif