aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/interrupts/idt.asm
blob: f30ead1fb898a276aca1c733d4a6fa28bc90a227 (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
31
32
33
34
35
36
37
38
39
40
41
; IDT loader
global idt_load
extern idtp
idt_load:
    lidt [idtp]
    ret

global idt_syscall
extern syscall_handler
idt_syscall:
    push ds
    push es
    push fs
    push gs
    pushad

    push ecx
    push edx
    push esi
    push edi
    push eax

    mov ax, 0x10
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax

    call syscall_handler

    lea ebx, [5 * 4]
    add esp, ebx

    mov dword [esp + (7*4)], eax

    popad
    pop gs
    pop fs
    pop es
    pop ds
    iret