1 
2 #ifndef __SYSCALL_H__
3 #define __SYSCALL_H__
4 
5 #include <sys/stat.h>
6 #include <sys/nic.h>
7 #include <sys/mbuf.h>
8 #include <sys/mount.h>
9 
10 uint64_t OSTime();
11 uint64_t OSGetPID();
12 void OSExit(int status);
13 uint64_t OSSpawn(const char *path, const char *argv[]);
14 uint64_t OSWait(uint64_t pid);
15 
16 // Memory
17 void *OSMemMap(void *addr, uint64_t len, int flags);
18 int OSMemUnmap(void *addr, uint64_t len);
19 int OSMemProtect(void *addr, uint64_t len, int flags);
20 
21 // IO
22 int OSRead(uint64_t fd, void *addr, uint64_t off, uint64_t length);
23 int OSWrite(uint64_t fd, const void *addr, uint64_t off, uint64_t length);
24 int OSFlush(uint64_t fd);
25 uint64_t OSOpen(const char *path, uint64_t flags);
26 int OSClose(uint64_t fd);
27 
28 // Directory
29 int OSStat(const char *path, struct stat *sb);
30 int OSReadDir(uint64_t fd, char *buf, size_t length, uint64_t *offset);
31 
32 // Threads
33 int OSThreadCreate(uint64_t rip, uint64_t arg);
34 int OSGetTID();
35 int OSThreadExit(uint64_t status);
36 int OSThreadSleep(uint64_t time);
37 int OSThreadWait(uint64_t tid);
38 
39 // Network
40 int OSNICStat(uint64_t nicNo, NIC *nic);
41 int OSNICSend(uint64_t nicNo, MBuf *mbuf);
42 int OSNICRecv(uint64_t nicNo, MBuf *mbuf);
43 
44 // System
45 int OSSysCtl(const char *node, void *oldval, void *newval);
46 int OSFSMount(const char *mntpt, const char *device, uint64_t flags);
47 int OSFSUnmount(const char *mntpt);
48 int OSFSInfo(struct statfs *info, uint64_t max);
49 
50 #endif /* __SYSCALL_H__ */
51 
52