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// IgrOS-Kernel arch
17#include <arch/types.hpp>
18
19
20// i386 namespace
21namespace igros::i386 {
22
23
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 constexpr static auto STACK_SIZE {0x4000_usize};
43
44#pragma pack(push, 1)
45
76
77#pragma pack(pop)
78
79 static_assert(104_usize == sizeof(segment_t), "TSS layout must match CPU");
80
82 tss() noexcept = delete;
83
87 static void init(const igros_word_t codeSelector, const igros_word_t dataSelector) noexcept;
88
91 [[nodiscard]]
92 static auto kernel() noexcept -> segment_t &;
95 [[nodiscard]]
96 static auto doubleFault() noexcept -> segment_t &;
97 };
98
99
100} // namespace igros::i386
101
static void init(const igros_word_t codeSelector, const igros_word_t dataSelector) noexcept
Set up task state segments (double fault task uses current page directory).
Definition tss.cpp:96
tss() noexcept=delete
Default c-tor.
static constexpr auto STACK_SIZE
Double fault task stack size.
Definition tss.hpp:42
static auto doubleFault() noexcept -> segment_t &
Double fault task state segment.
Definition tss.cpp:122
tss(const tss &other)=delete
Copy c-tor.
static auto kernel() noexcept -> segment_t &
Kernel task state segment.
Definition tss.cpp:116
~tss() noexcept=default
D-tor.
std::uint16_t igros_word_t
16-bit unsigned integer
Definition types.hpp:42
std::uint32_t igros_dword_t
32-bit unsigned integer
Definition types.hpp:43
i386 (32-bit protected mode): GDT, IDT, TSS, CPU registers
Task state segment layout (segment registers in low 16 bits).
Definition tss.hpp:47
igros_dword_t ebp
Stack base pointer.
Definition tss.hpp:63
igros_dword_t esp0
Stack for CPL change to ring 0.
Definition tss.hpp:49
igros_dword_t es
Extra segment.
Definition tss.hpp:66
igros_dword_t esp
Stack pointer.
Definition tss.hpp:62
igros_dword_t ds
Data segment.
Definition tss.hpp:69
igros_dword_t ldt
LDT selector.
Definition tss.hpp:72
igros_dword_t eax
Accumulator register.
Definition tss.hpp:58
igros_dword_t esp2
Stack for CPL change to ring 2.
Definition tss.hpp:53
igros_dword_t esp1
Stack for CPL change to ring 1.
Definition tss.hpp:51
igros_dword_t gs
Extra segment 3.
Definition tss.hpp:71
igros_word_t iomapBase
I/O permission bitmap offset.
Definition tss.hpp:74
igros_dword_t eflags
Flags register.
Definition tss.hpp:57
igros_dword_t fs
Extra segment 2.
Definition tss.hpp:70
igros_dword_t cs
Code segment.
Definition tss.hpp:67
igros_dword_t esi
Source index register.
Definition tss.hpp:64
igros_word_t trap
Debug trap on task switch.
Definition tss.hpp:73
igros_dword_t eip
Instruction pointer.
Definition tss.hpp:56
igros_dword_t cr3
Page directory.
Definition tss.hpp:55
igros_dword_t ss
Stack segment.
Definition tss.hpp:68
igros_dword_t ecx
Counter register.
Definition tss.hpp:59
igros_dword_t ss1
Stack segment for CPL change to ring 1.
Definition tss.hpp:52
igros_dword_t link
Previous task selector.
Definition tss.hpp:48
igros_dword_t ebx
Base register.
Definition tss.hpp:61
igros_dword_t ss2
Stack segment for CPL change to ring 2.
Definition tss.hpp:54
igros_dword_t edi
Destination index register.
Definition tss.hpp:65
igros_dword_t ss0
Stack segment for CPL change to ring 0.
Definition tss.hpp:50
igros_dword_t edx
Data register.
Definition tss.hpp:60
Common C++ types redefinition.