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"
165 mov ebx, [ebp+12] ; Get new stack pointer
167 ; Check if the new stack is being used
170 ; Modify it to include the calling function (and this)
172 mov eax, [ebp] ; Get old stack frame
173 sub eax, ebp ; Get size
174 sub ebx, eax ; Alter new stack pointer
176 push DWORD [ebp] ; < Source
179 add esp, 4*3 ; Restore stack
180 ; EBX should still be the new stack pointer
181 mov eax, [ebp] ; Save old stack frame pointer in new stack
183 mov eax, [ebp-4] ; Save EBX there too
185 sub ebx, 8 ; Update stack pointer for system
187 ; Quick hack, just this stack frame
189 mov [ebx-4], eax ; Return
190 mov [ebx-8], ebx ; EBP
191 mov DWORD [ebx-12], 0 ; EBX
197 mov ebx, [ebp+8] ; Flags