2 ; Acess2 System Interface
4 %include "syscalls.inc.asm"
8 [global _errno:data (4)]
19 push esi ; DI and SI must be maintained, CX doesn't
31 ; --- Process Control ---
32 SYSCALL1 _exit, SYS_EXIT
35 SYSCALL2 clone, SYS_CLONE
43 mov ebx, [ebp+12] ; Get new stack pointer
45 ; Check if the new stack is being used
48 ; Modify it to include the calling function (and this)
50 mov eax, [ebp] ; Get old stack frame
51 sub eax, ebp ; Get size
52 sub ebx, eax ; Alter new stack pointer
54 push DWORD [ebp] ; < Source
57 add esp, 4*3 ; Restore stack
58 ; EBX should still be the new stack pointer
59 mov eax, [ebp] ; Save old stack frame pointer in new stack
61 mov eax, [ebp-4] ; Save EBX there too
63 sub ebx, 8 ; Update stack pointer for system
65 ; Quick hack, just this stack frame
67 mov [ebx-4], eax ; Return
68 mov [ebx-8], ebx ; EBP
69 mov DWORD [ebx-12], 0 ; EBX
75 mov ebx, [ebp+8] ; Flags
83 SYSCALL2 kill, SYS_KILL
84 SYSCALL0 yield, SYS_YIELD
85 SYSCALL0 sleep, SYS_SLEEP
86 SYSCALL2 waittid, SYS_WAITTID
88 SYSCALL0 gettid, SYS_GETTID
89 SYSCALL0 getpid, SYS_GETPID
90 SYSCALL0 getuid, SYS_GETUID
91 SYSCALL0 getgid, SYS_GETGID
93 SYSCALL1 setuid, SYS_SETUID
94 SYSCALL1 setgid, SYS_SETGID
96 SYSCALL1 SysSetName, SYS_SETNAME
97 SYSCALL2 SysGetName, SYS_GETNAME
99 SYSCALL1 SysSetPri, SYS_SETPRI
101 SYSCALL3 SysSendMessage, SYS_SENDMSG
102 SYSCALL3 SysGetMessage, SYS_GETMSG
104 SYSCALL3 SysSpawn, SYS_SPAWN
105 SYSCALL3 execve, SYS_EXECVE
106 SYSCALL2 SysLoadBin, SYS_LOADBIN
107 SYSCALL1 SysUnloadBin, SYS_UNLOADBIN
109 SYSCALL1 _SysSetFaultHandler, SYS_SETFAULTHANDLER
111 SYSCALL6 _SysDebug, 0x100