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