KernOS
gdt.h
Go to the documentation of this file.
1
//
2
// Created on 5/20/20.
3
//
4
5
#ifndef KERNOS_GDT_H
6
#define KERNOS_GDT_H
7
10
namespace
GDT
11
{
12
const
uint8_t
GDT_ENTRIES
= 5;
13
16
enum
Segment
: uint16_t
17
{
18
Null
= 0,
19
K_CS
,
20
K_DS
,
21
U_CS
,
22
U_DS
,
23
};
24
29
inline
constexpr uint8_t
SEG_OFFSET
(
const
Segment
Seg)
30
{
31
return
(((Seg) << 3) & 0xFF);
// each gdt entry is 8 bytes
32
}
33
}
34
35
namespace
INIT
36
{
37
void
gdt
();
38
}
39
40
#endif //KERNOS_GDT_H
INIT::gdt
void gdt()
creates global descriptor table and loads it into CPU
Definition:
gdt.cpp:172
GDT::U_CS
user code segment
Definition:
gdt.h:21
GDT
global descriptor table
Definition:
gdt.h:10
GDT::Null
null descriptor
Definition:
gdt.h:18
GDT::U_DS
user data segment
Definition:
gdt.h:22
INIT
contains all kernel initialization routines
Definition:
cpu.h:10
GDT::K_DS
kernel data segment
Definition:
gdt.h:20
GDT::GDT_ENTRIES
const uint8_t GDT_ENTRIES
Definition:
gdt.h:12
GDT::SEG_OFFSET
constexpr uint8_t SEG_OFFSET(const Segment Seg)
Translates code segment enum to code segment selector.
Definition:
gdt.h:29
GDT::Segment
Segment
Code segments.
Definition:
gdt.h:16
GDT::K_CS
kernel code segment
Definition:
gdt.h:19
OS
include
gdt.h
Generated by
1.8.13