aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/interrupts/common.s
blob: a03fb1c33d1f5581fa270b2aace5359426ba9128 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
extern generic_interrupt
global asm_generic_interrupt
global s_trap_start
global s_trap_end

section .text
align 4

s_trap_start:
    push r15
    push r14
    push r13
    push r12
    push r11
    push r10
    push r9
    push r8
    push rdi
    push rsi
    push rbp
    push rdx
    push rcx
    push rbx
    push rax

    mov rdi, rsp
    call generic_interrupt

s_trap_end:
    pop rax
    pop rbx
    pop rcx
    pop rdx
    pop rbp
    pop rsi
    pop rdi
    pop r8
    pop r9
    pop r10
    pop r11
    pop r12
    pop r13
    pop r14
    pop r15

    add rsp, 16

    iretq

asm_generic_interrupt:
    ;push 0x0 ;
    ;push 0xE ; <- need to create the individual interrupts pushing the specific values to the stack (how to pop them?)
    push r15
    push r14
    push r13
    push r12
    push r11
    push r10
    push r9
    push r8
    push rdi
    push rsi
    push rbp
    push rdx
    push rcx
    push rbx
    push rax

    ; ??
    ; cld 
    mov rdi, rsp
    call generic_interrupt
    
    pop rax
    pop rbx
    pop rcx
    pop rdx
    pop rbp
    pop rsi
    pop rdi
    pop r8
    pop r9
    pop r10
    pop r11
    pop r12
    pop r13
    pop r14
    pop r15
    ;pop
    ;pop

    add rsp, 16

    iretq