1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#include <socket.h>
#include <fs/vfs.h>
#include <signal.h>
#include <socket.h>
#include <stddef.h>
#include <sys/types.h>
#include <time.h>
#include <typedefs.h>
#include <types.h>
int syscall_ipc_register_endpoint(u32 endpoint);
int syscall_ipc_read(u8 *buffer, u32 length, u32 *sender_pid);
int syscall_ipc_write(int ipc_id, u8 *buffer, u32 length);
int syscall_ipc_write_to_process(int pid, u8 *buffer, u32 length);
typedef struct SYS_ACCEPT_PARAMS {
int socket;
struct sockaddr *address;
socklen_t *address_len;
} __attribute__((packed)) SYS_ACCEPT_PARAMS;
int syscall_accept(SYS_ACCEPT_PARAMS *args);
int syscall_open(const char *file, int flags, mode_t mode);
int syscall_write(int fd, const char *buf, size_t count);
int syscall_pwrite(int fd, const char *buf, size_t count, size_t offset);
void syscall_randomfill(void *buffer, u32 size);
typedef struct SYS_BIND_PARAMS {
int sockfd;
const struct sockaddr *addr;
socklen_t addrlen;
} __attribute__((packed)) SYS_BIND_PARAMS;
int syscall_bind(SYS_BIND_PARAMS *args);
int syscall_chdir(const char *path);
typedef struct SYS_CLOCK_GETTIME_PARAMS {
clockid_t clk;
struct timespec *ts;
} __attribute__((packed)) SYS_CLOCK_GETTIME_PARAMS;
int syscall_clock_gettime(SYS_CLOCK_GETTIME_PARAMS *args);
int syscall_ftruncate(int fd, size_t length);
char *syscall_getcwd(char *buf, size_t size);
int syscall_kill(pid_t pid, int sig);
int syscall_mkdir(const char *path, int mode);
typedef struct SYS_MMAP_PARAMS {
void *addr;
size_t length;
int prot;
int flags;
int fd;
size_t offset;
} __attribute__((packed)) SYS_MMAP_PARAMS;
void *syscall_mmap(SYS_MMAP_PARAMS *args);
#ifndef MSLEEP_H
#define MSLEEP_H
void syscall_msleep(u32 ms);
#endif
typedef struct SYS_POLL_PARAMS {
struct pollfd *fds;
size_t nfds;
int timeout;
} __attribute__((packed)) SYS_POLL_PARAMS;
int syscall_poll(SYS_POLL_PARAMS *args);
struct two_args {
u32 a;
u32 b;
};
size_t syscall_recvfrom(
int socket, void *buffer, size_t length, int flags,
struct two_args
*extra_args /*struct sockaddr *address, socklen_t *address_len*/);
struct t_two_args {
u32 a;
u32 b;
};
size_t syscall_sendto(int socket, const void *message, size_t length,
int flags, struct t_two_args *extra_args /*
const struct sockaddr *dest_addr,
socklen_t dest_len*/);
#ifndef SYS_SHM_H
#define SYS_SHM_H
typedef struct SYS_SHM_OPEN_PARAMS {
const char *name;
int oflag;
mode_t mode;
} __attribute__((packed)) SYS_SHM_OPEN_PARAMS;
int syscall_shm_open(SYS_SHM_OPEN_PARAMS *args);
#endif
int syscall_sigaction(int sig, const struct sigaction *restrict act,
struct sigaction *restrict oact);
typedef struct SYS_SOCKET_PARAMS {
int domain;
int type;
int protocol;
} __attribute__((packed)) SYS_SOCKET_PARAMS;
int syscall_socket(SYS_SOCKET_PARAMS *args);
typedef struct SYS_STAT_PARAMS {
const char *pathname;
struct stat *statbuf;
} __attribute__((packed)) SYS_STAT_PARAMS;
int syscall_stat(SYS_STAT_PARAMS *args);
u32 syscall_uptime(void);
int syscall_isatty(int fd);
|