#pragma once #include 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; }; 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); extern TSS task_state_segment;