source: mainline/kernel/generic/src/ipc/ipc.c@ cfaa35a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since cfaa35a was cfaa35a, checked in by Jakub Jermar <jakub@…>, 13 years ago

Rename call_t's link to ab_link as this link is exclusively used for
linking the call into one of the answerbox lists.

  • Property mode set to 100644
File size: 19.7 KB
Line 
1/*
2 * Copyright (c) 2006 Ondrej Palkovsky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup genericipc
30 * @{
31 */
32/** @file
33 */
34
35/* Lock ordering
36 *
37 * First the answerbox, then the phone.
38 */
39
40#include <synch/spinlock.h>
41#include <synch/mutex.h>
42#include <synch/waitq.h>
43#include <ipc/ipc.h>
44#include <abi/ipc/methods.h>
45#include <ipc/kbox.h>
46#include <ipc/event.h>
47#include <errno.h>
48#include <mm/slab.h>
49#include <arch.h>
50#include <proc/task.h>
51#include <memstr.h>
52#include <debug.h>
53#include <print.h>
54#include <console/console.h>
55#include <proc/thread.h>
56#include <arch/interrupt.h>
57#include <ipc/irq.h>
58
59/** Open channel that is assigned automatically to new tasks */
60answerbox_t *ipc_phone_0 = NULL;
61
62static slab_cache_t *ipc_call_slab;
63static slab_cache_t *ipc_answerbox_slab;
64
65/** Initialize a call structure.
66 *
67 * @param call Call structure to be initialized.
68 *
69 */
70static void _ipc_call_init(call_t *call)
71{
72 memsetb(call, sizeof(*call), 0);
73 call->sender = TASK;
74 call->buffer = NULL;
75}
76
77/** Allocate and initialize a call structure.
78 *
79 * The call is initialized, so that the reply will be directed to
80 * TASK->answerbox.
81 *
82 * @param flags Parameters for slab_alloc (e.g FRAME_ATOMIC).
83 *
84 * @return If flags permit it, return NULL, or initialized kernel
85 * call structure.
86 *
87 */
88call_t *ipc_call_alloc(unsigned int flags)
89{
90 call_t *call = slab_alloc(ipc_call_slab, flags);
91 if (call)
92 _ipc_call_init(call);
93
94 return call;
95}
96
97/** Deallocate a call structure.
98 *
99 * @param call Call structure to be freed.
100 *
101 */
102void ipc_call_free(call_t *call)
103{
104 /* Check to see if we have data in the IPC_M_DATA_SEND buffer. */
105 if (call->buffer)
106 free(call->buffer);
107 slab_free(ipc_call_slab, call);
108}
109
110/** Initialize an answerbox structure.
111 *
112 * @param box Answerbox structure to be initialized.
113 * @param task Task to which the answerbox belongs.
114 *
115 */
116void ipc_answerbox_init(answerbox_t *box, task_t *task)
117{
118 irq_spinlock_initialize(&box->lock, "ipc.box.lock");
119 irq_spinlock_initialize(&box->irq_lock, "ipc.box.irqlock");
120 waitq_initialize(&box->wq);
121 list_initialize(&box->connected_phones);
122 list_initialize(&box->calls);
123 list_initialize(&box->dispatched_calls);
124 list_initialize(&box->answers);
125 list_initialize(&box->irq_notifs);
126 list_initialize(&box->irq_list);
127 box->task = task;
128}
129
130/** Connect a phone to an answerbox.
131 *
132 * @param phone Initialized phone structure.
133 * @param box Initialized answerbox structure.
134 *
135 */
136void ipc_phone_connect(phone_t *phone, answerbox_t *box)
137{
138 mutex_lock(&phone->lock);
139
140 phone->state = IPC_PHONE_CONNECTED;
141 phone->callee = box;
142
143 irq_spinlock_lock(&box->lock, true);
144 list_append(&phone->link, &box->connected_phones);
145 irq_spinlock_unlock(&box->lock, true);
146
147 mutex_unlock(&phone->lock);
148}
149
150/** Initialize a phone structure.
151 *
152 * @param phone Phone structure to be initialized.
153 *
154 */
155void ipc_phone_init(phone_t *phone)
156{
157 mutex_initialize(&phone->lock, MUTEX_PASSIVE);
158 phone->callee = NULL;
159 phone->state = IPC_PHONE_FREE;
160 atomic_set(&phone->active_calls, 0);
161}
162
163/** Answer a message which was not dispatched and is not listed in any queue.
164 *
165 * @param call Call structure to be answered.
166 * @param selflocked If true, then TASK->answebox is locked.
167 *
168 */
169static void _ipc_answer_free_call(call_t *call, bool selflocked)
170{
171 answerbox_t *callerbox = &call->sender->answerbox;
172 bool do_lock = ((!selflocked) || callerbox != (&TASK->answerbox));
173
174 /* Count sent answer */
175 irq_spinlock_lock(&TASK->lock, true);
176 TASK->ipc_info.answer_sent++;
177 irq_spinlock_unlock(&TASK->lock, true);
178
179 call->flags |= IPC_CALL_ANSWERED;
180
181 if (call->flags & IPC_CALL_FORWARDED) {
182 if (call->caller_phone) {
183 /* Demasquerade the caller phone. */
184 call->data.phone = call->caller_phone;
185 }
186 }
187
188 call->data.task_id = TASK->taskid;
189
190 if (do_lock)
191 irq_spinlock_lock(&callerbox->lock, true);
192
193 list_append(&call->ab_link, &callerbox->answers);
194
195 if (do_lock)
196 irq_spinlock_unlock(&callerbox->lock, true);
197
198 waitq_wakeup(&callerbox->wq, WAKEUP_FIRST);
199}
200
201/** Answer a message which is in a callee queue.
202 *
203 * @param box Answerbox that is answering the message.
204 * @param call Modified request that is being sent back.
205 *
206 */
207void ipc_answer(answerbox_t *box, call_t *call)
208{
209 /* Remove from active box */
210 irq_spinlock_lock(&box->lock, true);
211 list_remove(&call->ab_link);
212 irq_spinlock_unlock(&box->lock, true);
213
214 /* Send back answer */
215 _ipc_answer_free_call(call, false);
216}
217
218/** Simulate sending back a message.
219 *
220 * Most errors are better handled by forming a normal backward
221 * message and sending it as a normal answer.
222 *
223 * @param phone Phone structure the call should appear to come from.
224 * @param call Call structure to be answered.
225 * @param err Return value to be used for the answer.
226 *
227 */
228void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
229{
230 call->data.phone = phone;
231 atomic_inc(&phone->active_calls);
232 IPC_SET_RETVAL(call->data, err);
233 _ipc_answer_free_call(call, false);
234}
235
236/** Unsafe unchecking version of ipc_call.
237 *
238 * @param phone Phone structure the call comes from.
239 * @param box Destination answerbox structure.
240 * @param call Call structure with request.
241 *
242 */
243static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call)
244{
245 /* Count sent ipc call */
246 irq_spinlock_lock(&TASK->lock, true);
247 TASK->ipc_info.call_sent++;
248 irq_spinlock_unlock(&TASK->lock, true);
249
250 if (!(call->flags & IPC_CALL_FORWARDED)) {
251 atomic_inc(&phone->active_calls);
252 call->data.phone = phone;
253 call->data.task_id = TASK->taskid;
254 }
255
256 irq_spinlock_lock(&box->lock, true);
257 list_append(&call->ab_link, &box->calls);
258 irq_spinlock_unlock(&box->lock, true);
259
260 waitq_wakeup(&box->wq, WAKEUP_FIRST);
261}
262
263/** Send an asynchronous request using a phone to an answerbox.
264 *
265 * @param phone Phone structure the call comes from and which is
266 * connected to the destination answerbox.
267 * @param call Call structure with request.
268 *
269 * @return Return 0 on success, ENOENT on error.
270 *
271 */
272int ipc_call(phone_t *phone, call_t *call)
273{
274 mutex_lock(&phone->lock);
275 if (phone->state != IPC_PHONE_CONNECTED) {
276 mutex_unlock(&phone->lock);
277 if (call->flags & IPC_CALL_FORWARDED) {
278 IPC_SET_RETVAL(call->data, EFORWARD);
279 _ipc_answer_free_call(call, false);
280 } else {
281 if (phone->state == IPC_PHONE_HUNGUP)
282 ipc_backsend_err(phone, call, EHANGUP);
283 else
284 ipc_backsend_err(phone, call, ENOENT);
285 }
286
287 return ENOENT;
288 }
289
290 answerbox_t *box = phone->callee;
291 _ipc_call(phone, box, call);
292
293 mutex_unlock(&phone->lock);
294 return 0;
295}
296
297/** Disconnect phone from answerbox.
298 *
299 * This call leaves the phone in the HUNGUP state. The change to 'free' is done
300 * lazily later.
301 *
302 * @param phone Phone structure to be hung up.
303 *
304 * @return 0 if the phone is disconnected.
305 * @return -1 if the phone was already disconnected.
306 *
307 */
308int ipc_phone_hangup(phone_t *phone)
309{
310 mutex_lock(&phone->lock);
311 if (phone->state == IPC_PHONE_FREE ||
312 phone->state == IPC_PHONE_HUNGUP ||
313 phone->state == IPC_PHONE_CONNECTING) {
314 mutex_unlock(&phone->lock);
315 return -1;
316 }
317
318 answerbox_t *box = phone->callee;
319 if (phone->state != IPC_PHONE_SLAMMED) {
320 /* Remove myself from answerbox */
321 irq_spinlock_lock(&box->lock, true);
322 list_remove(&phone->link);
323 irq_spinlock_unlock(&box->lock, true);
324
325 call_t *call = ipc_call_alloc(0);
326 IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
327 call->flags |= IPC_CALL_DISCARD_ANSWER;
328 _ipc_call(phone, box, call);
329 }
330
331 phone->state = IPC_PHONE_HUNGUP;
332 mutex_unlock(&phone->lock);
333
334 return 0;
335}
336
337/** Forwards call from one answerbox to another one.
338 *
339 * @param call Call structure to be redirected.
340 * @param newphone Phone structure to target answerbox.
341 * @param oldbox Old answerbox structure.
342 * @param mode Flags that specify mode of the forward operation.
343 *
344 * @return 0 if forwarding succeeded or an error code if
345 * there was an error.
346 *
347 * The return value serves only as an information for the forwarder,
348 * the original caller is notified automatically with EFORWARD.
349 *
350 */
351int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox,
352 unsigned int mode)
353{
354 /* Count forwarded calls */
355 irq_spinlock_lock(&TASK->lock, true);
356 TASK->ipc_info.forwarded++;
357 irq_spinlock_pass(&TASK->lock, &oldbox->lock);
358 list_remove(&call->ab_link);
359 irq_spinlock_unlock(&oldbox->lock, true);
360
361 if (mode & IPC_FF_ROUTE_FROM_ME) {
362 if (!call->caller_phone)
363 call->caller_phone = call->data.phone;
364 call->data.phone = newphone;
365 call->data.task_id = TASK->taskid;
366 }
367
368 return ipc_call(newphone, call);
369}
370
371
372/** Wait for a phone call.
373 *
374 * @param box Answerbox expecting the call.
375 * @param usec Timeout in microseconds. See documentation for
376 * waitq_sleep_timeout() for decription of its special
377 * meaning.
378 * @param flags Select mode of sleep operation. See documentation for
379 * waitq_sleep_timeout() for description of its special
380 * meaning.
381 *
382 * @return Recived call structure or NULL.
383 *
384 * To distinguish between a call and an answer, have a look at call->flags.
385 *
386 */
387call_t *ipc_wait_for_call(answerbox_t *box, uint32_t usec, unsigned int flags)
388{
389 call_t *request;
390 uint64_t irq_cnt = 0;
391 uint64_t answer_cnt = 0;
392 uint64_t call_cnt = 0;
393 int rc;
394
395restart:
396 rc = waitq_sleep_timeout(&box->wq, usec, flags);
397 if (SYNCH_FAILED(rc))
398 return NULL;
399
400 irq_spinlock_lock(&box->lock, true);
401 if (!list_empty(&box->irq_notifs)) {
402 /* Count received IRQ notification */
403 irq_cnt++;
404
405 irq_spinlock_lock(&box->irq_lock, false);
406
407 request = list_get_instance(list_first(&box->irq_notifs),
408 call_t, ab_link);
409 list_remove(&request->ab_link);
410
411 irq_spinlock_unlock(&box->irq_lock, false);
412 } else if (!list_empty(&box->answers)) {
413 /* Count received answer */
414 answer_cnt++;
415
416 /* Handle asynchronous answers */
417 request = list_get_instance(list_first(&box->answers),
418 call_t, ab_link);
419 list_remove(&request->ab_link);
420 atomic_dec(&request->data.phone->active_calls);
421 } else if (!list_empty(&box->calls)) {
422 /* Count received call */
423 call_cnt++;
424
425 /* Handle requests */
426 request = list_get_instance(list_first(&box->calls),
427 call_t, ab_link);
428 list_remove(&request->ab_link);
429
430 /* Append request to dispatch queue */
431 list_append(&request->ab_link, &box->dispatched_calls);
432 } else {
433 /* This can happen regularly after ipc_cleanup */
434 irq_spinlock_unlock(&box->lock, true);
435 goto restart;
436 }
437
438 irq_spinlock_pass(&box->lock, &TASK->lock);
439
440 TASK->ipc_info.irq_notif_received += irq_cnt;
441 TASK->ipc_info.answer_received += answer_cnt;
442 TASK->ipc_info.call_received += call_cnt;
443
444 irq_spinlock_unlock(&TASK->lock, true);
445
446 return request;
447}
448
449/** Answer all calls from list with EHANGUP answer.
450 *
451 * @param lst Head of the list to be cleaned up.
452 *
453 */
454void ipc_cleanup_call_list(list_t *lst)
455{
456 while (!list_empty(lst)) {
457 call_t *call = list_get_instance(list_first(lst), call_t,
458 ab_link);
459 if (call->buffer)
460 free(call->buffer);
461
462 list_remove(&call->ab_link);
463
464 IPC_SET_RETVAL(call->data, EHANGUP);
465 _ipc_answer_free_call(call, true);
466 }
467}
468
469/** Disconnects all phones connected to an answerbox.
470 *
471 * @param box Answerbox to disconnect phones from.
472 * @param notify_box If true, the answerbox will get a hangup message for
473 * each disconnected phone.
474 *
475 */
476void ipc_answerbox_slam_phones(answerbox_t *box, bool notify_box)
477{
478 phone_t *phone;
479 DEADLOCK_PROBE_INIT(p_phonelck);
480
481 call_t *call = notify_box ? ipc_call_alloc(0) : NULL;
482
483 /* Disconnect all phones connected to our answerbox */
484restart_phones:
485 irq_spinlock_lock(&box->lock, true);
486 while (!list_empty(&box->connected_phones)) {
487 phone = list_get_instance(list_first(&box->connected_phones),
488 phone_t, link);
489 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
490 irq_spinlock_unlock(&box->lock, true);
491 DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
492 goto restart_phones;
493 }
494
495 /* Disconnect phone */
496 ASSERT(phone->state == IPC_PHONE_CONNECTED);
497
498 list_remove(&phone->link);
499 phone->state = IPC_PHONE_SLAMMED;
500
501 if (notify_box) {
502 mutex_unlock(&phone->lock);
503 irq_spinlock_unlock(&box->lock, true);
504
505 /*
506 * Send one message to the answerbox for each
507 * phone. Used to make sure the kbox thread
508 * wakes up after the last phone has been
509 * disconnected.
510 */
511 IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
512 call->flags |= IPC_CALL_DISCARD_ANSWER;
513 _ipc_call(phone, box, call);
514
515 /* Allocate another call in advance */
516 call = ipc_call_alloc(0);
517
518 /* Must start again */
519 goto restart_phones;
520 }
521
522 mutex_unlock(&phone->lock);
523 }
524
525 irq_spinlock_unlock(&box->lock, true);
526
527 /* Free unused call */
528 if (call)
529 ipc_call_free(call);
530}
531
532/** Clean up all IPC communication of the current task.
533 *
534 * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
535 * have to change it as well if you want to cleanup other tasks than TASK.
536 *
537 */
538void ipc_cleanup(void)
539{
540 /* Disconnect all our phones ('ipc_phone_hangup') */
541 size_t i;
542 for (i = 0; i < IPC_MAX_PHONES; i++)
543 ipc_phone_hangup(&TASK->phones[i]);
544
545 /* Unsubscribe from any event notifications. */
546 event_cleanup_answerbox(&TASK->answerbox);
547
548 /* Disconnect all connected irqs */
549 ipc_irq_cleanup(&TASK->answerbox);
550
551 /* Disconnect all phones connected to our regular answerbox */
552 ipc_answerbox_slam_phones(&TASK->answerbox, false);
553
554#ifdef CONFIG_UDEBUG
555 /* Clean up kbox thread and communications */
556 ipc_kbox_cleanup();
557#endif
558
559 /* Answer all messages in 'calls' and 'dispatched_calls' queues */
560 irq_spinlock_lock(&TASK->answerbox.lock, true);
561 ipc_cleanup_call_list(&TASK->answerbox.dispatched_calls);
562 ipc_cleanup_call_list(&TASK->answerbox.calls);
563 irq_spinlock_unlock(&TASK->answerbox.lock, true);
564
565 /* Wait for all answers to asynchronous calls to arrive */
566 while (true) {
567 /*
568 * Go through all phones, until they are all FREE
569 * Locking is not needed, no one else should modify
570 * it when we are in cleanup
571 */
572 for (i = 0; i < IPC_MAX_PHONES; i++) {
573 if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
574 atomic_get(&TASK->phones[i].active_calls) == 0) {
575 TASK->phones[i].state = IPC_PHONE_FREE;
576 TASK->phones[i].callee = NULL;
577 }
578
579 /*
580 * Just for sure, we might have had some
581 * IPC_PHONE_CONNECTING phones
582 */
583 if (TASK->phones[i].state == IPC_PHONE_CONNECTED)
584 ipc_phone_hangup(&TASK->phones[i]);
585
586 /*
587 * If the hangup succeeded, it has sent a HANGUP
588 * message, the IPC is now in HUNGUP state, we
589 * wait for the reply to come
590 */
591
592 if (TASK->phones[i].state != IPC_PHONE_FREE)
593 break;
594 }
595
596 /* Got into cleanup */
597 if (i == IPC_MAX_PHONES)
598 break;
599
600 call_t *call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT,
601 SYNCH_FLAGS_NONE);
602 ASSERT((call->flags & IPC_CALL_ANSWERED) ||
603 (call->flags & IPC_CALL_NOTIF));
604
605 ipc_call_free(call);
606 }
607}
608
609/** Initilize IPC subsystem
610 *
611 */
612void ipc_init(void)
613{
614 ipc_call_slab = slab_cache_create("call_t", sizeof(call_t), 0, NULL,
615 NULL, 0);
616 ipc_answerbox_slab = slab_cache_create("answerbox_t",
617 sizeof(answerbox_t), 0, NULL, NULL, 0);
618}
619
620/** List answerbox contents.
621 *
622 * @param taskid Task ID.
623 *
624 */
625void ipc_print_task(task_id_t taskid)
626{
627 irq_spinlock_lock(&tasks_lock, true);
628 task_t *task = task_find_by_id(taskid);
629
630 if (!task) {
631 irq_spinlock_unlock(&tasks_lock, true);
632 return;
633 }
634
635 /* Hand-over-hand locking */
636 irq_spinlock_exchange(&tasks_lock, &task->lock);
637
638 printf("[phone id] [calls] [state\n");
639
640 size_t i;
641 for (i = 0; i < IPC_MAX_PHONES; i++) {
642 if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) {
643 printf("%-10zu (mutex busy)\n", i);
644 continue;
645 }
646
647 if (task->phones[i].state != IPC_PHONE_FREE) {
648 printf("%-10zu %7" PRIun " ", i,
649 atomic_get(&task->phones[i].active_calls));
650
651 switch (task->phones[i].state) {
652 case IPC_PHONE_CONNECTING:
653 printf("connecting");
654 break;
655 case IPC_PHONE_CONNECTED:
656 printf("connected to %" PRIu64 " (%s)",
657 task->phones[i].callee->task->taskid,
658 task->phones[i].callee->task->name);
659 break;
660 case IPC_PHONE_SLAMMED:
661 printf("slammed by %p",
662 task->phones[i].callee);
663 break;
664 case IPC_PHONE_HUNGUP:
665 printf("hung up by %p",
666 task->phones[i].callee);
667 break;
668 default:
669 break;
670 }
671
672 printf("\n");
673 }
674
675 mutex_unlock(&task->phones[i].lock);
676 }
677
678 irq_spinlock_lock(&task->answerbox.lock, false);
679
680#ifdef __32_BITS__
681 printf("[call id ] [method] [arg1] [arg2] [arg3] [arg4] [arg5]"
682 " [flags] [sender\n");
683#endif
684
685#ifdef __64_BITS__
686 printf("[call id ] [method] [arg1] [arg2] [arg3] [arg4]"
687 " [arg5] [flags] [sender\n");
688#endif
689
690 printf(" --- incomming calls ---\n");
691 list_foreach(task->answerbox.calls, cur) {
692 call_t *call = list_get_instance(cur, call_t, ab_link);
693
694#ifdef __32_BITS__
695 printf("%10p ", call);
696#endif
697
698#ifdef __64_BITS__
699 printf("%18p ", call);
700#endif
701
702 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
703 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
704 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
705 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
706 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
707 call->flags, call->sender->taskid, call->sender->name);
708 }
709
710 printf(" --- dispatched calls ---\n");
711 list_foreach(task->answerbox.dispatched_calls, cur) {
712 call_t *call = list_get_instance(cur, call_t, ab_link);
713
714#ifdef __32_BITS__
715 printf("%10p ", call);
716#endif
717
718#ifdef __64_BITS__
719 printf("%18p ", call);
720#endif
721
722 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
723 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
724 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
725 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
726 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
727 call->flags, call->sender->taskid, call->sender->name);
728 }
729
730 printf(" --- incoming answers ---\n");
731 list_foreach(task->answerbox.answers, cur) {
732 call_t *call = list_get_instance(cur, call_t, ab_link);
733
734#ifdef __32_BITS__
735 printf("%10p ", call);
736#endif
737
738#ifdef __64_BITS__
739 printf("%18p ", call);
740#endif
741
742 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
743 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
744 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
745 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
746 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
747 call->flags, call->sender->taskid, call->sender->name);
748 }
749
750 irq_spinlock_unlock(&task->answerbox.lock, false);
751 irq_spinlock_unlock(&task->lock, true);
752}
753
754/** @}
755 */
Note: See TracBrowser for help on using the repository browser.