source: mainline/kernel/generic/src/ipc/ipc.c@ 6c34f587

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

Remove synchronous IPC primitives.

  • 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->callerbox = &TASK->answerbox;
74 call->sender = TASK;
75 call->buffer = NULL;
76}
77
78/** Allocate and initialize a call structure.
79 *
80 * The call is initialized, so that the reply will be directed to
81 * TASK->answerbox.
82 *
83 * @param flags Parameters for slab_alloc (e.g FRAME_ATOMIC).
84 *
85 * @return If flags permit it, return NULL, or initialized kernel
86 * call structure.
87 *
88 */
89call_t *ipc_call_alloc(unsigned int flags)
90{
91 call_t *call = slab_alloc(ipc_call_slab, flags);
92 if (call)
93 _ipc_call_init(call);
94
95 return call;
96}
97
98/** Deallocate a call structure.
99 *
100 * @param call Call structure to be freed.
101 *
102 */
103void ipc_call_free(call_t *call)
104{
105 /* Check to see if we have data in the IPC_M_DATA_SEND buffer. */
106 if (call->buffer)
107 free(call->buffer);
108 slab_free(ipc_call_slab, call);
109}
110
111/** Initialize an answerbox structure.
112 *
113 * @param box Answerbox structure to be initialized.
114 * @param task Task to which the answerbox belongs.
115 *
116 */
117void ipc_answerbox_init(answerbox_t *box, task_t *task)
118{
119 irq_spinlock_initialize(&box->lock, "ipc.box.lock");
120 irq_spinlock_initialize(&box->irq_lock, "ipc.box.irqlock");
121 waitq_initialize(&box->wq);
122 list_initialize(&box->connected_phones);
123 list_initialize(&box->calls);
124 list_initialize(&box->dispatched_calls);
125 list_initialize(&box->answers);
126 list_initialize(&box->irq_notifs);
127 list_initialize(&box->irq_list);
128 box->task = task;
129}
130
131/** Connect a phone to an answerbox.
132 *
133 * @param phone Initialized phone structure.
134 * @param box Initialized answerbox structure.
135 *
136 */
137void ipc_phone_connect(phone_t *phone, answerbox_t *box)
138{
139 mutex_lock(&phone->lock);
140
141 phone->state = IPC_PHONE_CONNECTED;
142 phone->callee = box;
143
144 irq_spinlock_lock(&box->lock, true);
145 list_append(&phone->link, &box->connected_phones);
146 irq_spinlock_unlock(&box->lock, true);
147
148 mutex_unlock(&phone->lock);
149}
150
151/** Initialize a phone structure.
152 *
153 * @param phone Phone structure to be initialized.
154 *
155 */
156void ipc_phone_init(phone_t *phone)
157{
158 mutex_initialize(&phone->lock, MUTEX_PASSIVE);
159 phone->callee = NULL;
160 phone->state = IPC_PHONE_FREE;
161 atomic_set(&phone->active_calls, 0);
162}
163
164/** Answer a message which was not dispatched and is not listed in any queue.
165 *
166 * @param call Call structure to be answered.
167 * @param selflocked If true, then TASK->answebox is locked.
168 *
169 */
170static void _ipc_answer_free_call(call_t *call, bool selflocked)
171{
172 answerbox_t *callerbox = call->callerbox;
173 bool do_lock = ((!selflocked) || callerbox != (&TASK->answerbox));
174
175 /* Count sent answer */
176 irq_spinlock_lock(&TASK->lock, true);
177 TASK->ipc_info.answer_sent++;
178 irq_spinlock_unlock(&TASK->lock, true);
179
180 call->flags |= IPC_CALL_ANSWERED;
181
182 if (call->flags & IPC_CALL_FORWARDED) {
183 if (call->caller_phone) {
184 /* Demasquerade the caller phone. */
185 call->data.phone = call->caller_phone;
186 }
187 }
188
189 call->data.task_id = TASK->taskid;
190
191 if (do_lock)
192 irq_spinlock_lock(&callerbox->lock, true);
193
194 list_append(&call->link, &callerbox->answers);
195
196 if (do_lock)
197 irq_spinlock_unlock(&callerbox->lock, true);
198
199 waitq_wakeup(&callerbox->wq, WAKEUP_FIRST);
200}
201
202/** Answer a message which is in a callee queue.
203 *
204 * @param box Answerbox that is answering the message.
205 * @param call Modified request that is being sent back.
206 *
207 */
208void ipc_answer(answerbox_t *box, call_t *call)
209{
210 /* Remove from active box */
211 irq_spinlock_lock(&box->lock, true);
212 list_remove(&call->link);
213 irq_spinlock_unlock(&box->lock, true);
214
215 /* Send back answer */
216 _ipc_answer_free_call(call, false);
217}
218
219/** Simulate sending back a message.
220 *
221 * Most errors are better handled by forming a normal backward
222 * message and sending it as a normal answer.
223 *
224 * @param phone Phone structure the call should appear to come from.
225 * @param call Call structure to be answered.
226 * @param err Return value to be used for the answer.
227 *
228 */
229void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
230{
231 call->data.phone = phone;
232 atomic_inc(&phone->active_calls);
233 IPC_SET_RETVAL(call->data, err);
234 _ipc_answer_free_call(call, false);
235}
236
237/** Unsafe unchecking version of ipc_call.
238 *
239 * @param phone Phone structure the call comes from.
240 * @param box Destination answerbox structure.
241 * @param call Call structure with request.
242 *
243 */
244static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call)
245{
246 /* Count sent ipc call */
247 irq_spinlock_lock(&TASK->lock, true);
248 TASK->ipc_info.call_sent++;
249 irq_spinlock_unlock(&TASK->lock, true);
250
251 if (!(call->flags & IPC_CALL_FORWARDED)) {
252 atomic_inc(&phone->active_calls);
253 call->data.phone = phone;
254 call->data.task_id = TASK->taskid;
255 }
256
257 irq_spinlock_lock(&box->lock, true);
258 list_append(&call->link, &box->calls);
259 irq_spinlock_unlock(&box->lock, true);
260
261 waitq_wakeup(&box->wq, WAKEUP_FIRST);
262}
263
264/** Send an asynchronous request using a phone to an answerbox.
265 *
266 * @param phone Phone structure the call comes from and which is
267 * connected to the destination answerbox.
268 * @param call Call structure with request.
269 *
270 * @return Return 0 on success, ENOENT on error.
271 *
272 */
273int ipc_call(phone_t *phone, call_t *call)
274{
275 mutex_lock(&phone->lock);
276 if (phone->state != IPC_PHONE_CONNECTED) {
277 mutex_unlock(&phone->lock);
278 if (call->flags & IPC_CALL_FORWARDED) {
279 IPC_SET_RETVAL(call->data, EFORWARD);
280 _ipc_answer_free_call(call, false);
281 } else {
282 if (phone->state == IPC_PHONE_HUNGUP)
283 ipc_backsend_err(phone, call, EHANGUP);
284 else
285 ipc_backsend_err(phone, call, ENOENT);
286 }
287
288 return ENOENT;
289 }
290
291 answerbox_t *box = phone->callee;
292 _ipc_call(phone, box, call);
293
294 mutex_unlock(&phone->lock);
295 return 0;
296}
297
298/** Disconnect phone from answerbox.
299 *
300 * This call leaves the phone in the HUNGUP state. The change to 'free' is done
301 * lazily later.
302 *
303 * @param phone Phone structure to be hung up.
304 *
305 * @return 0 if the phone is disconnected.
306 * @return -1 if the phone was already disconnected.
307 *
308 */
309int ipc_phone_hangup(phone_t *phone)
310{
311 mutex_lock(&phone->lock);
312 if (phone->state == IPC_PHONE_FREE ||
313 phone->state == IPC_PHONE_HUNGUP ||
314 phone->state == IPC_PHONE_CONNECTING) {
315 mutex_unlock(&phone->lock);
316 return -1;
317 }
318
319 answerbox_t *box = phone->callee;
320 if (phone->state != IPC_PHONE_SLAMMED) {
321 /* Remove myself from answerbox */
322 irq_spinlock_lock(&box->lock, true);
323 list_remove(&phone->link);
324 irq_spinlock_unlock(&box->lock, true);
325
326 call_t *call = ipc_call_alloc(0);
327 IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
328 call->flags |= IPC_CALL_DISCARD_ANSWER;
329 _ipc_call(phone, box, call);
330 }
331
332 phone->state = IPC_PHONE_HUNGUP;
333 mutex_unlock(&phone->lock);
334
335 return 0;
336}
337
338/** Forwards call from one answerbox to another one.
339 *
340 * @param call Call structure to be redirected.
341 * @param newphone Phone structure to target answerbox.
342 * @param oldbox Old answerbox structure.
343 * @param mode Flags that specify mode of the forward operation.
344 *
345 * @return 0 if forwarding succeeded or an error code if
346 * there was an error.
347 *
348 * The return value serves only as an information for the forwarder,
349 * the original caller is notified automatically with EFORWARD.
350 *
351 */
352int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox,
353 unsigned int mode)
354{
355 /* Count forwarded calls */
356 irq_spinlock_lock(&TASK->lock, true);
357 TASK->ipc_info.forwarded++;
358 irq_spinlock_pass(&TASK->lock, &oldbox->lock);
359 list_remove(&call->link);
360 irq_spinlock_unlock(&oldbox->lock, true);
361
362 if (mode & IPC_FF_ROUTE_FROM_ME) {
363 if (!call->caller_phone)
364 call->caller_phone = call->data.phone;
365 call->data.phone = newphone;
366 call->data.task_id = TASK->taskid;
367 }
368
369 return ipc_call(newphone, call);
370}
371
372
373/** Wait for a phone call.
374 *
375 * @param box Answerbox expecting the call.
376 * @param usec Timeout in microseconds. See documentation for
377 * waitq_sleep_timeout() for decription of its special
378 * meaning.
379 * @param flags Select mode of sleep operation. See documentation for
380 * waitq_sleep_timeout() for description of its special
381 * meaning.
382 *
383 * @return Recived call structure or NULL.
384 *
385 * To distinguish between a call and an answer, have a look at call->flags.
386 *
387 */
388call_t *ipc_wait_for_call(answerbox_t *box, uint32_t usec, unsigned int flags)
389{
390 call_t *request;
391 uint64_t irq_cnt = 0;
392 uint64_t answer_cnt = 0;
393 uint64_t call_cnt = 0;
394 int rc;
395
396restart:
397 rc = waitq_sleep_timeout(&box->wq, usec, flags);
398 if (SYNCH_FAILED(rc))
399 return NULL;
400
401 irq_spinlock_lock(&box->lock, true);
402 if (!list_empty(&box->irq_notifs)) {
403 /* Count received IRQ notification */
404 irq_cnt++;
405
406 irq_spinlock_lock(&box->irq_lock, false);
407
408 request = list_get_instance(list_first(&box->irq_notifs),
409 call_t, link);
410 list_remove(&request->link);
411
412 irq_spinlock_unlock(&box->irq_lock, false);
413 } else if (!list_empty(&box->answers)) {
414 /* Count received answer */
415 answer_cnt++;
416
417 /* Handle asynchronous answers */
418 request = list_get_instance(list_first(&box->answers),
419 call_t, link);
420 list_remove(&request->link);
421 atomic_dec(&request->data.phone->active_calls);
422 } else if (!list_empty(&box->calls)) {
423 /* Count received call */
424 call_cnt++;
425
426 /* Handle requests */
427 request = list_get_instance(list_first(&box->calls),
428 call_t, link);
429 list_remove(&request->link);
430
431 /* Append request to dispatch queue */
432 list_append(&request->link, &box->dispatched_calls);
433 } else {
434 /* This can happen regularly after ipc_cleanup */
435 irq_spinlock_unlock(&box->lock, true);
436 goto restart;
437 }
438
439 irq_spinlock_pass(&box->lock, &TASK->lock);
440
441 TASK->ipc_info.irq_notif_received += irq_cnt;
442 TASK->ipc_info.answer_received += answer_cnt;
443 TASK->ipc_info.call_received += call_cnt;
444
445 irq_spinlock_unlock(&TASK->lock, true);
446
447 return request;
448}
449
450/** Answer all calls from list with EHANGUP answer.
451 *
452 * @param lst Head of the list to be cleaned up.
453 *
454 */
455void ipc_cleanup_call_list(list_t *lst)
456{
457 while (!list_empty(lst)) {
458 call_t *call = list_get_instance(list_first(lst), call_t, link);
459 if (call->buffer)
460 free(call->buffer);
461
462 list_remove(&call->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, 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, 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, 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.