Files
Astral/kernel-src/include/x86-64/arch/cpu.h
T
2023-05-01 14:14:26 -03:00

40 lines
676 B
C

#ifndef _CPU_H
#define _CPU_H
#include <stddef.h>
#include <stdint.h>
#include <arch/msr.h>
#include <arch/ist.h>
#include <kernel/interrupt.h>
#include <kernel/vmm.h>
#include <kernel/timer.h>
#include <kernel/scheduler.h>
typedef struct cpu_t {
uint64_t gdt[7];
ist_t ist;
long id;
isr_t isr[MAX_ISR_COUNT];
vmmcontext_t *vmmctx;
int acpiid;
timer_t *timer;
bool intstatus;
long ipl;
thread_t *thread;
thread_t *idlethread;
timerentry_t schedtimerentry;
} cpu_t;
#define CPU_HALT() asm volatile("hlt")
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