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-03-08 17:25:20 +00:00
|
|
|
SYSCALLS_FILES = 0x00,
|
|
|
|
SYSCALLS_MEMORY = 0x01,
|
|
|
|
SYSCALLS_PROC = 0x02,
|
|
|
|
SYSCALLS_RUNTIME_LINKER = 0x02,
|
|
|
|
SYSCALLS_COMPATABILITY = 0x02,
|
|
|
|
|
|
|
|
SYSCALLS_KERNEL = 0xFF
|
2023-02-17 14:18:12 +00:00
|
|
|
}syscall_group_E;
|
|
|
|
|
|
|
|
typedef enum {
|
2023-03-08 17:25:20 +00:00
|
|
|
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_FOLLOW = 0x0107, // Warning: nx_follow will probably be kicked out of the ABI
|
|
|
|
SYSCALL_FILES_INFO = 0x0108,
|
|
|
|
|
|
|
|
SYSCALL_MEMORY_ALLOC = 0x0201,
|
|
|
|
SYSCALL_MEMORY_FREE = 0x0202,
|
|
|
|
SYSCALL_MEMORY_LABEL = 0x0203,
|
|
|
|
SYSCALL_MEMORY_RANGE = 0x0204,
|
|
|
|
SYSCALL_MEMORY_ACCESS = 0x0205,
|
|
|
|
|
|
|
|
SYSCALL_PROCESS_CREATE = 0x0301,
|
|
|
|
SYSCALL_PROCESS_ENVFILE = 0x0302,
|
|
|
|
SYSCALL_PROCESS_START = 0x0303,
|
|
|
|
SYSCALL_PROCESS_SIGNAL = 0x0304,
|
|
|
|
|
|
|
|
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
|
2023-02-17 14:18:12 +00:00
|
|
|
} syscall_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
|