source: mainline/contrib/arch/kernel/kernel.adl@ 86018c1

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 86018c1 was 6d4c549, checked in by Martin Decky <martin@…>, 16 years ago

streamline the behavior protocols
add support for initialization and finalization phase of protocols in ADL

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