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
|
global int_syscall_handler
[extern example_syscall]
[extern example_syscall_2]
[extern syscall_write]
[extern syscall_read]
[bits 32]
int_syscall_handler:
cli
push ebx
push ecx
push edx
cmp eax, 10
je call_example_syscall
cmp eax, 20
je call_example_syscall_2
cmp eax, 61
je call_write
cmp eax, 62
je call_read
done:
mov ebx,eax
mov al, 0x20 ;Port number AND command number to Acknowledge IRQ
out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts
mov eax,ebx
nop
done_blocking:
pop ebx
pop ecx
pop edx
mov ebx,eax
sti
iret ;Interrupt-Return
call_example_syscall:
call example_syscall
jmp done
call_example_syscall_2:
call example_syscall_2
jmp done
call_write:
call syscall_write
jmp done
call_read:
mov al, 0x20 ;Port number AND command number to Acknowledge IRQ
out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts
sti
call syscall_read
jmp done_blocking
|