kernel/inc/platform/syscall.h

66 lines
2.1 KiB
C

// This file is part of noxos and licensed under the MIT open source license
#ifndef NOX_SYSCALL_H
#define NOX_SYSCALL_H
#include "platform/cpu.h"
#include "utils/status.h"
typedef enum {
SYSCALLS_FILES = 0x01,
SYSCALLS_MEMORY = 0x02,
SYSCALLS_PROC = 0x03,
SYSCALLS_RUNTIME_LINKER = 0x04,
SYSCALLS_COMPATABILITY = 0x05,
SYSCALLS_KERNEL = 0xFF
}syscall_group_E;
typedef enum {
SYSCALL_FILES_OPEN = 0x0101,
SYSCALL_FILES_CLOSE = 0x0102,
SYSCALL_FILES_READ = 0x0103,
SYSCALL_FILES_WRITE = 0x0104,
SYSCALL_FILES_DELETE = 0x0105,
SYSCALL_FILES_LIST = 0x0106,
SYSCALL_FILES_INFO = 0x0107,
SYSCALL_MEMORY_MAP = 0x0201,
SYSCALL_MEMORY_UNMAP = 0x0202,
SYSCALL_MEMORY_LABEL = 0x0203,
SYSCALL_MEMORY_RANGE = 0x0204,
SYSCALL_MEMORY_ACCESS = 0x0205,
SYSCALL_PROCESS_CREATE = 0x0301,
SYSCALL_PROCESS_ENV = 0x0302,
SYSCALL_PROCESS_SIGNAL = 0x0303,
SYSCALL_PROCESS_THREAD_CREATE = 0x0304,
SYSCALL_PROCESS_THREAD_START = 0x0305,
SYSCALL_PROCESS_THREAD_PAUSE = 0x0306,
SYSCALL_PROCESS_THREAD_KILL = 0x0307,
SYSCALL_RUNTIME_LINKER_OPEN = 0x0401,
SYSCALL_RUNTIME_LINKER_CLOSE = 0x0402,
SYSCALL_RUNTIME_LINKER_LOAD_SYMBOL = 0x0403,
SYSCALL_RUNTIME_LINKER_STATUS = 0x0404,
SYSCALL_RUNTIME_LINKER_STANDARD_MOD = 0x0405,
SYSCALL_COMPATABILITY_ABI_TYPE = 0x0501,
SYSCALL_COMPATABILITY_ABI_VERSION = 0x0502,
SYSCALL_COMPATABILITY_ACTION = 0x0503,
SYSCALL_KERNEL_SCHEDULER_START = 0xFF00,
SYSCALL_KERNEL_PANIC = 0xFF01
} syscall_E;
typedef enum {
SYSCALL_NX_MMAP_FLAG_WRITE,
SYSCALL_NX_MMAP_FLAG_NO_EXEC
} syscall_nx_mmap_flags_E;
extern status_E syscall_perform(syscall_E id, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4);
cpu_state_T* syscall_handle(cpu_state_T* state);
#endif //NOX_SYSCALL_H