Files
my-os-project2/kernel/hal/x86_64/cpu.h

37 lines
776 B
C

#ifndef HAL_CPU_H_
#define HAL_CPU_H_
#include <stdint.h>
#include "compiler/attr.h"
#include "vmm.h"
#include "intr.h"
#define HAL_CPUS_MAX 0xff
#define HAL_CPU_EFER 0xC0000080
#define HAL_CPU_STAR 0xC0000081
#define HAL_CPU_LSTAR 0xC0000082
#define HAL_CPU_CSTAR 0xC0000083
#define HAL_CPU_SFMASK 0xC0000084
#define HAL_CPU_FSBASE 0xC0000100
#define HAL_CPU_GSBASE 0xC0000101
#define HAL_CPU_KGSBASE 0xC0000102
typedef struct {
uint64_t *syscall_kstack;
uint64_t *syscall_ustack;
PgTable *kcr3;
PgTable *pcr3;
IntrStackFrame *frame;
} PACKED LocalCpuData;
uint64_t hal_cpu_rdmsr(uint32_t id);
uint64_t hal_cpu_wrmsr(uint32_t id, uint64_t val);
void hal_cpu_init(uint32_t cpu);
extern LocalCpuData HAL_CPUS[HAL_CPUS_MAX];
#endif // HAL_CPU_H_