blob: f6caa3ddda6c09b2eaa214f8e38a6419991bab18 (
plain)
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 __GDT__
#define __GDT__
#include "../Helpers/types.hpp"
//Define GDT pointer
struct gdtPointerStruct{
u16 size;
u32 segment;
} __attribute__ ((packed));
//Define GDT descriptor
struct gdtDescriptorStruct{
u16 limit1;
u16 base1;
u8 base2;
u8 access;
u8 limit2 : 4;
u8 flags : 4;
u8 base3;
} __attribute__ ((packed));
//Typedef :
typedef struct gdtPointerStruct gdtPointerStruct;
typedef struct gdtDescriptorStruct gdtDescriptorStruct;
//Gdt class
class Gdt{
private:
//Data members
gdtDescriptorStruct m_Descriptors[4];
gdtPointerStruct m_Pointer;
//Methods
void initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStruct *Descriptor);
public:
//Constructor
Gdt();
//Destructor
~Gdt();
//Methods
void loadGdt();
};
#endif
|