Fixed bug in libc.so/brk(), fixed support for VT100 escape codes
[tpg/acess2.git] / Usermode / Libraries / libacess.so_src / syscalls.inc.asm
1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
4
5 %include "../../../Kernel/include/syscalls.inc.asm"
6
7 ; System Call - No Arguments
8 %macro SYSCALL0 2
9 [global %1:func]
10 %1:
11         push ebx
12         mov eax, %2
13         int 0xAC
14         mov [_errno], ebx
15         pop ebx
16         ret
17 %endmacro
18
19 ; System Call - 1 Argument
20 %macro SYSCALL1 2
21 [global %1:func]
22 %1:
23         push ebp
24         mov ebp, esp
25         push ebx
26         mov eax, %2
27         mov ebx, [ebp+8]
28         int 0xAC
29         mov [_errno], ebx
30         pop ebx
31         pop ebp
32         ret
33 %endmacro
34
35 ; System Call - 2 Arguments
36 %macro SYSCALL2 2
37 [global %1:func]
38 %1:
39         push ebp
40         mov ebp, esp
41         push ebx
42         mov eax, %2
43         mov ebx, [ebp+8]
44         mov ecx, [ebp+12]
45         int 0xAC
46         mov [_errno], ebx
47         pop ebx
48         pop ebp
49         ret
50 %endmacro
51
52 ; System Call - 3 Arguments
53 %macro SYSCALL3 2
54 [global %1:func]
55 %1:
56         push ebp
57         mov ebp, esp
58         push ebx
59         mov eax, %2
60         mov ebx, [ebp+8]
61         mov ecx, [ebp+12]
62         mov edx, [ebp+16]
63         int 0xAC
64         mov [_errno], ebx
65         pop ebx
66         pop ebp
67         ret
68 %endmacro
69
70 ; System Call - 4 Arguments
71 %macro SYSCALL4 2
72 [global %1:func]
73 %1:
74         push ebp
75         mov ebp, esp
76         push ebx
77         push edi
78         mov eax, %2
79         mov ebx, [ebp+8]
80         mov ecx, [ebp+12]
81         mov edx, [ebp+16]
82         mov edi, [ebp+20]
83         int 0xAC
84         mov [_errno], ebx
85         pop edi
86         pop ebx
87         pop ebp
88         ret
89 %endmacro
90
91 ; System Call - 5 Arguments
92 %macro SYSCALL5 2
93 [global %1:func]
94 %1:
95         push ebp
96         mov ebp, esp
97         push ebx
98         push edi
99         push esi
100         mov eax, %2
101         mov ebx, [ebp+8]
102         mov ecx, [ebp+12]
103         mov edx, [ebp+16]
104         mov edi, [ebp+20]
105         mov esi, [ebp+24]
106         int 0xAC
107         mov [_errno], ebx
108         pop esi
109         pop edi
110         pop ebx
111         pop ebp
112         ret
113 %endmacro
114
115 ; System Call - 6 Arguments
116 %macro SYSCALL6 2
117 [global %1:func]
118 %1:
119         push ebp
120         mov ebp, esp
121         push ebx
122         push edi
123         push esi
124         mov eax, %2
125         mov ebx, [ebp+8]
126         mov ecx, [ebp+12]
127         mov edx, [ebp+16]
128         mov edi, [ebp+20]
129         mov esi, [ebp+24]
130         mov ebp, [ebp+28]
131         int 0xAC
132         mov [_errno], ebx
133         pop esi
134         pop edi
135         pop ebx
136         pop ebp
137         ret
138 %endmacro

UCC git Repository :: git.ucc.asn.au