Adding usermode tree
[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

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