aboutsummaryrefslogtreecommitdiff
path: root/src/core/gdt.S
blob: d99145eb7bf94918b61141c51d50f13c2e658b0c (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
.code64
.global gdt64_tss

gdt64:
    gdt64_null:
    .word 0xFFF
    .word 0x0
    .byte 0
    .byte 0
    .byte 1
    .byte 0
    gdt64_cs:
    .long 0
    .byte 0
    .byte 0b10011010   # Present and non-conforming Readable
    .byte 0b00100000   # Long mode
    .byte 0
    gdt64_ds:
    .long 0
    .byte 0
    .byte 0b10010010  # Present, writable
    .word 0
    gdt64_cs_user:
    .long 0
    .byte 0
    .byte 0b11111010  # Present, Privilege 3 and non-conforming Readable
    .byte 0b00100000  # Long mode
    .byte 0
    gdt64_ds_user:
    .long 0
    .byte 0
    .byte 0b11110010 # Present, Privilege 3 and writable
    .word 0
    gdt64_tss:  # Will be setup in the boucane() function
    .long 0
    .long 0
    .long 0
    .long 0
gdtr:
    .word . - gdt64 - 1
    .quad gdt64

.global load_gdt
load_gdt:
    lgdt (gdtr)
    ret