-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnekosys.c
120 lines (102 loc) · 2.2 KB
/
nekosys.c
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 <sys/syscall.h>
#include <nekosys.h>
int spawnp(pid_t *pid, const char *path, int argc, const char **argv)
{
sys$$spawnp_param param;
param.pid = pid;
param.path = path;
param.argc = argc;
param.argv = (char **)argv;
return syscall(SYS_SPAWNP, ¶m);
}
int waitp(pid_t pid)
{
return syscall(SYS_WAITP, &pid);
}
int readln(char *dst, size_t maxSize)
{
sys$$readln_param param;
param.dst = dst;
param.maxSize = maxSize;
return syscall(SYS_READLN, ¶m);
}
int framebuf_acquire(FRAMEBUF *framebuf)
{
return syscall(SYS_FBACQUIRE, framebuf);
}
int framebuf_flush(int x, int y, int w, int h)
{
sys$$fb_flush_param param;
param.full = 0;
param.x = x;
param.y = y;
param.w = w;
param.h = h;
return syscall(SYS_FBFLUSH, ¶m);
}
int framebuf_flush_all()
{
sys$$fb_flush_param param;
param.full = 1;
return syscall(SYS_FBFLUSH, ¶m);
}
int framebuf_release()
{
return syscall(SYS_FBRELEASE, 0);
}
int shbuf_create(size_t size)
{
return syscall(SYS_SHBUFCREATE, &size);
}
int shbuf_map(int bufid, void **mapped)
{
sys$$shbuf_map_param param;
param.shbuf = bufid;
param.dst = mapped;
return syscall(SYS_SHBUFMAP, ¶m);
}
int shbuf_unmap(int bufid)
{
}
int thread_create(void (*entryPoint)())
{
return syscall(SYS_THCREATE, entryPoint);
}
int thread_join(int threadId)
{
return syscall(SYS_THJOIN, &threadId);
}
int thread_die(int retcode)
{
return syscall(SYS_TEXIT, &retcode);
}
int pipe_open(const char *name)
{
return syscall(SYS_PIPEOPEN, name);
}
int pipe_close(int pipeid)
{
return syscall(SYS_PIPECLOSE, &pipeid);
}
int pipe_recv(int pipeid, pid_t *src, size_t size, uint8_t *buffer)
{
sys$$pipe_recv_param param;
param.pipeId = pipeid;
param.src = src;
param.size = size;
param.buffer = buffer;
return syscall(SYS_PIPERECV, ¶m);
}
int pipe_send(int pipeid, pid_t dst, size_t size, uint8_t *data)
{
sys$$pipe_send_param param;
param.pipeId = pipeid;
param.dstProcess = dst;
param.size = size;
param.data = data;
return syscall(SYS_PIPESEND, ¶m);
}
int mouse_poll(MOUSEPACKET *packet)
{
return syscall(SYS_MOUSEPOLL, packet);
}