[07fdf203] | 1 | /*****************************
|
---|
| 2 | * Kernel syscall interfaces *
|
---|
| 3 | *****************************/
|
---|
| 4 |
|
---|
[6fa9a99d] | 5 | interface sys_kio {
|
---|
[07fdf203] | 6 | /* Print using kernel facility */
|
---|
[6fa9a99d] | 7 | sysarg_t sys_kio(int fd, const void *buf, size_t size);
|
---|
[07fdf203] | 8 | protocol:
|
---|
[6fa9a99d] | 9 | ?sys_kio*
|
---|
[07fdf203] | 10 | };
|
---|
| 11 |
|
---|
[cf7b3e0] | 12 | interface sys_console {
|
---|
[07fdf203] | 13 | /* Enable kernel console */
|
---|
[96b02eb9] | 14 | sysarg_t sys_debug_enable_console(void);
|
---|
[f1380b7] | 15 |
|
---|
[07fdf203] | 16 | /* Disable kernel console */
|
---|
[96b02eb9] | 17 | sysarg_t sys_debug_disable_console(void);
|
---|
[07fdf203] | 18 | protocol:
|
---|
[6d4c549] | 19 | (
|
---|
| 20 | ?sys_debug_enable_console +
|
---|
| 21 | ?sys_debug_disable_console
|
---|
| 22 | )*
|
---|
[07fdf203] | 23 | };
|
---|
| 24 |
|
---|
[cf7b3e0] | 25 | interface sys_thread {
|
---|
[07fdf203] | 26 | /* Create new thread */
|
---|
[96b02eb9] | 27 | sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id);
|
---|
[f1380b7] | 28 |
|
---|
[07fdf203] | 29 | /* Terminate current thread */
|
---|
[96b02eb9] | 30 | sysarg_t sys_thread_exit(int uspace_status);
|
---|
[f1380b7] | 31 |
|
---|
[07fdf203] | 32 | /* Get current thread id */
|
---|
[96b02eb9] | 33 | sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id);
|
---|
[07fdf203] | 34 | protocol:
|
---|
[6d4c549] | 35 | (
|
---|
| 36 | ?sys_thread_create +
|
---|
| 37 | ?sys_thread_get_id +
|
---|
| 38 | ?sys_thread_exit
|
---|
| 39 | )*
|
---|
[07fdf203] | 40 | };
|
---|
| 41 |
|
---|
[cf7b3e0] | 42 | interface sys_task {
|
---|
[07fdf203] | 43 | /* Set name fo the current task */
|
---|
[96b02eb9] | 44 | sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len);
|
---|
[f1380b7] | 45 |
|
---|
[07fdf203] | 46 | /* Get current task id */
|
---|
[96b02eb9] | 47 | sysarg_t sys_task_get_id(task_id_t *uspace_task_id);
|
---|
[07fdf203] | 48 | protocol:
|
---|
[6d4c549] | 49 | (
|
---|
| 50 | ?sys_task_set_name +
|
---|
| 51 | ?sys_task_get_id
|
---|
| 52 | )*
|
---|
[07fdf203] | 53 | };
|
---|
| 54 |
|
---|
[cf7b3e0] | 55 | interface sys_program {
|
---|
[07fdf203] | 56 | /* Spawn a new instance of clonable loader service */
|
---|
[96b02eb9] | 57 | sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len);
|
---|
[07fdf203] | 58 | protocol:
|
---|
[6d4c549] | 59 | ?sys_program_spawn_loader*
|
---|
[07fdf203] | 60 | };
|
---|
| 61 |
|
---|
[cf7b3e0] | 62 | interface sys_futex {
|
---|
[07fdf203] | 63 | /* Sleep in a futex wait queue */
|
---|
[96b02eb9] | 64 | sysarg_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
|
---|
[f1380b7] | 65 |
|
---|
[07fdf203] | 66 | /* Wakeup one thread waiting in futex wait queue */
|
---|
[96b02eb9] | 67 | sysarg_t sys_futex_wakeup(uintptr_t uaddr);
|
---|
[07fdf203] | 68 | protocol:
|
---|
[6d4c549] | 69 | (
|
---|
| 70 | ?sys_futex_sleep_timeout +
|
---|
| 71 | ?sys_futex_wakeup
|
---|
| 72 | )*
|
---|
[07fdf203] | 73 | };
|
---|
| 74 |
|
---|
[cf7b3e0] | 75 | interface sys_smc {
|
---|
[07fdf203] | 76 | /* Enforce self-modifying code cache coherency */
|
---|
[96b02eb9] | 77 | sysarg_t sys_smc_coherence(uintptr_t va, size_t size);
|
---|
[07fdf203] | 78 | protocol:
|
---|
[6d4c549] | 79 | ?sys_smc_coherence*
|
---|
[07fdf203] | 80 | };
|
---|
| 81 |
|
---|
[cf7b3e0] | 82 | interface sys_as {
|
---|
[07fdf203] | 83 | /* Create new address space area */
|
---|
[96b02eb9] | 84 | sysarg_t sys_as_area_create(uintptr_t address, size_t size, int flags);
|
---|
[f1380b7] | 85 |
|
---|
[07fdf203] | 86 | /* Resize an address space area */
|
---|
[96b02eb9] | 87 | sysarg_t sys_as_area_resize(uinptr_t address, size_t size, int flags);
|
---|
[f1380b7] | 88 |
|
---|
[07fdf203] | 89 | /* Change flags of an address space area */
|
---|
[96b02eb9] | 90 | sysarg_t sys_as_area_change_flags(uintptr_t address, int flags);
|
---|
[f1380b7] | 91 |
|
---|
[07fdf203] | 92 | /* Destroy an address space area */
|
---|
[96b02eb9] | 93 | sysarg_t sys_as_area_destroy(uintptr_t address);
|
---|
[07fdf203] | 94 | protocol:
|
---|
[6d4c549] | 95 | (
|
---|
| 96 | ?sys_as_area_create +
|
---|
| 97 | ?sys_as_area_resize +
|
---|
| 98 | ?sys_as_area_change_flags +
|
---|
| 99 | ?sys_as_area_destroy
|
---|
| 100 | )*
|
---|
[07fdf203] | 101 | };
|
---|
| 102 |
|
---|
[cf7b3e0] | 103 | interface sys_ipc {
|
---|
[07fdf203] | 104 | /* Fast synchronous IPC call */
|
---|
[96b02eb9] | 105 | sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data);
|
---|
[f1380b7] | 106 |
|
---|
[07fdf203] | 107 | /* Slow synchronous IPC call */
|
---|
[96b02eb9] | 108 | sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *question, ipc_data_t *answer);
|
---|
[f1380b7] | 109 |
|
---|
[07fdf203] | 110 | /* Fast asynchronous IPC call */
|
---|
[96b02eb9] | 111 | sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
|
---|
[f1380b7] | 112 |
|
---|
[07fdf203] | 113 | /* Slow asynchronous IPC call */
|
---|
[96b02eb9] | 114 | sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data);
|
---|
[f1380b7] | 115 |
|
---|
[07fdf203] | 116 | /* Fast forward a received IPC call to another destination */
|
---|
[96b02eb9] | 117 | sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, int mode);
|
---|
[f1380b7] | 118 |
|
---|
[07fdf203] | 119 | /* Slow forward a received IPC call to another destination */
|
---|
[96b02eb9] | 120 | sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid, ipc_data_t *data, int mode);
|
---|
[f1380b7] | 121 |
|
---|
[07fdf203] | 122 | /* Fast answer an IPC call */
|
---|
[96b02eb9] | 123 | sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
|
---|
[f1380b7] | 124 |
|
---|
[07fdf203] | 125 | /* Slow answer an IPC call */
|
---|
[96b02eb9] | 126 | sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data);
|
---|
[f1380b7] | 127 |
|
---|
[07fdf203] | 128 | /* Hang up a phone */
|
---|
[96b02eb9] | 129 | sysarg_t sys_ipc_hangup(int phoneid);
|
---|
[f1380b7] | 130 |
|
---|
[07fdf203] | 131 | /* Wait for an incoming IPC call or answer */
|
---|
[96b02eb9] | 132 | sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags);
|
---|
[f1380b7] | 133 |
|
---|
[07fdf203] | 134 | /* Interrupt one thread of the current task from waiting on IPC call */
|
---|
[96b02eb9] | 135 | sysarg_t sys_ipc_poke(void);
|
---|
[07fdf203] | 136 | protocol:
|
---|
[6d4c549] | 137 | (
|
---|
| 138 | ?sys_ipc_call_sync_fast +
|
---|
| 139 | ?sys_ipc_call_sync_slow +
|
---|
| 140 | ?sys_ipc_call_async_fast +
|
---|
| 141 | ?sys_ipc_call_async_slow +
|
---|
| 142 | ?sys_ipc_forward_fast +
|
---|
| 143 | ?sys_ipc_forward_slow +
|
---|
| 144 | ?sys_ipc_answer_fast +
|
---|
| 145 | ?sys_ipc_answer_slow +
|
---|
| 146 | ?sys_ipc_hangup +
|
---|
| 147 | ?sys_ipc_wait_for_call +
|
---|
| 148 | ?sys_ipc_poke
|
---|
| 149 | )*
|
---|
[07fdf203] | 150 | };
|
---|
| 151 |
|
---|
[cf7b3e0] | 152 | interface sys_event {
|
---|
[07fdf203] | 153 | /* Subscribe to kernel event notifications */
|
---|
[96b02eb9] | 154 | sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t method);
|
---|
[07fdf203] | 155 | protocol:
|
---|
[6d4c549] | 156 | ?sys_event_subscribe*
|
---|
[07fdf203] | 157 | };
|
---|
| 158 |
|
---|
[cf7b3e0] | 159 | interface sys_cap {
|
---|
[07fdf203] | 160 | /* Grant capabilities to a task */
|
---|
[6b10dab] | 161 | #ifdef __32_BITS__
|
---|
| 162 | sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps);
|
---|
| 163 | #endif
|
---|
[f1380b7] | 164 |
|
---|
[6b10dab] | 165 | #ifdef __64_BITS__
|
---|
| 166 | sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps);
|
---|
| 167 | #endif
|
---|
[f1380b7] | 168 |
|
---|
[07fdf203] | 169 | /* Revoke capabilities from a task */
|
---|
[6b10dab] | 170 | #ifdef __32_BITS__
|
---|
| 171 | sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps);
|
---|
| 172 | #endif
|
---|
[f1380b7] | 173 |
|
---|
[6b10dab] | 174 | #ifdef __64_BITS__
|
---|
| 175 | sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps);
|
---|
| 176 | #endif
|
---|
[07fdf203] | 177 | protocol:
|
---|
[6d4c549] | 178 | (
|
---|
| 179 | ?sys_cap_grant +
|
---|
| 180 | ?sys_cap_rewoke
|
---|
| 181 | )*
|
---|
[07fdf203] | 182 | };
|
---|
| 183 |
|
---|
[cf7b3e0] | 184 | interface sys_ddi {
|
---|
[07fdf203] | 185 | /* Enable access I/O address space for the current task */
|
---|
[96b02eb9] | 186 | sysarg_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg);
|
---|
[f1380b7] | 187 |
|
---|
[07fdf203] | 188 | /* Map physical memory to the current task's address space */
|
---|
[96b02eb9] | 189 | sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base, sysarg_t pages, sysarg_t flags);
|
---|
[f1380b7] | 190 |
|
---|
[07fdf203] | 191 | /* Enable or disable preemption */
|
---|
[96b02eb9] | 192 | sysarg_t sys_preempt_control(int enable);
|
---|
[f1380b7] | 193 |
|
---|
[07fdf203] | 194 | /* Assign unique device number */
|
---|
[96b02eb9] | 195 | sysarg_t sys_device_assign_devno(void);
|
---|
[f1380b7] | 196 |
|
---|
[07fdf203] | 197 | /* Connect an IRQ handler to the current task */
|
---|
[8add9ca5] | 198 | sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t method, irq_code_t *ucode);
|
---|
[f1380b7] | 199 |
|
---|
[07fdf203] | 200 | /* Disconnect an IRQ handler from the current task */
|
---|
[8add9ca5] | 201 | sysarg_t sys_unregister_irq(inr_t inr, devno_t devno);
|
---|
[07fdf203] | 202 | protocol:
|
---|
[6d4c549] | 203 | (
|
---|
| 204 | ?sys_enable_iospace +
|
---|
| 205 | ?sys_physmem_map +
|
---|
| 206 | ?sys_device_assign_devno +
|
---|
| 207 | ?sys_preempt_control +
|
---|
[8add9ca5] | 208 | ?sys_register_irq +
|
---|
| 209 | ?sys_unregister_irq
|
---|
[6d4c549] | 210 | )*
|
---|
[07fdf203] | 211 | };
|
---|
| 212 |
|
---|
[cf7b3e0] | 213 | interface sys_sysinfo {
|
---|
[07fdf203] | 214 | /* Check for sysinfo key validity */
|
---|
[96b02eb9] | 215 | sysarg_t sys_sysinfo_valid(sysarg_t ptr, sysarg_t len);
|
---|
[f1380b7] | 216 |
|
---|
[07fdf203] | 217 | /* Get sysinfo key value */
|
---|
[96b02eb9] | 218 | sysarg_t sys_sysinfo_value(unatice_t ptr, sysarg_t len);
|
---|
[07fdf203] | 219 | protocol:
|
---|
[6d4c549] | 220 | (
|
---|
| 221 | ?sys_sysinfo_valid +
|
---|
| 222 | ?sys_sysinfo_value
|
---|
| 223 | )*
|
---|
[07fdf203] | 224 | };
|
---|
| 225 |
|
---|
[cf7b3e0] | 226 | interface sys_debug {
|
---|
[07fdf203] | 227 | /* Connect to the kernel debugging answerbox of a given task */
|
---|
[6b10dab] | 228 | #ifdef __32_BITS__
|
---|
| 229 | sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid);
|
---|
| 230 | #endif
|
---|
[f1380b7] | 231 |
|
---|
[6b10dab] | 232 | #ifdef __64_BITS__
|
---|
| 233 | sysarg_t sys_ipc_connect_kbox(sysarg_t taskid);
|
---|
| 234 | #endif
|
---|
[07fdf203] | 235 | protocol:
|
---|
[6d4c549] | 236 | ?sys_ipc_connect_kbox*
|
---|
[07fdf203] | 237 | };
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | /*****************************************************
|
---|
| 241 | * Primitive kernel components (exported subsystems) *
|
---|
| 242 | *****************************************************/
|
---|
| 243 |
|
---|
[cf7b3e0] | 244 | frame sys_console {
|
---|
[07fdf203] | 245 | provides:
|
---|
[6fa9a99d] | 246 | sys_kio sys_kio;
|
---|
[cf7b3e0] | 247 | sys_console sys_console;
|
---|
[07fdf203] | 248 | };
|
---|
| 249 |
|
---|
[cf7b3e0] | 250 | frame sys_proc {
|
---|
[07fdf203] | 251 | provides:
|
---|
[cf7b3e0] | 252 | sys_tls sys_tls;
|
---|
| 253 | sys_thread sys_thread;
|
---|
| 254 | sys_task sys_task;
|
---|
| 255 | sys_program sys_program;
|
---|
[07fdf203] | 256 | };
|
---|
| 257 |
|
---|
[cf7b3e0] | 258 | frame sys_synch {
|
---|
[07fdf203] | 259 | provides:
|
---|
[cf7b3e0] | 260 | sys_futex sys_futex;
|
---|
| 261 | sys_smc sys_smc;
|
---|
[07fdf203] | 262 | };
|
---|
| 263 |
|
---|
[cf7b3e0] | 264 | frame sys_mm {
|
---|
[07fdf203] | 265 | provides:
|
---|
[cf7b3e0] | 266 | sys_as sys_as;
|
---|
[07fdf203] | 267 | };
|
---|
| 268 |
|
---|
[cf7b3e0] | 269 | frame sys_ipc {
|
---|
[07fdf203] | 270 | provides:
|
---|
[cf7b3e0] | 271 | sys_ipc sys_ipc;
|
---|
| 272 | sys_event sys_event;
|
---|
[07fdf203] | 273 | };
|
---|
| 274 |
|
---|
[cf7b3e0] | 275 | frame sys_security {
|
---|
[07fdf203] | 276 | provides:
|
---|
[cf7b3e0] | 277 | sys_cap sys_cap;
|
---|
[07fdf203] | 278 | };
|
---|
| 279 |
|
---|
[cf7b3e0] | 280 | frame sys_ddi {
|
---|
[07fdf203] | 281 | provides:
|
---|
[cf7b3e0] | 282 | sys_ddi sys_ddi;
|
---|
[07fdf203] | 283 | };
|
---|
| 284 |
|
---|
[cf7b3e0] | 285 | frame sys_sysinfo {
|
---|
[07fdf203] | 286 | provides:
|
---|
[cf7b3e0] | 287 | sys_sysinfo sys_sysinfo;
|
---|
[07fdf203] | 288 | };
|
---|
| 289 |
|
---|
[cf7b3e0] | 290 | frame sys_debug {
|
---|
[07fdf203] | 291 | provides:
|
---|
[cf7b3e0] | 292 | sys_debug sys_debug;
|
---|
[07fdf203] | 293 | };
|
---|
| 294 |
|
---|
| 295 |
|
---|
| 296 | /******************************
|
---|
| 297 | * Composite kernel component *
|
---|
| 298 | ******************************/
|
---|
| 299 |
|
---|
| 300 | architecture kernel {
|
---|
[cf7b3e0] | 301 | inst sys_console sys_console;
|
---|
| 302 | inst sys_proc sys_proc;
|
---|
| 303 | inst sys_synch sys_synch;
|
---|
| 304 | inst sys_mm sys_mm;
|
---|
| 305 | inst sys_ipc sys_ipc;
|
---|
| 306 | inst sys_security sys_security;
|
---|
| 307 | inst sys_ddi sys_ddi;
|
---|
| 308 | inst sys_sysinfo sys_sysinfo;
|
---|
| 309 | inst sys_debug sys_debug;
|
---|
[f1380b7] | 310 |
|
---|
[6fa9a99d] | 311 | delegate sys_kio to sys_console:sys_kio;
|
---|
[cf7b3e0] | 312 | delegate sys_console to sys_console:sys_console;
|
---|
| 313 | delegate sys_tls to sys_proc:sys_tls;
|
---|
| 314 | delegate sys_thread to sys_proc:sys_thread;
|
---|
| 315 | delegate sys_task to sys_proc:sys_task;
|
---|
| 316 | delegate sys_program to sys_proc:sys_program;
|
---|
| 317 | delegate sys_futex to sys_synch:sys_futex;
|
---|
| 318 | delegate sys_smc to sys_synch:sys_smc;
|
---|
| 319 | delegate sys_as to sys_mm:sys_as;
|
---|
| 320 | delegate sys_ipc to sys_ipc:sys_ipc;
|
---|
| 321 | delegate sys_event to sys_ipc:sys_event;
|
---|
| 322 | delegate sys_cap to sys_security:sys_cap;
|
---|
| 323 | delegate sys_ddi to sys_ddi:sys_ddi;
|
---|
| 324 | delegate sys_sysinfo to sys_sysinfo:sys_sysinfo;
|
---|
| 325 | delegate sys_debug to sys_debug:sys_debug;
|
---|
[07fdf203] | 326 | };
|
---|