1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
17 add esp, 4 ; // Base address
27 push esi ; // DI and SI must be maintained, CX doesn't
39 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
40 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
41 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
42 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
43 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
44 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
45 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
47 ;%define SYSCALL_OP jmp 0xCFFF0000
48 %define SYSCALL_OP int 0xAC
50 ; System Call - No Arguments
62 %macro _SYSCALL_HEAD 2
70 %macro _SYSCALL_TAIL 0
77 ; System Call - 1 Argument
85 ; System Call - 2 Arguments
95 ; System Call - 3 Arguments
105 ; System Call - 4 Arguments
118 ; System Call - 5 Arguments
134 ; System Call - 6 Arguments
151 ; // Override the clone syscall
152 #define clone _clone_raw
153 #include "syscalls.s.h"
163 mov ebx, [ebp+12] ; Get new stack pointer
165 ; Check if the new stack is being used
168 ; Modify it to include the calling function (and this)
170 mov eax, [ebp] ; Get old stack frame
171 sub eax, ebp ; Get size
172 sub ebx, eax ; Alter new stack pointer
174 push DWORD [ebp] ; < Source
177 add esp, 4*3 ; Restore stack
178 ; EBX should still be the new stack pointer
179 mov eax, [ebp] ; Save old stack frame pointer in new stack
181 mov eax, [ebp-4] ; Save EBX there too
183 sub ebx, 8 ; Update stack pointer for system
185 ; Quick hack, just this stack frame
187 mov [ebx-4], eax ; Return
188 mov [ebx-8], ebx ; EBP
189 mov DWORD [ebx-12], 0 ; EBX
193 mov edx, ebx ; Save new stack
196 mov ebx, [ebp+8] ; Flags