about summary refs log tree commit diff stats
path: root/kernel.soso/gdt.asm
blob: 54c01cfa6b0c215b8d8b968baeb9174355abb0aa (plain) (blame)
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
[GLOBAL flushGdt]

flushGdt:
    mov eax, [esp+4] ;[esp+4] is the parametered passed
    lgdt [eax]

    mov ax, 0x10  ;0x10 is the offset to our data segment
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax
    mov ss, ax
    jmp 0x08:.flush ;0x08 is the offset to our code segment
.flush:
    ret

[GLOBAL flushIdt]

flushIdt:
    mov eax, [esp+4] ;[esp+4] is the parametered passed
    lidt [eax]
    ret

[GLOBAL flushTss]

flushTss:
    mov ax, 0x2B ;index of the TSS structure is 0x28 (5*8) and OR'ing two bits in order to set RPL 3 and we get 0x2B

    ltr ax
    ret