a few new syscalls, init process
This commit is contained in:
1 parent
320a24e1a5
commit
cdf7ed4cea
12 files changed
+830
-480
No files matched your search
+110
-96
@@ -1,96 +1,110 @@
|
||||
; syscall_nr.inc - assembled from syscall_nr.h for use in .asm files
|
||||
; Keep in sync with syscall_nr.h and ke_syscall.c.
|
||||
|
||||
; Process & Thread
|
||||
SYS_EXIT_PROCESS EQU 0
|
||||
SYS_EXIT_THREAD EQU 1
|
||||
SYS_CREATE_THREAD EQU 2
|
||||
SYS_GET_CURRENT_TID EQU 3
|
||||
SYS_GET_CURRENT_PID EQU 4
|
||||
SYS_YIELD EQU 5
|
||||
SYS_SLEEP EQU 6
|
||||
SYS_SET_THREAD_PRIORITY EQU 7
|
||||
|
||||
; Memory
|
||||
SYS_ALLOC EQU 8
|
||||
SYS_FREE EQU 9
|
||||
SYS_REALLOC EQU 10
|
||||
|
||||
; Mutex
|
||||
SYS_MUTEX_CREATE EQU 11
|
||||
SYS_MUTEX_ACQUIRE EQU 12
|
||||
SYS_MUTEX_TRY_ACQUIRE EQU 13
|
||||
SYS_MUTEX_RELEASE EQU 14
|
||||
|
||||
; Semaphore
|
||||
SYS_SEM_CREATE EQU 15
|
||||
SYS_SEM_WAIT EQU 16
|
||||
SYS_SEM_TRY_WAIT EQU 17
|
||||
SYS_SEM_SIGNAL EQU 18
|
||||
|
||||
; Event
|
||||
SYS_EVENT_CREATE EQU 19
|
||||
SYS_EVENT_SIGNAL EQU 20
|
||||
SYS_EVENT_CLEAR EQU 21
|
||||
SYS_EVENT_WAIT EQU 22
|
||||
|
||||
; Queue
|
||||
SYS_QUEUE_CREATE EQU 23
|
||||
SYS_QUEUE_SEND EQU 24
|
||||
SYS_QUEUE_RECV EQU 25
|
||||
|
||||
; Handle (unified - one close for every object type)
|
||||
SYS_CLOSE_HANDLE EQU 26
|
||||
|
||||
; File I/O
|
||||
SYS_OPEN_FILE EQU 27
|
||||
SYS_READ_FILE EQU 28
|
||||
SYS_SEEK_FILE EQU 29
|
||||
SYS_GET_FILE_SIZE EQU 30
|
||||
SYS_WRITE_FILE EQU 43 ; a0=handle a1=buf a2=size a3=*bytesWritten
|
||||
SYS_CREATE_FILE EQU 44 ; a0=*path a1=*handleOut
|
||||
SYS_DELETE_FILE EQU 45 ; a0=*path
|
||||
SYS_TRUNCATE_FILE EQU 46 ; a0=handle a1=newSize
|
||||
SYS_GET_FILE_POS EQU 47 ; a0=handle -> current offset
|
||||
|
||||
; Screen
|
||||
SYS_SCREEN_BLIT EQU 31
|
||||
SYS_SCREEN_CLEAR EQU 32
|
||||
SYS_SCREEN_GET_SIZE EQU 33
|
||||
SYS_SCREEN_PUT_CHAR EQU 34
|
||||
|
||||
; Keyboard
|
||||
SYS_KB_POLL EQU 35
|
||||
SYS_KB_READ_CHAR EQU 36
|
||||
SYS_KB_READ_SCANCODE EQU 37
|
||||
|
||||
; Timer
|
||||
SYS_GET_TICK EQU 38
|
||||
|
||||
; Debug
|
||||
SYS_DEBUG_PRINT EQU 39
|
||||
|
||||
; Process launch & lifecycle
|
||||
SYS_CREATE_PROCESS EQU 40
|
||||
SYS_WAIT_FOR_PROCESS EQU 41
|
||||
SYS_GET_PROCESS_EXIT_CODE EQU 42
|
||||
|
||||
; Console output
|
||||
SYS_WRITE_CONSOLE EQU 48
|
||||
|
||||
; Directory enumeration
|
||||
SYS_OPEN_DIR EQU 49
|
||||
SYS_READ_DIR EQU 50
|
||||
|
||||
; Current Working Directory
|
||||
SYS_SET_CWD EQU 51
|
||||
SYS_GET_CWD EQU 52
|
||||
|
||||
; Thread join
|
||||
SYS_WAIT_THREAD EQU 53 ; a0=tid -> KSTATUS
|
||||
|
||||
; Process PID query
|
||||
SYS_GET_PROCESS_PID EQU 54 ; a0=procHandle a1=*pidOut -> KSTATUS
|
||||
|
||||
; Sentinel
|
||||
SYS_MAX EQU 55
|
||||
; syscall_nr.inc - assembled from syscall_nr.h for use in .asm files
|
||||
; Keep in sync with syscall_nr.h and ke_syscall.c.
|
||||
|
||||
; Process & Thread
|
||||
SYS_EXIT_PROCESS EQU 0
|
||||
SYS_EXIT_THREAD EQU 1
|
||||
SYS_CREATE_THREAD EQU 2
|
||||
SYS_GET_CURRENT_TID EQU 3
|
||||
SYS_GET_CURRENT_PID EQU 4
|
||||
SYS_YIELD EQU 5
|
||||
SYS_SLEEP EQU 6
|
||||
SYS_SET_THREAD_PRIORITY EQU 7
|
||||
|
||||
; Memory
|
||||
SYS_ALLOC EQU 8
|
||||
SYS_FREE EQU 9
|
||||
SYS_REALLOC EQU 10
|
||||
|
||||
; Mutex
|
||||
SYS_MUTEX_CREATE EQU 11
|
||||
SYS_MUTEX_ACQUIRE EQU 12
|
||||
SYS_MUTEX_TRY_ACQUIRE EQU 13
|
||||
SYS_MUTEX_RELEASE EQU 14
|
||||
|
||||
; Semaphore
|
||||
SYS_SEM_CREATE EQU 15
|
||||
SYS_SEM_WAIT EQU 16
|
||||
SYS_SEM_TRY_WAIT EQU 17
|
||||
SYS_SEM_SIGNAL EQU 18
|
||||
|
||||
; Event
|
||||
SYS_EVENT_CREATE EQU 19
|
||||
SYS_EVENT_SIGNAL EQU 20
|
||||
SYS_EVENT_CLEAR EQU 21
|
||||
SYS_EVENT_WAIT EQU 22
|
||||
|
||||
; Queue
|
||||
SYS_QUEUE_CREATE EQU 23
|
||||
SYS_QUEUE_SEND EQU 24
|
||||
SYS_QUEUE_RECV EQU 25
|
||||
|
||||
; Handle (unified - one close for every object type)
|
||||
SYS_CLOSE_HANDLE EQU 26
|
||||
|
||||
; File I/O
|
||||
SYS_OPEN_FILE EQU 27
|
||||
SYS_READ_FILE EQU 28
|
||||
SYS_SEEK_FILE EQU 29
|
||||
SYS_GET_FILE_SIZE EQU 30
|
||||
SYS_WRITE_FILE EQU 31 ; handle, buf, size, *bytesWritten
|
||||
SYS_CREATE_FILE EQU 32 ; *path, *handleOut
|
||||
SYS_DELETE_FILE EQU 33 ; *path
|
||||
SYS_TRUNCATE_FILE EQU 34 ; handle, newSize
|
||||
SYS_GET_FILE_POS EQU 35 ; handle -> current offset
|
||||
|
||||
; Screen
|
||||
SYS_SCREEN_BLIT EQU 36
|
||||
SYS_SCREEN_CLEAR EQU 37
|
||||
SYS_SCREEN_GET_SIZE EQU 38
|
||||
SYS_SCREEN_PUT_CHAR EQU 39
|
||||
|
||||
; Keyboard
|
||||
SYS_KB_POLL EQU 40
|
||||
SYS_KB_READ_CHAR EQU 41
|
||||
SYS_KB_READ_SCANCODE EQU 42
|
||||
SYS_KB_GET_MODIFIERS EQU 43
|
||||
|
||||
; Mouse
|
||||
SYS_MOUSE_POLL EQU 44
|
||||
SYS_MOUSE_READ EQU 45
|
||||
SYS_MOUSE_GET_POS EQU 46
|
||||
|
||||
; Timer
|
||||
SYS_GET_TICK EQU 47
|
||||
|
||||
; Debug
|
||||
SYS_DEBUG_PRINT EQU 48
|
||||
|
||||
; Process launch & lifecycle
|
||||
SYS_CREATE_PROCESS EQU 49
|
||||
SYS_WAIT_FOR_PROCESS EQU 50
|
||||
SYS_GET_PROCESS_EXIT_CODE EQU 51
|
||||
|
||||
; Console output
|
||||
SYS_WRITE_CONSOLE EQU 52
|
||||
|
||||
; Directory enumeration
|
||||
SYS_OPEN_DIR EQU 53
|
||||
SYS_READ_DIR EQU 54
|
||||
|
||||
; Current Working Directory
|
||||
SYS_SET_CWD EQU 55
|
||||
SYS_GET_CWD EQU 56
|
||||
|
||||
; Thread join
|
||||
SYS_WAIT_THREAD EQU 57 ; a0=tid -> KSTATUS
|
||||
|
||||
; Process PID query
|
||||
SYS_GET_PROCESS_PID EQU 58 ; a0=procHandle a1=*pidOut -> KSTATUS
|
||||
|
||||
; Named Queue Registry
|
||||
SYS_PUBLISH_QUEUE EQU 59 ; a0=*name a1=queueHandle -> KSTATUS
|
||||
SYS_OPEN_NAMED_QUEUE EQU 60 ; a0=*name a1=*handleOut -> KSTATUS
|
||||
|
||||
; Handle duplication
|
||||
SYS_QUEUE_DUPLICATE EQU 61 ; a0=handle a1=targetPid a2=*handleOut -> KSTATUS
|
||||
SYS_NAMED_QUEUE_OWNER_PID EQU 62 ; a0=*name a1=*pidOut -> KSTATUS
|
||||
|
||||
; Sentinel
|
||||
SYS_MAX EQU 63
|
||||
+201
-179
@@ -1,179 +1,201 @@
|
||||
; syscall_stubs.asm - user-mode INT 0x40 stubs exported by syscall.dll (MASM64)
|
||||
;
|
||||
; Calling convention (kernel side):
|
||||
; RAX = syscall number
|
||||
; RCX = arg 0
|
||||
; RDX = arg 1
|
||||
; R8 = arg 2
|
||||
; R9 = arg 3
|
||||
; R10 = arg 4 (our extension - loaded from the stack by SYSCALL_STUB6)
|
||||
; R11 = arg 5 (our extension - loaded from the stack by SYSCALL_STUB6)
|
||||
;
|
||||
; User-mode callers follow standard MS x64: args 1-4 in RCX/RDX/R8/R9,
|
||||
; args 5+ on the stack above the home area ([rsp+28h], [rsp+30h], ...).
|
||||
;
|
||||
; SYSCALL_STUB2 - 4 or fewer args: pure register passing, no stack read.
|
||||
; SYSCALL_STUB6 - 5 or 6 args: loads [rsp+28h] -> R10 and [rsp+30h] -> R11.
|
||||
;
|
||||
; Handle lifecycle:
|
||||
; SysCloseHandle is the single close stub for every object type.
|
||||
; There is no SysCloseFile - files are closed through the unified path,
|
||||
; exactly like mutexes, semaphores, events, and queues.
|
||||
|
||||
INCLUDE syscall_nr.inc
|
||||
|
||||
.CODE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 MACRO name, nr
|
||||
PUBLIC Sys&name
|
||||
Sys&name PROC EXPORT
|
||||
mov rax, nr
|
||||
int 40h
|
||||
ret
|
||||
Sys&name ENDP
|
||||
ENDM
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB6 MACRO name, nr
|
||||
PUBLIC Sys&name
|
||||
Sys&name PROC EXPORT
|
||||
mov r10, [rsp+28h] ; 5th argument
|
||||
mov r11, [rsp+30h] ; 6th argument
|
||||
mov rax, nr
|
||||
int 40h
|
||||
ret
|
||||
Sys&name ENDP
|
||||
ENDM
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process & Thread
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 ExitProcess, SYS_EXIT_PROCESS
|
||||
SYSCALL_STUB2 ExitThread, SYS_EXIT_THREAD
|
||||
SYSCALL_STUB2 CreateThread, SYS_CREATE_THREAD
|
||||
SYSCALL_STUB2 GetCurrentTid, SYS_GET_CURRENT_TID
|
||||
SYSCALL_STUB2 GetCurrentPid, SYS_GET_CURRENT_PID
|
||||
SYSCALL_STUB2 Yield, SYS_YIELD
|
||||
SYSCALL_STUB2 Sleep, SYS_SLEEP
|
||||
SYSCALL_STUB2 SetThreadPriority, SYS_SET_THREAD_PRIORITY
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Memory
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 Alloc, SYS_ALLOC
|
||||
SYSCALL_STUB2 Free, SYS_FREE
|
||||
SYSCALL_STUB2 Realloc, SYS_REALLOC
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Mutex
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 MutexCreate, SYS_MUTEX_CREATE
|
||||
SYSCALL_STUB2 MutexAcquire, SYS_MUTEX_ACQUIRE
|
||||
SYSCALL_STUB2 MutexTryAcquire, SYS_MUTEX_TRY_ACQUIRE
|
||||
SYSCALL_STUB2 MutexRelease, SYS_MUTEX_RELEASE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Semaphore
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 SemCreate, SYS_SEM_CREATE
|
||||
SYSCALL_STUB2 SemWait, SYS_SEM_WAIT
|
||||
SYSCALL_STUB2 SemTryWait, SYS_SEM_TRY_WAIT
|
||||
SYSCALL_STUB2 SemSignal, SYS_SEM_SIGNAL
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Event
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 EventCreate, SYS_EVENT_CREATE
|
||||
SYSCALL_STUB2 EventSignal, SYS_EVENT_SIGNAL
|
||||
SYSCALL_STUB2 EventClear, SYS_EVENT_CLEAR
|
||||
SYSCALL_STUB2 EventWait, SYS_EVENT_WAIT
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Queue
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 QueueCreate, SYS_QUEUE_CREATE
|
||||
SYSCALL_STUB2 QueueSend, SYS_QUEUE_SEND
|
||||
SYSCALL_STUB2 QueueRecv, SYS_QUEUE_RECV
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Handle (unified - use for files, mutexes, semaphores, events, queues)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 CloseHandle, SYS_CLOSE_HANDLE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; File I/O
|
||||
; (To close: SysCloseHandle(handle) - no dedicated SysCloseFile)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 OpenFile, SYS_OPEN_FILE
|
||||
SYSCALL_STUB2 ReadFile, SYS_READ_FILE
|
||||
SYSCALL_STUB2 SeekFile, SYS_SEEK_FILE
|
||||
SYSCALL_STUB2 GetFileSize, SYS_GET_FILE_SIZE
|
||||
SYSCALL_STUB2 WriteFile, SYS_WRITE_FILE ; handle, buf, size, *bytesWritten
|
||||
SYSCALL_STUB2 CreateFile, SYS_CREATE_FILE ; *path, *handleOut
|
||||
SYSCALL_STUB2 DeleteFile, SYS_DELETE_FILE ; *path
|
||||
SYSCALL_STUB2 TruncateFile, SYS_TRUNCATE_FILE ; handle, newSize
|
||||
SYSCALL_STUB2 GetFilePos, SYS_GET_FILE_POS ; handle -> offset
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Screen
|
||||
; SysScreenBlit has 5 args (x, y, w, h, pixels) - needs SYSCALL_STUB6.
|
||||
; SysScreenPutChar has 5 args (c, x, y, fg, bg) - needs SYSCALL_STUB6.
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB6 ScreenBlit, SYS_SCREEN_BLIT
|
||||
SYSCALL_STUB2 ScreenClear, SYS_SCREEN_CLEAR
|
||||
SYSCALL_STUB2 ScreenGetSize, SYS_SCREEN_GET_SIZE
|
||||
SYSCALL_STUB6 ScreenPutChar, SYS_SCREEN_PUT_CHAR
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Keyboard
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 KbPoll, SYS_KB_POLL
|
||||
SYSCALL_STUB2 KbReadChar, SYS_KB_READ_CHAR
|
||||
SYSCALL_STUB2 KbReadScancode, SYS_KB_READ_SCANCODE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Timer
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 GetTick, SYS_GET_TICK
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Debug
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 DebugPrint, SYS_DEBUG_PRINT
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process launch & lifecycle
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 CreateProcess, SYS_CREATE_PROCESS
|
||||
SYSCALL_STUB2 WaitForProcess, SYS_WAIT_FOR_PROCESS
|
||||
SYSCALL_STUB2 GetProcessExitCode, SYS_GET_PROCESS_EXIT_CODE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Console output (white text, for user programs)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 WriteConsole, SYS_WRITE_CONSOLE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Directory enumeration
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 OpenDir, SYS_OPEN_DIR
|
||||
SYSCALL_STUB2 ReadDir, SYS_READ_DIR
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Current Working Directory
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 SetCwd, SYS_SET_CWD
|
||||
SYSCALL_STUB2 GetCwd, SYS_GET_CWD
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Thread join (used by pthread_join in posix.dll)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 WaitThread, SYS_WAIT_THREAD ; a0=tid -> KSTATUS
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process PID query (used by posix_spawn -> waitpid in posix.dll)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 GetProcessPid, SYS_GET_PROCESS_PID ; a0=procHandle a1=*pidOut -> KSTATUS
|
||||
|
||||
END
|
||||
; syscall_stubs.asm - user-mode INT 0x40 stubs exported by syscall.dll (MASM64)
|
||||
;
|
||||
; Calling convention (kernel side):
|
||||
; RAX = syscall number
|
||||
; RCX = arg 0
|
||||
; RDX = arg 1
|
||||
; R8 = arg 2
|
||||
; R9 = arg 3
|
||||
; R10 = arg 4 (our extension - loaded from the stack by SYSCALL_STUB6)
|
||||
; R11 = arg 5 (our extension - loaded from the stack by SYSCALL_STUB6)
|
||||
;
|
||||
; User-mode callers follow standard MS x64: args 1-4 in RCX/RDX/R8/R9,
|
||||
; args 5+ on the stack above the home area ([rsp+28h], [rsp+30h], ...).
|
||||
;
|
||||
; SYSCALL_STUB2 - 4 or fewer args: pure register passing, no stack read.
|
||||
; SYSCALL_STUB6 - 5 or 6 args: loads [rsp+28h] -> R10 and [rsp+30h] -> R11.
|
||||
;
|
||||
; Handle lifecycle:
|
||||
; SysCloseHandle is the single close stub for every object type.
|
||||
; There is no SysCloseFile - files are closed through the unified path,
|
||||
; exactly like mutexes, semaphores, events, and queues.
|
||||
|
||||
INCLUDE syscall_nr.inc
|
||||
|
||||
.CODE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 MACRO name, nr
|
||||
PUBLIC Sys&name
|
||||
Sys&name PROC EXPORT
|
||||
mov rax, nr
|
||||
int 40h
|
||||
ret
|
||||
Sys&name ENDP
|
||||
ENDM
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB6 MACRO name, nr
|
||||
PUBLIC Sys&name
|
||||
Sys&name PROC EXPORT
|
||||
mov r10, [rsp+28h] ; 5th argument
|
||||
mov r11, [rsp+30h] ; 6th argument
|
||||
mov rax, nr
|
||||
int 40h
|
||||
ret
|
||||
Sys&name ENDP
|
||||
ENDM
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process & Thread
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 ExitProcess, SYS_EXIT_PROCESS
|
||||
SYSCALL_STUB2 ExitThread, SYS_EXIT_THREAD
|
||||
SYSCALL_STUB2 CreateThread, SYS_CREATE_THREAD
|
||||
SYSCALL_STUB2 GetCurrentTid, SYS_GET_CURRENT_TID
|
||||
SYSCALL_STUB2 GetCurrentPid, SYS_GET_CURRENT_PID
|
||||
SYSCALL_STUB2 Yield, SYS_YIELD
|
||||
SYSCALL_STUB2 Sleep, SYS_SLEEP
|
||||
SYSCALL_STUB2 SetThreadPriority, SYS_SET_THREAD_PRIORITY
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Memory
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 Alloc, SYS_ALLOC
|
||||
SYSCALL_STUB2 Free, SYS_FREE
|
||||
SYSCALL_STUB2 Realloc, SYS_REALLOC
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Mutex
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 MutexCreate, SYS_MUTEX_CREATE
|
||||
SYSCALL_STUB2 MutexAcquire, SYS_MUTEX_ACQUIRE
|
||||
SYSCALL_STUB2 MutexTryAcquire, SYS_MUTEX_TRY_ACQUIRE
|
||||
SYSCALL_STUB2 MutexRelease, SYS_MUTEX_RELEASE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Semaphore
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 SemCreate, SYS_SEM_CREATE
|
||||
SYSCALL_STUB2 SemWait, SYS_SEM_WAIT
|
||||
SYSCALL_STUB2 SemTryWait, SYS_SEM_TRY_WAIT
|
||||
SYSCALL_STUB2 SemSignal, SYS_SEM_SIGNAL
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Event
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 EventCreate, SYS_EVENT_CREATE
|
||||
SYSCALL_STUB2 EventSignal, SYS_EVENT_SIGNAL
|
||||
SYSCALL_STUB2 EventClear, SYS_EVENT_CLEAR
|
||||
SYSCALL_STUB2 EventWait, SYS_EVENT_WAIT
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Queue
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 QueueCreate, SYS_QUEUE_CREATE
|
||||
SYSCALL_STUB2 QueueSend, SYS_QUEUE_SEND
|
||||
SYSCALL_STUB2 QueueRecv, SYS_QUEUE_RECV
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Handle (unified - use for files, mutexes, semaphores, events, queues)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 CloseHandle, SYS_CLOSE_HANDLE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; File I/O
|
||||
; (To close: SysCloseHandle(handle) - no dedicated SysCloseFile)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 OpenFile, SYS_OPEN_FILE
|
||||
SYSCALL_STUB2 ReadFile, SYS_READ_FILE
|
||||
SYSCALL_STUB2 SeekFile, SYS_SEEK_FILE
|
||||
SYSCALL_STUB2 GetFileSize, SYS_GET_FILE_SIZE
|
||||
SYSCALL_STUB2 WriteFile, SYS_WRITE_FILE
|
||||
SYSCALL_STUB2 CreateFile, SYS_CREATE_FILE
|
||||
SYSCALL_STUB2 DeleteFile, SYS_DELETE_FILE
|
||||
SYSCALL_STUB2 TruncateFile, SYS_TRUNCATE_FILE
|
||||
SYSCALL_STUB2 GetFilePos, SYS_GET_FILE_POS
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Screen
|
||||
; SysScreenBlit has 5 args (x, y, w, h, pixels) - needs SYSCALL_STUB6.
|
||||
; SysScreenPutChar has 5 args (c, x, y, fg, bg) - needs SYSCALL_STUB6.
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB6 ScreenBlit, SYS_SCREEN_BLIT
|
||||
SYSCALL_STUB2 ScreenClear, SYS_SCREEN_CLEAR
|
||||
SYSCALL_STUB2 ScreenGetSize, SYS_SCREEN_GET_SIZE
|
||||
SYSCALL_STUB6 ScreenPutChar, SYS_SCREEN_PUT_CHAR
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Keyboard
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 KbPoll, SYS_KB_POLL
|
||||
SYSCALL_STUB2 KbReadChar, SYS_KB_READ_CHAR
|
||||
SYSCALL_STUB2 KbReadScancode, SYS_KB_READ_SCANCODE
|
||||
SYSCALL_STUB2 KbGetModifiers, SYS_KB_GET_MODIFIERS
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Mouse
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 MousePoll, SYS_MOUSE_POLL
|
||||
SYSCALL_STUB2 MouseRead, SYS_MOUSE_READ
|
||||
SYSCALL_STUB2 MouseGetPos, SYS_MOUSE_GET_POS
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Timer
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 GetTick, SYS_GET_TICK
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Debug
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 DebugPrint, SYS_DEBUG_PRINT
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process launch & lifecycle
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 CreateProcess, SYS_CREATE_PROCESS
|
||||
SYSCALL_STUB2 WaitForProcess, SYS_WAIT_FOR_PROCESS
|
||||
SYSCALL_STUB2 GetProcessExitCode, SYS_GET_PROCESS_EXIT_CODE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Console output (white text, for user programs)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 WriteConsole, SYS_WRITE_CONSOLE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Directory enumeration
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 OpenDir, SYS_OPEN_DIR
|
||||
SYSCALL_STUB2 ReadDir, SYS_READ_DIR
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Current Working Directory
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 SetCwd, SYS_SET_CWD
|
||||
SYSCALL_STUB2 GetCwd, SYS_GET_CWD
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Thread join (used by pthread_join in posix.dll)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 WaitThread, SYS_WAIT_THREAD
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Process PID query (used by posix_spawn -> waitpid in posix.dll)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 GetProcessPid, SYS_GET_PROCESS_PID
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Named Queue Registry
|
||||
; SysPublishQueue - register a queue under a name (call once at startup)
|
||||
; SysOpenNamedQueue - resolve a name to a handle (retry until SUCCESS)
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 PublishQueue, SYS_PUBLISH_QUEUE
|
||||
SYSCALL_STUB2 OpenNamedQueue, SYS_OPEN_NAMED_QUEUE
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Handle duplication
|
||||
; ---------------------------------------------------------------------------
|
||||
SYSCALL_STUB2 QueueDuplicate, SYS_QUEUE_DUPLICATE
|
||||
SYSCALL_STUB2 NamedQueueOwnerPid, SYS_NAMED_QUEUE_OWNER_PID
|
||||
|
||||
END
|
||||
Reference in new issue
Block a user