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

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

In the absence of synchronous IPC calls, call_t's callerbox is just
caching call_t's sender→answerbox. Get rid of this redundancy.

  • 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->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->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->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->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, link);
409 list_remove(&request->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, link);
419 list_remove(&request->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, link);
428 list_remove(&request->link);
429
430 /* Append request to dispatch queue */
431 list_append(&request->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, link);
458 if (call->buffer)
459 free(call->buffer);
460
461 list_remove(&call->link);
462
463 IPC_SET_RETVAL(call->data, EHANGUP);
464 _ipc_answer_free_call(call, true);
465 }
466}
467
468/** Disconnects all phones connected to an answerbox.
469 *
470 * @param box Answerbox to disconnect phones from.
471 * @param notify_box If true, the answerbox will get a hangup message for
472 * each disconnected phone.
473 *
474 */
475void ipc_answerbox_slam_phones(answerbox_t *box, bool notify_box)
476{
477 phone_t *phone;
478 DEADLOCK_PROBE_INIT(p_phonelck);
479
480 call_t *call = notify_box ? ipc_call_alloc(0) : NULL;
481
482 /* Disconnect all phones connected to our answerbox */
483restart_phones:
484 irq_spinlock_lock(&box->lock, true);
485 while (!list_empty(&box->connected_phones)) {
486 phone = list_get_instance(list_first(&box->connected_phones),
487 phone_t, link);
488 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
489 irq_spinlock_unlock(&box->lock, true);
490 DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
491 goto restart_phones;
492 }
493
494 /* Disconnect phone */
495 ASSERT(phone->state == IPC_PHONE_CONNECTED);
496
497 list_remove(&phone->link);
498 phone->state = IPC_PHONE_SLAMMED;
499
500 if (notify_box) {
501 mutex_unlock(&phone->lock);
502 irq_spinlock_unlock(&box->lock, true);
503
504 /*
505 * Send one message to the answerbox for each
506 * phone. Used to make sure the kbox thread
507 * wakes up after the last phone has been
508 * disconnected.
509 */
510 IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
511 call->flags |= IPC_CALL_DISCARD_ANSWER;
512 _ipc_call(phone, box, call);
513
514 /* Allocate another call in advance */
515 call = ipc_call_alloc(0);
516
517 /* Must start again */
518 goto restart_phones;
519 }
520
521 mutex_unlock(&phone->lock);
522 }
523
524 irq_spinlock_unlock(&box->lock, true);
525
526 /* Free unused call */
527 if (call)
528 ipc_call_free(call);
529}
530
531/** Clean up all IPC communication of the current task.
532 *
533 * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
534 * have to change it as well if you want to cleanup other tasks than TASK.
535 *
536 */
537void ipc_cleanup(void)
538{
539 /* Disconnect all our phones ('ipc_phone_hangup') */
540 size_t i;
541 for (i = 0; i < IPC_MAX_PHONES; i++)
542 ipc_phone_hangup(&TASK->phones[i]);
543
544 /* Unsubscribe from any event notifications. */
545 event_cleanup_answerbox(&TASK->answerbox);
546
547 /* Disconnect all connected irqs */
548 ipc_irq_cleanup(&TASK->answerbox);
549
550 /* Disconnect all phones connected to our regular answerbox */
551 ipc_answerbox_slam_phones(&TASK->answerbox, false);
552
553#ifdef CONFIG_UDEBUG
554 /* Clean up kbox thread and communications */
555 ipc_kbox_cleanup();
556#endif
557
558 /* Answer all messages in 'calls' and 'dispatched_calls' queues */
559 irq_spinlock_lock(&TASK->answerbox.lock, true);
560 ipc_cleanup_call_list(&TASK->answerbox.dispatched_calls);
561 ipc_cleanup_call_list(&TASK->answerbox.calls);
562 irq_spinlock_unlock(&TASK->answerbox.lock, true);
563
564 /* Wait for all answers to asynchronous calls to arrive */
565 while (true) {
566 /*
567 * Go through all phones, until they are all FREE
568 * Locking is not needed, no one else should modify
569 * it when we are in cleanup
570 */
571 for (i = 0; i < IPC_MAX_PHONES; i++) {
572 if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
573 atomic_get(&TASK->phones[i].active_calls) == 0) {
574 TASK->phones[i].state = IPC_PHONE_FREE;
575 TASK->phones[i].callee = NULL;
576 }
577
578 /*
579 * Just for sure, we might have had some
580 * IPC_PHONE_CONNECTING phones
581 */
582 if (TASK->phones[i].state == IPC_PHONE_CONNECTED)
583 ipc_phone_hangup(&TASK->phones[i]);
584
585 /*
586 * If the hangup succeeded, it has sent a HANGUP
587 * message, the IPC is now in HUNGUP state, we
588 * wait for the reply to come
589 */
590
591 if (TASK->phones[i].state != IPC_PHONE_FREE)
592 break;
593 }
594
595 /* Got into cleanup */
596 if (i == IPC_MAX_PHONES)
597 break;
598
599 call_t *call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT,
600 SYNCH_FLAGS_NONE);
601 ASSERT((call->flags & IPC_CALL_ANSWERED) ||
602 (call->flags & IPC_CALL_NOTIF));
603
604 ipc_call_free(call);
605 }
606}
607
608/** Initilize IPC subsystem
609 *
610 */
611void ipc_init(void)
612{
613 ipc_call_slab = slab_cache_create("call_t", sizeof(call_t), 0, NULL,
614 NULL, 0);
615 ipc_answerbox_slab = slab_cache_create("answerbox_t",
616 sizeof(answerbox_t), 0, NULL, NULL, 0);
617}
618
619/** List answerbox contents.
620 *
621 * @param taskid Task ID.
622 *
623 */
624void ipc_print_task(task_id_t taskid)
625{
626 irq_spinlock_lock(&tasks_lock, true);
627 task_t *task = task_find_by_id(taskid);
628
629 if (!task) {
630 irq_spinlock_unlock(&tasks_lock, true);
631 return;
632 }
633
634 /* Hand-over-hand locking */
635 irq_spinlock_exchange(&tasks_lock, &task->lock);
636
637 printf("[phone id] [calls] [state\n");
638
639 size_t i;
640 for (i = 0; i < IPC_MAX_PHONES; i++) {
641 if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) {
642 printf("%-10zu (mutex busy)\n", i);
643 continue;
644 }
645
646 if (task->phones[i].state != IPC_PHONE_FREE) {
647 printf("%-10zu %7" PRIun " ", i,
648 atomic_get(&task->phones[i].active_calls));
649
650 switch (task->phones[i].state) {
651 case IPC_PHONE_CONNECTING:
652 printf("connecting");
653 break;
654 case IPC_PHONE_CONNECTED:
655 printf("connected to %" PRIu64 " (%s)",
656 task->phones[i].callee->task->taskid,
657 task->phones[i].callee->task->name);
658 break;
659 case IPC_PHONE_SLAMMED:
660 printf("slammed by %p",
661 task->phones[i].callee);
662 break;
663 case IPC_PHONE_HUNGUP:
664 printf("hung up by %p",
665 task->phones[i].callee);
666 break;
667 default:
668 break;
669 }
670
671 printf("\n");
672 }
673
674 mutex_unlock(&task->phones[i].lock);
675 }
676
677 irq_spinlock_lock(&task->answerbox.lock, false);
678
679#ifdef __32_BITS__
680 printf("[call id ] [method] [arg1] [arg2] [arg3] [arg4] [arg5]"
681 " [flags] [sender\n");
682#endif
683
684#ifdef __64_BITS__
685 printf("[call id ] [method] [arg1] [arg2] [arg3] [arg4]"
686 " [arg5] [flags] [sender\n");
687#endif
688
689 printf(" --- incomming calls ---\n");
690 list_foreach(task->answerbox.calls, cur) {
691 call_t *call = list_get_instance(cur, call_t, link);
692
693#ifdef __32_BITS__
694 printf("%10p ", call);
695#endif
696
697#ifdef __64_BITS__
698 printf("%18p ", call);
699#endif
700
701 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
702 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
703 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
704 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
705 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
706 call->flags, call->sender->taskid, call->sender->name);
707 }
708
709 printf(" --- dispatched calls ---\n");
710 list_foreach(task->answerbox.dispatched_calls, cur) {
711 call_t *call = list_get_instance(cur, call_t, link);
712
713#ifdef __32_BITS__
714 printf("%10p ", call);
715#endif
716
717#ifdef __64_BITS__
718 printf("%18p ", call);
719#endif
720
721 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
722 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
723 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
724 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
725 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
726 call->flags, call->sender->taskid, call->sender->name);
727 }
728
729 printf(" --- incoming answers ---\n");
730 list_foreach(task->answerbox.answers, cur) {
731 call_t *call = list_get_instance(cur, call_t, link);
732
733#ifdef __32_BITS__
734 printf("%10p ", call);
735#endif
736
737#ifdef __64_BITS__
738 printf("%18p ", call);
739#endif
740
741 printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
742 " %-6" PRIun " %-6" PRIun " %-7x %" PRIu64 " (%s)\n",
743 IPC_GET_IMETHOD(call->data), IPC_GET_ARG1(call->data),
744 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data),
745 IPC_GET_ARG4(call->data), IPC_GET_ARG5(call->data),
746 call->flags, call->sender->taskid, call->sender->name);
747 }
748
749 irq_spinlock_unlock(&task->answerbox.lock, false);
750 irq_spinlock_unlock(&task->lock, true);
751}
752
753/** @}
754 */
Note: See TracBrowser for help on using the repository browser.