72 lines
2.5 KiB
C++
72 lines
2.5 KiB
C++
#pragma once
|
|
#include "interrupts/Context.h"
|
|
#include <stddef.h>
|
|
#include <sys/types.h>
|
|
|
|
#define SYS_exit 0
|
|
#define SYS_yield 1
|
|
#define SYS_sleep 2
|
|
#define SYS_write 3
|
|
#define SYS_getprocid 4
|
|
#define SYS_mmap 5
|
|
#define SYS_munmap 6
|
|
#define SYS_open 7
|
|
#define SYS_read 8
|
|
#define SYS_close 9
|
|
#define SYS_seek 10
|
|
#define SYS_execv 11
|
|
#define SYS_fcntl 12
|
|
#define SYS_mprotect 13
|
|
#define SYS_clock_gettime 14
|
|
#define SYS_mkdir 15
|
|
#define SYS_fork 16
|
|
#define SYS_waitpid 17
|
|
#define SYS_access 18
|
|
#define SYS_fstat 19
|
|
#define SYS_pstat 20
|
|
#define SYS_getdents 21
|
|
#define SYS_stat 22
|
|
#define SYS_dup2 23
|
|
#define SYS_setuid 24
|
|
#define SYS_setgid 25
|
|
#define SYS_umask 26
|
|
#define SYS_ioctl 27
|
|
|
|
struct stat;
|
|
struct pstat;
|
|
struct luna_dirent;
|
|
struct timespec;
|
|
|
|
namespace Syscall
|
|
{
|
|
void entry(Context* context);
|
|
}
|
|
|
|
void sys_exit(Context* context, int status);
|
|
void sys_yield(Context* context);
|
|
void sys_sleep(Context* context, uint64_t ms);
|
|
void sys_write(Context* context, int fd, size_t size, const char* addr);
|
|
void sys_getprocid(Context* context, int field);
|
|
void sys_mmap(Context* context, void* address, size_t size, int prot, int fd, off_t offset);
|
|
void sys_munmap(Context* context, void* address, size_t size);
|
|
void sys_open(Context* context, const char* filename, int flags, mode_t mode);
|
|
void sys_read(Context* context, int fd, size_t size, char* buffer);
|
|
void sys_close(Context* context, int fd);
|
|
void sys_seek(Context* context, int fd, long offset, int whence);
|
|
void sys_execv(Context* context, const char* pathname, char** argv);
|
|
void sys_fcntl(Context* context, int fd, int command, uintptr_t arg);
|
|
void sys_mprotect(Context* context, void* address, size_t size, int prot);
|
|
void sys_clock_gettime(Context* context, int clock_id, struct timespec* tp);
|
|
void sys_mkdir(Context* context, const char* filename, mode_t mode);
|
|
void sys_fork(Context* context);
|
|
void sys_waitpid(Context* context, long pid, int* wstatus, int options);
|
|
void sys_access(Context* context, const char* path, int amode);
|
|
void sys_fstat(Context* context, int fd, struct stat* buf);
|
|
void sys_pstat(Context* context, long pid, struct pstat* buf);
|
|
void sys_getdents(Context* context, int fd, struct luna_dirent* buf, size_t count);
|
|
void sys_stat(Context* context, const char* path, struct stat* buf);
|
|
void sys_dup2(Context* context, int fd, int fd2);
|
|
void sys_setuid(Context* context, int new_uid, int new_euid);
|
|
void sys_setgid(Context* context, int new_gid, int new_egid);
|
|
void sys_umask(Context* context, mode_t cmask);
|
|
void sys_ioctl(Context* context, int fd, int request, uintptr_t arg); |