1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
18 push esi ; // DI and SI must be maintained, CX doesn't
30 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
31 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
32 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
33 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
34 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
35 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
36 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
38 ;%define SYSCALL_OP jmp 0xCFFF0000
39 %define SYSCALL_OP int 0xAC
41 ; System Call - No Arguments
53 %macro _SYSCALL_HEAD 2
61 %macro _SYSCALL_TAIL 0
68 ; System Call - 1 Argument
76 ; System Call - 2 Arguments
86 ; System Call - 3 Arguments
96 ; System Call - 4 Arguments
109 ; System Call - 5 Arguments
125 ; System Call - 6 Arguments
142 ; // Override the clone syscall
143 #define clone _clone_raw
144 #include "syscalls.s.h"
153 mov ebx, [ebp+12] ; Get new stack pointer
155 ; Check if the new stack is being used
158 ; Modify it to include the calling function (and this)
160 mov eax, [ebp] ; Get old stack frame
161 sub eax, ebp ; Get size
162 sub ebx, eax ; Alter new stack pointer
164 push DWORD [ebp] ; < Source
167 add esp, 4*3 ; Restore stack
168 ; EBX should still be the new stack pointer
169 mov eax, [ebp] ; Save old stack frame pointer in new stack
171 mov eax, [ebp-4] ; Save EBX there too
173 sub ebx, 8 ; Update stack pointer for system
175 ; Quick hack, just this stack frame
177 mov [ebx-4], eax ; Return
178 mov [ebx-8], ebx ; EBP
179 mov DWORD [ebx-12], 0 ; EBX
185 mov ebx, [ebp+8] ; Flags