vmrunkernel: load the file using the ELF library
[akaros.git] / kern / include / frontend.h
1 #pragma once
2
3 #include <ros/common.h>
4
5 #ifdef ROS_KERNEL
6
7 #include <env.h>
8 #include <vfs.h>
9 #include <process.h>
10
11 // Default APPSERVER_ETH_TYPE if not defined externally
12 #ifndef APPSERVER_ETH_TYPE
13 #define APPSERVER_ETH_TYPE 0x8888
14 #endif
15
16 void frontend_proc_init(struct proc* p);
17 void frontend_proc_free(struct proc* p);
18
19 int32_t frontend_syscall(pid_t pid, int32_t syscall_num,
20                          uint32_t arg0, uint32_t arg1, uint32_t arg2,
21                          uint32_t arg3, int32_t* errno);
22
23 int frontend_syscall_errno(struct proc* p, int n, int a0,
24                            int a1, int a2, int a3);
25
26 void file_init(void);
27 error_t file_read_page(struct file* f, physaddr_t pa, size_t pgoff);
28 struct file* file_open(const char* path, int oflag, int mode);
29 struct file* file_open_from_fd(struct proc* p, int fd);
30 void file_incref(struct file* f);
31 void file_decref(struct file* f);
32
33 #endif
34
35 #define APPSERVER_MAXPATH            1024
36
37 #define APPSERVER_SYSCALL_exit          1
38 #define APPSERVER_SYSCALL_read          3
39 #define APPSERVER_SYSCALL_write         4
40 #define APPSERVER_SYSCALL_open          5
41 #define APPSERVER_SYSCALL_close         6
42 #define APPSERVER_SYSCALL_link          9
43 #define APPSERVER_SYSCALL_unlink       10
44 #define APPSERVER_SYSCALL_chdir        12
45 #define APPSERVER_SYSCALL_chmod        15
46 #define APPSERVER_SYSCALL_brk          17
47 #define APPSERVER_SYSCALL_stat         18
48 #define APPSERVER_SYSCALL_lseek        19
49 #define APPSERVER_SYSCALL_fstat        28
50 #define APPSERVER_SYSCALL_utime        30
51 #define APPSERVER_SYSCALL_access       33
52 #define APPSERVER_SYSCALL_dup          41
53 #define APPSERVER_SYSCALL_umask        60
54 #define APPSERVER_SYSCALL_fcntl        62
55 #define APPSERVER_SYSCALL_kdup         87
56 #define APPSERVER_SYSCALL_lstat        88
57 #define APPSERVER_SYSCALL_tcgetattr    89
58 #define APPSERVER_SYSCALL_tcsetattr    90
59 #define APPSERVER_SYSCALL_closedir     91
60 #define APPSERVER_SYSCALL_rewinddir    92
61 #define APPSERVER_SYSCALL_readdir      93
62 #define APPSERVER_SYSCALL_opendir      94
63 #define APPSERVER_SYSCALL_dup2         95
64 #define APPSERVER_SYSCALL_proc_free    96
65 #define APPSERVER_SYSCALL_proc_init    97
66 #define APPSERVER_SYSCALL_time         98
67 #define APPSERVER_SYSCALL_pread       173
68 #define APPSERVER_SYSCALL_pwrite      174
69 #define APPSERVER_SYSCALL_getcwd      229