1 ; ========================
2 ; AcssMicro - System Calls
3 ; ========================
5 %include "../../../Kernel/include/syscalls.inc.asm"
18 mov rcx, rdx ; RDX - Third
24 [global _errno:data 4]
25 _errno: dw 0 ; Placed in .text, to allow use of relative addressing
27 #define SYSCALL0(_name,_num) SYSCALL0 _name, _num
28 #define SYSCALL1(_name,_num) SYSCALL1 _name, _num
29 #define SYSCALL2(_name,_num) SYSCALL2 _name, _num
30 #define SYSCALL3(_name,_num) SYSCALL3 _name, _num
31 #define SYSCALL4(_name,_num) SYSCALL4 _name, _num
32 #define SYSCALL5(_name,_num) SYSCALL5 _name, _num
33 #define SYSCALL6(_name,_num) SYSCALL6 _name, _num
35 ;%define SYSCALL_OP jmp 0xCFFF0000
36 ;%define SYSCALL_OP int 0xAC
37 %define SYSCALL_OP syscall
39 ; System Call - No Arguments
46 mov [DWORD rel _errno], ebx
51 %macro _SYSCALL_HEAD 2
59 %macro _SYSCALL_TAIL 0
60 mov [DWORD rel _errno], ebx
66 ; System Call - 1 Argument
74 ; System Call - 2 Arguments
83 ; System Call - 3 Arguments
93 ; System Call - 4 Arguments
99 mov r10, rcx ; r10 is used in place of RCX
104 ; System Call - 5 Arguments
116 ; System Call - 6 Arguments
129 ; // Override the clone syscall
130 #define clone _clone_raw
131 #include "syscalls.s.h"
140 ; Check if the new stack is being used
143 ; Quick hack, just this stack frame
145 mov [rsi-1*8], rax ; Return
146 mov [rsi-2*8], rsi ; EBP
147 and QWORD [rsi-3*8], BYTE 0 ; EBX
152 mov rsi, [rbp+2*8] ; Flags
154 mov [rel _errno], ebx