IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
cr.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// x86 namespace
21namespace igros::x86 {
22
23
25 enum class CR0 : igros_usize_t {
26 PE = 0x00000001,
27 MP = 0x00000002,
28 EM = 0x00000004,
29 TS = 0x00000008,
30 ET = 0x00000010,
31 NE = 0x00000020,
32 WP = 0x00010000,
33 AM = 0x00040000,
34 NW = 0x20000000,
35 CD = 0x40000000,
36 PG = 0x80000000,
37 };
38
39
40} // namespace igros::x86
41
42
43#ifdef __cplusplus
44
45extern "C" {
46
47#endif // __cplusplus
48
49
52 [[nodiscard]]
53 auto readCR0() noexcept -> igros::igros_usize_t;
56 [[nodiscard]]
57 auto readCR2() noexcept -> igros::igros_usize_t;
60 [[nodiscard]]
61 auto readCR3() noexcept -> igros::igros_usize_t;
64 [[nodiscard]]
65 auto readCR4() noexcept -> igros::igros_usize_t;
66
69 void writeCR0(const igros::igros_usize_t value) noexcept;
72 void writeCR3(const igros::igros_usize_t value) noexcept;
75 void writeCR4(const igros::igros_usize_t value) noexcept;
76
79 void pageInvalidate(const void* const page) noexcept;
80
81
82#ifdef __cplusplus
83
84} // extern "C"
85
86#endif // __cplusplus
87
void pageInvalidate(const void *const page) noexcept
Invalidate TLB entry of page.
auto readCR2() noexcept -> igros::igros_usize_t
Read CR2 register.
auto readCR0() noexcept -> igros::igros_usize_t
Read CR0 register.
auto readCR3() noexcept -> igros::igros_usize_t
Read CR3 register.
void writeCR4(const igros::igros_usize_t value) noexcept
Write CR4 register.
void writeCR3(const igros::igros_usize_t value) noexcept
Write CR3 register.
void writeCR0(const igros::igros_usize_t value) noexcept
Write CR0 register.
auto readCR4() noexcept -> igros::igros_usize_t
Read CR4 register.
std::size_t igros_usize_t
Unsigned size.
Definition types.hpp:51
Code shared by i386 and x86_64: ports, interrupts, exceptions, paging.
CR0
CR0 register bits.
Definition cr.hpp:25
@ AM
Alignment mask.
Definition cr.hpp:33
@ PE
Protected mode enable.
Definition cr.hpp:26
@ CD
Cache disable.
Definition cr.hpp:35
@ PG
Paging enable.
Definition cr.hpp:36
@ TS
Task switched.
Definition cr.hpp:29
@ NW
Not write-through.
Definition cr.hpp:34
@ WP
Write protect (kernel can't write to read-only pages).
Definition cr.hpp:32
@ ET
Extension type.
Definition cr.hpp:30
@ EM
x87 emulation
Definition cr.hpp:28
@ MP
Monitor coprocessor.
Definition cr.hpp:27
@ NE
Native x87 errors.
Definition cr.hpp:31
IgrOS kernel: common types and literals.
Common C++ types redefinition.