1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
30 push esi ; // DI and SI must be maintained, CX doesn't
42 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
43 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
44 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
45 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
46 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
47 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
48 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
50 ;%define SYSCALL_OP jmp 0xCFFF0000
51 %define SYSCALL_OP int 0xAC
53 ; System Call - No Arguments
65 %macro _SYSCALL_HEAD 2
73 %macro _SYSCALL_TAIL 0
80 ; System Call - 1 Argument
88 ; System Call - 2 Arguments
98 ; System Call - 3 Arguments
108 ; System Call - 4 Arguments
121 ; System Call - 5 Arguments
137 ; System Call - 6 Arguments
154 ; // Override the clone syscall
155 #define clone _clone_raw
156 #include "syscalls.s.h"
166 mov ebx, [ebp+12] ; Get new stack pointer
168 ; Check if the new stack is being used
171 ; Modify it to include the calling function (and this)
173 mov eax, [ebp] ; Get old stack frame
174 sub eax, ebp ; Get size
175 sub ebx, eax ; Alter new stack pointer
177 push DWORD [ebp] ; < Source
180 add esp, 4*3 ; Restore stack
181 ; EBX should still be the new stack pointer
182 mov eax, [ebp] ; Save old stack frame pointer in new stack
184 mov eax, [ebp-4] ; Save EBX there too
186 sub ebx, 8 ; Update stack pointer for system
188 ; Quick hack, just this stack frame
190 mov [ebx-4], eax ; Return
191 mov [ebx-8], ebx ; EBP
192 mov DWORD [ebx-12], 0 ; EBX
196 mov edx, ebx ; Save new stack
199 mov ebx, [ebp+8] ; Flags