1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
19 push esi ; // DI and SI must be maintained, CX doesn't
31 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
32 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
33 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
34 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
35 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
36 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
37 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
39 ;%define SYSCALL_OP jmp 0xCFFF0000
40 %define SYSCALL_OP int 0xAC
42 ; System Call - No Arguments
54 %macro _SYSCALL_HEAD 2
62 %macro _SYSCALL_TAIL 0
69 ; System Call - 1 Argument
77 ; System Call - 2 Arguments
87 ; System Call - 3 Arguments
97 ; System Call - 4 Arguments
110 ; System Call - 5 Arguments
126 ; System Call - 6 Arguments
143 ; // Override the clone syscall
144 #define clone _clone_raw
145 #include "syscalls.s.h"
154 mov ebx, [ebp+12] ; Get new stack pointer
156 ; Check if the new stack is being used
159 ; Modify it to include the calling function (and this)
161 mov eax, [ebp] ; Get old stack frame
162 sub eax, ebp ; Get size
163 sub ebx, eax ; Alter new stack pointer
165 push DWORD [ebp] ; < Source
168 add esp, 4*3 ; Restore stack
169 ; EBX should still be the new stack pointer
170 mov eax, [ebp] ; Save old stack frame pointer in new stack
172 mov eax, [ebp-4] ; Save EBX there too
174 sub ebx, 8 ; Update stack pointer for system
176 ; Quick hack, just this stack frame
178 mov [ebx-4], eax ; Return
179 mov [ebx-8], ebx ; EBP
180 mov DWORD [ebx-12], 0 ; EBX
186 mov ebx, [ebp+8] ; Flags