2023-03-10 10:32:50 +00:00
|
|
|
// This file is part of noxos and licensed under the MIT open source license
|
2023-02-17 14:18:12 +00:00
|
|
|
|
|
|
|
#ifndef NOX_SYSCALL_H
|
|
|
|
#define NOX_SYSCALL_H
|
|
|
|
|
|
|
|
#include "platform/cpu.h"
|
2023-03-08 17:25:20 +00:00
|
|
|
#include "utils/status.h"
|
2023-02-17 14:18:12 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2023-06-06 19:20:29 +00:00
|
|
|
SYSCALLS_FILES = 0x00,
|
|
|
|
SYSCALLS_MEMORY = 0x01,
|
|
|
|
SYSCALLS_PROC = 0x02,
|
|
|
|
SYSCALLS_DRIVERS = 0x03,
|
2023-03-08 17:25:20 +00:00
|
|
|
|
|
|
|
SYSCALLS_KERNEL = 0xFF
|
2023-02-17 14:18:12 +00:00
|
|
|
}syscall_group_E;
|
|
|
|
|
|
|
|
typedef enum {
|
2023-06-06 19:20:29 +00:00
|
|
|
SYSCALL_NX_FS_OPEN = 0x0001,
|
|
|
|
SYSCALL_NX_FS_CLOSE = 0x0002,
|
|
|
|
SYSCALL_NX_FS_READ = 0x0003,
|
|
|
|
SYSCALL_NX_FS_WRITE = 0x0004,
|
|
|
|
SYSCALL_NX_FS_DELETE = 0x0005,
|
|
|
|
SYSCALL_NX_FS_LIST = 0x0006,
|
|
|
|
SYSCALL_NX_FS_INFO = 0x0007,
|
|
|
|
|
|
|
|
SYSCALL_NX_MEM_ALLOC = 0x0101,
|
|
|
|
SYSCALL_NX_MEM_FREE = 0x0102,
|
|
|
|
SYSCALL_NX_MEM_LABEL = 0x0103,
|
|
|
|
SYSCALL_NX_MEM_UNLABEL = 0x0104,
|
|
|
|
|
|
|
|
SYSCALL_NX_PROC_CREATE = 0x0201,
|
|
|
|
SYSCALL_NX_PROC_SIGNAL_SEND = 0x0202,
|
|
|
|
SYSCALL_NX_PROC_SIGNAL_SET_HANDLER = 0x0203,
|
|
|
|
SYSCALL_NX_PROC_THREAD_CREATE = 0x0204,
|
|
|
|
SYSCALL_NX_PROC_THREAD_START = 0x0205,
|
|
|
|
SYSCALL_NX_PROC_THREAD_PAUSE = 0x0206,
|
|
|
|
SYSCALL_NX_PROC_THREAD_KILL = 0x0207,
|
|
|
|
|
|
|
|
SYSCALL_NX_DRV_REGISTER = 0x0301,
|
|
|
|
|
|
|
|
SYSCALL_NX_KERNEL_SCHEDULER_START = 0xFF00,
|
|
|
|
SYSCALL_NX_KERNEL_PANIC = 0xFF01
|
2023-02-17 14:18:12 +00:00
|
|
|
} syscall_E;
|
|
|
|
|
2023-04-20 16:53:01 +00:00
|
|
|
typedef enum {
|
|
|
|
SYSCALL_NX_MMAP_FLAG_WRITE,
|
|
|
|
SYSCALL_NX_MMAP_FLAG_NO_EXEC
|
|
|
|
} syscall_nx_mmap_flags_E;
|
|
|
|
|
2023-03-08 17:25:20 +00:00
|
|
|
extern status_E syscall_perform(syscall_E id, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4);
|
2023-02-17 14:18:12 +00:00
|
|
|
|
|
|
|
cpu_state_T* syscall_handle(cpu_state_T* state);
|
|
|
|
|
|
|
|
#endif //NOX_SYSCALL_H
|