1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
17 add esp, 4 ; // Base address
26 push esi ; // DI and SI must be maintained, CX doesn't
38 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
39 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
40 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
41 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
42 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
43 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
44 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
46 ;%define SYSCALL_OP jmp 0xCFFF0000
47 %define SYSCALL_OP int 0xAC
49 ; System Call - No Arguments
61 %macro _SYSCALL_HEAD 2
69 %macro _SYSCALL_TAIL 0
76 ; System Call - 1 Argument
84 ; System Call - 2 Arguments
94 ; System Call - 3 Arguments
104 ; System Call - 4 Arguments
117 ; System Call - 5 Arguments
133 ; System Call - 6 Arguments
150 ; // Override the clone syscall
151 #define clone _clone_raw
152 #include "syscalls.s.h"
162 mov ebx, [ebp+12] ; Get new stack pointer
164 ; Check if the new stack is being used
167 ; Modify it to include the calling function (and this)
169 mov eax, [ebp] ; Get old stack frame
170 sub eax, ebp ; Get size
171 sub ebx, eax ; Alter new stack pointer
173 push DWORD [ebp] ; < Source
176 add esp, 4*3 ; Restore stack
177 ; EBX should still be the new stack pointer
178 mov eax, [ebp] ; Save old stack frame pointer in new stack
180 mov eax, [ebp-4] ; Save EBX there too
182 sub ebx, 8 ; Update stack pointer for system
184 ; Quick hack, just this stack frame
186 mov [ebx-4], eax ; Return
187 mov [ebx-8], ebx ; EBP
188 mov DWORD [ebx-12], 0 ; EBX
192 mov edx, ebx ; Save new stack
195 mov ebx, [ebp+8] ; Flags