-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdt.h
executable file
·55 lines (40 loc) · 1.16 KB
/
gdt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _KERNEL_GDT_H
#define _KERNEL_GDT_H
#include <stdint.h>
#include "utils.h"
namespace mOS
{
class GlobalDescriptorTable
{
public:
class SegmentDescriptor
{
public:
SegmentDescriptor(uint32_t base, uint32_t limit, uint8_t type);
~SegmentDescriptor() = default;
NON_COPYABLE(SegmentDescriptor);
uint32_t getBase();
uint32_t getLimit();
private:
uint16_t limitLow;
uint16_t baseLow;
uint8_t baseHigh;
uint8_t type;
uint8_t flagsLimitHigh;
uint8_t baseVhi;
} __attribute__((packed));
/// Default const
GlobalDescriptorTable();
/// Default dest
~GlobalDescriptorTable() = default;
NON_COPYABLE(GlobalDescriptorTable);
uint16_t getCodeSegmentSelector() const;
uint16_t getDataSegmentSelector() const;
private:
SegmentDescriptor nullSegmentSelector;
SegmentDescriptor unusedSegmentSelector;
SegmentDescriptor codeSegmentSelector;
SegmentDescriptor dataSegmentSelector;
};
} // mOS
#endif