Luna/kernel/src/arch/x86_64/CPU.h

50 lines
761 B
C
Raw Normal View History

2022-12-07 13:48:08 +00:00
#pragma once
#include <luna/Types.h>
2022-11-16 16:37:18 +00:00
struct Registers // Saved CPU registers for x86-64
{
u64 r15, r14, r13, r12, r11, r10, r9, r8;
u64 rbp, rdi, rsi, rdx, rcx, rbx, rax;
u64 isr;
union {
u64 error;
u64 irq;
};
2022-11-16 16:37:18 +00:00
u64 rip, cs, rflags, rsp, ss;
};
struct FPData
{
void save();
void restore();
void* data()
{
return (void*)m_data;
}
usize size() const
{
return 512;
}
private:
char m_data[512] alignas(16);
bool m_already_saved;
};
struct [[gnu::packed]] TSS
{
u32 reserved0;
u64 rsp[3];
u64 reserved1;
u64 ist[7];
u64 reserved2;
u16 reserved3;
u16 iomap_base;
};
static_assert(sizeof(TSS) == 104UL);
2023-01-02 12:07:29 +00:00
extern TSS task_state_segment;