IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
tss.hpp
Go to the documentation of this file.
1
11
12
13#pragma once
14
15
16// C++
17#include <array>
18// IgrOS-Kernel arch
19#include <arch/types.hpp>
20
21
22// x86_64 namespace
23namespace igros::x86_64 {
24
25
29 class tss final {
30
31 public:
32
34 ~tss() noexcept = default;
35
37 tss(const tss &other) = delete;
39 auto operator=(const tss &other) -> tss & = delete;
40
42 enum class IST : igros_byte_t {
43 NONE = 0_u8,
44 DOUBLE_FAULT = 1_u8,
45 NMI = 2_u8,
47 };
48
50 constexpr static auto STACK_SIZE {0x4000_usize};
51
52#pragma pack(push, 1)
53
64
65#pragma pack(pop)
66
67 static_assert(104_usize == sizeof(segment_t), "TSS layout must match CPU");
68
70 tss() noexcept = delete;
71
74 [[nodiscard]]
75 static auto init() noexcept -> const segment_t &;
76 };
77
78
79} // namespace igros::x86_64
80
static auto init() noexcept -> const segment_t &
Set up task state segment interrupt stacks (returns static segment for GDT).
Definition tss.cpp:26
tss(const tss &other)=delete
Copy c-tor.
~tss() noexcept=default
D-tor.
static constexpr auto STACK_SIZE
Interrupt stack size.
Definition tss.hpp:50
IST
Interrupt stack table index (0 - no stack switch).
Definition tss.hpp:42
@ DOUBLE_FAULT
#DF: kernel stack may be broken (overflow)
Definition tss.hpp:44
@ MACHINE_CHECK
#MC: may arrive at any instruction
Definition tss.hpp:46
@ NMI
NMI: may arrive at any instruction.
Definition tss.hpp:45
tss() noexcept=delete
Default c-tor.
std::uint16_t igros_word_t
16-bit unsigned integer
Definition types.hpp:42
std::uint8_t igros_byte_t
8-bit unsigned integer
Definition types.hpp:41
std::uint32_t igros_dword_t
32-bit unsigned integer
Definition types.hpp:43
std::uint64_t igros_quad_t
64-bit unsigned integer
Definition types.hpp:44
x86_64 (long mode): GDT, IDT, TSS, CPUID, MSR, CPU registers
Task state segment layout.
Definition tss.hpp:55
igros_word_t reserved3
Reserved.
Definition tss.hpp:61
igros_dword_t reserved0
Reserved.
Definition tss.hpp:56
igros_quad_t reserved2
Reserved.
Definition tss.hpp:60
igros_word_t iomapBase
I/O permission bitmap offset.
Definition tss.hpp:62
std::array< igros_quad_t, 7 > ist
Interrupt stack table (IST1..IST7).
Definition tss.hpp:59
igros_quad_t reserved1
Reserved.
Definition tss.hpp:58
std::array< igros_quad_t, 3 > rsp
Stack for CPL change to ring 0..2.
Definition tss.hpp:57
Common C++ types redefinition.