summaryrefslogtreecommitdiff
path: root/libl4/l4/gnu/ipc.h
blob: 7985b22d22cf43d73e0fe6e076aedd1424fbf8ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
/* l4/gnu/ipc.h - Public GNU interface for L4 IPC.
   Copyright (C) 2004 Free Software Foundation, Inc.
   Written by Marcus Brinkmann <marcus@gnu.org>.

   This file is part of the GNU L4 library.
 
   The GNU L4 library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.
 
   The GNU L4 library is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU L4 library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef _L4_IPC_H
# error "Never use <l4/gnu/ipc.h> directly; include <l4/ipc.h> instead."
#endif


typedef _L4_msg_tag_t l4_msg_tag_t;

#define	l4_niltag	_L4_niltag

static inline bool
_L4_attribute_always_inline
l4_is_msg_tag_equal (l4_msg_tag_t l, l4_msg_tag_t r)
{
  return _L4_is_msg_tag_equal (l, r);
}


static inline bool
_L4_attribute_always_inline
l4_is_msg_tag_not_equal (l4_msg_tag_t l, l4_msg_tag_t r)
{
  return _L4_is_msg_tag_not_equal (l, r);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_label (l4_msg_tag_t t)
{
  return _L4_label (t);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_untyped_words (l4_msg_tag_t t)
{
  return _L4_untyped_words (t);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_typed_words (l4_msg_tag_t t)
{
  return _L4_typed_words (t);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_msg_tag_add_label (l4_msg_tag_t tag, l4_word_t label)
{
  return _L4_msg_tag_add_label (tag, label);
}


static inline void
_L4_attribute_always_inline
l4_msg_tag_add_label_to (l4_msg_tag_t *tag, l4_word_t label)
{
  return _L4_msg_tag_add_label_to (tag, label);
}


static inline void
_L4_attribute_always_inline
l4_msg_tag_set_label (l4_msg_tag_t *tag, l4_word_t label)
{
  return _L4_msg_tag_add_label_to (tag, label);
}


static inline void
_L4_attribute_always_inline
l4_msg_tag_set_untyped_words (l4_msg_tag_t *tag, l4_word_t untyped_words)
{
  __L4_msg_tag_t _tag;

  _tag.raw = *tag;
  _tag.untyped = untyped_words;
  *tag = _tag.raw;
}


static inline void
_L4_attribute_always_inline
l4_msg_tag_set_typed_words (l4_msg_tag_t *tag, l4_word_t typed_words)
{
  __L4_msg_tag_t _tag;

  _tag.raw = *tag;
  _tag.typed = typed_words;
  *tag = _tag.raw;
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_msg_tag (void)
{
  return _L4_msg_tag ();
}


static inline void
_L4_attribute_always_inline
l4_set_msg_tag (l4_msg_tag_t tag)
{
  _L4_set_msg_tag (tag);
}



/* Map items.  */

typedef _L4_map_item_t l4_map_item_t;

static inline l4_map_item_t
_L4_attribute_always_inline
l4_map_item (l4_fpage_t fpage, l4_word_t send_base)
{
  return _L4_map_item (fpage, send_base);
}


static inline bool
_L4_attribute_always_inline
l4_is_map_item (l4_map_item_t map_item)
{
  return _L4_is_map_item (map_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_map_item_snd_fpage (l4_map_item_t map_item)
{
  return _L4_map_item_snd_fpage (map_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_map_item_snd_base (l4_map_item_t map_item)
{
  return _L4_map_item_snd_base (map_item);
}


/* Grant items.  */

typedef _L4_grant_item_t l4_grant_item_t;

static inline l4_grant_item_t
_L4_attribute_always_inline
l4_grant_item (l4_fpage_t fpage, l4_word_t send_base)
{
  return _L4_grant_item (fpage, send_base);
}


static inline bool
_L4_attribute_always_inline
l4_is_grant_item (l4_grant_item_t grant_item)
{
  return _L4_is_grant_item (grant_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_grant_item_snd_fpage (l4_grant_item_t grant_item)
{
  return _L4_grant_item_snd_fpage (grant_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_grant_item_snd_base (l4_grant_item_t grant_item)
{
  return _L4_grant_item_snd_base (grant_item);
}


/* String items.  */

typedef _L4_string_item_t l4_string_item_t;

typedef _L4_cache_allocation_hint_t l4_cache_allocation_hint_t;

#define L4_use_default_cache_line_allocation \
  _L4_use_default_cache_line_allocation

static inline bool
_L4_attribute_always_inline
l4_is_string_item (l4_string_item_t *string_item)
{
  return _L4_is_string_item (string_item);
}


static inline bool
_L4_attribute_always_inline
l4_compound_string (l4_string_item_t *string_item)
{
  return _L4_compound_string (string_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_substrings (l4_string_item_t *string_item)
{
  return _L4_substrings (string_item);
}


static inline void *
_L4_attribute_always_inline
l4_substring (l4_string_item_t *string_item, l4_word_t nr)
{
  return _L4_substring (string_item, nr);
}


static inline l4_string_item_t *
_L4_attribute_always_inline
l4_add_substring_address_to (l4_string_item_t *string_item,
			     l4_string_item_t *source)
{
  return _L4_add_substring_address_to (string_item, source);
}


static inline l4_string_item_t *
_L4_attribute_always_inline
l4_add_substring_to (l4_string_item_t *string_item, void *source)
{
  return _L4_add_substring_to (string_item, source);
}


static inline
_L4_attribute_always_inline
l4_cache_allocation_hint_t
l4_cache_allocation_hint (l4_string_item_t string_item)
{
  return _L4_cache_allocation_hint (string_item);
}


static inline
_L4_attribute_always_inline
l4_string_item_t
l4_add_cache_allocation_hint (l4_string_item_t string_item,
			      l4_cache_allocation_hint_t hint)
{
  return _L4_add_cache_allocation_hint (string_item, hint);
}


static inline l4_string_item_t *
_L4_attribute_always_inline
l4_add_cache_allocation_hint_to (l4_string_item_t *string_item,
				 l4_cache_allocation_hint_t hint)
{
  return _L4_add_cache_allocation_hint_to (string_item, hint);
}



/* Acceptors and message buffers.  */
typedef _L4_acceptor_t l4_acceptor_t;


#define L4_UNTYPED_WORDS_ACCEPTOR	_L4_untyped_words_acceptor
#define L4_STRING_ITEMS_ACCEPTOR	_L4_string_items_acceptor

typedef _L4_msg_buffer_t l4_msg_buffer_t;

static inline l4_acceptor_t
_L4_attribute_always_inline
l4_map_grant_items (l4_fpage_t rcv_window)
{
  return _L4_map_grant_items (rcv_window);
}


static inline l4_acceptor_t
_L4_attribute_always_inline
l4_add_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
{
  return _L4_add_acceptor (acceptor1, acceptor2);
}


static inline l4_acceptor_t *
_L4_attribute_always_inline
l4_add_acceptor_to (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
{
  return _L4_add_acceptor_to (acceptor1, acceptor2);
}


static inline l4_acceptor_t
_L4_attribute_always_inline
l4_remove_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
{
  return _L4_remove_acceptor (acceptor1, acceptor2);
}


static inline l4_acceptor_t *
_L4_attribute_always_inline
l4_remove_acceptor_from (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
{
  return _L4_remove_acceptor_from (acceptor1, acceptor2);
}


static inline bool
_L4_attribute_always_inline
l4_has_string_items (l4_acceptor_t acceptor)
{
  return _L4_has_string_items (acceptor);
}


static inline bool
_L4_attribute_always_inline
l4_has_map_grant_items (l4_acceptor_t acceptor)
{
  return _L4_has_map_grant_items (acceptor);
}


static inline l4_fpage_t
_L4_attribute_always_inline
l4_rcv_window (l4_acceptor_t acceptor)
{
  return _L4_rcv_window (acceptor);
}


static inline void
_L4_attribute_always_inline
l4_accept (l4_acceptor_t acceptor)
{
  _L4_accept (acceptor);
}


static inline void
_L4_attribute_always_inline
l4_accept_strings (l4_acceptor_t acceptor, l4_msg_buffer_t msg_buffer)
{
  _L4_accept_strings (acceptor, msg_buffer);
}


static inline l4_acceptor_t
_L4_attribute_always_inline
l4_accepted (void)
{
  return _L4_accepted ();
}


static inline void
_L4_attribute_always_inline
l4_msg_buffer_clear (l4_msg_buffer_t msg_buffer)
{
  _L4_msg_buffer_clear (msg_buffer);
}


static inline void
_L4_attribute_always_inline
l4_msg_buffer_append_simple_rcv_string (l4_msg_buffer_t msg_buffer,
					l4_string_item_t string_item)
{
  return _L4_msg_buffer_append_simple_rcv_string (msg_buffer, string_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_buffer_append_rcv_string (l4_msg_buffer_t msg_buffer,
				 l4_string_item_t *string_item)
{
  _L4_msg_buffer_append_rcv_string (msg_buffer, string_item);
}



/* Message composition.  */

typedef _L4_msg_t l4_msg_t;

static inline void
_L4_attribute_always_inline
l4_msg_put (l4_msg_t msg, l4_word_t label, int untyped_nr,
			       l4_word_t *untyped, int typed_nr, void *typed)
{
  _L4_msg_put (msg, label, untyped_nr, untyped, typed_nr, typed);
}


static inline void
_L4_attribute_always_inline
l4_msg_get (l4_msg_t msg, l4_word_t *untyped, void *typed)
{
  _L4_msg_get (msg, untyped, typed);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_msg_msg_tag (l4_msg_t msg)
{
  return _L4_msg_msg_tag (msg);
}


static inline void
_L4_attribute_always_inline
l4_set_msg_msg_tag (l4_msg_t msg, l4_msg_tag_t tag)
{
  _L4_set_msg_msg_tag (msg, tag);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_msg_label (l4_msg_t msg)
{
  return _L4_msg_msg_label (msg);
}


static inline void
_L4_attribute_always_inline
l4_set_msg_label (l4_msg_t msg, l4_word_t label)
{
  _L4_set_msg_msg_label (msg, label);
}


static inline void
_L4_attribute_always_inline
l4_msg_load (l4_msg_t msg)
{
  _L4_msg_load (msg);
}


static inline void
_L4_attribute_always_inline
l4_msg_store (l4_msg_tag_t tag, l4_msg_t msg)
{
  _L4_msg_store (tag, msg);
}


static inline void
_L4_attribute_always_inline
l4_msg_clear (l4_msg_t msg)
{
  _L4_msg_clear (msg);
}


static inline void
_L4_attribute_always_inline
l4_msg_append_word (l4_msg_t msg, l4_word_t data)
{
  _L4_msg_append_word (msg, data);
}


static inline void
_L4_attribute_always_inline
l4_msg_append_map_item (l4_msg_t msg, l4_map_item_t map_item)
{
  _L4_msg_append_map_item (msg, map_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_append_grant_item (l4_msg_t msg, l4_grant_item_t grant_item)
{
  _L4_msg_append_grant_item (msg, grant_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_append_simple_string_item (l4_msg_t msg,
				  l4_string_item_t string_item)
{
  _L4_msg_append_simple_string_item (msg, string_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_append_string_item (l4_msg_t msg, l4_string_item_t *string_item)
{
  _L4_msg_append_string_item (msg, string_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_put_word (l4_msg_t msg, l4_word_t nr, l4_word_t data)
{
  _L4_msg_put_word (msg, nr, data);
}


static inline void
_L4_attribute_always_inline
l4_msg_put_map_item (l4_msg_t msg, l4_word_t nr, l4_map_item_t map_item)
{
  _L4_msg_put_map_item (msg, nr, map_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_put_grant_item (l4_msg_t msg, l4_word_t nr, l4_grant_item_t grant_item)
{
  _L4_msg_put_grant_item (msg, nr, grant_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_put_simple_string_item (l4_msg_t msg, l4_word_t nr,
			       l4_string_item_t string_item)
{
  _L4_msg_put_simple_string_item (msg, nr, string_item);
}


static inline void
_L4_attribute_always_inline
l4_msg_put_string_item (l4_msg_t msg, l4_word_t nr,
			l4_string_item_t *string_item)
{
  _L4_msg_put_string_item (msg, nr, string_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_msg_word (l4_msg_t msg, l4_word_t nr)
{
  return _L4_msg_word (msg, nr);
}


static inline void
_L4_attribute_always_inline
l4_msg_get_word (l4_msg_t msg, l4_word_t nr,
				    l4_word_t *data)
{
  _L4_msg_get_word (msg, nr, data);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_msg_get_map_item (l4_msg_t msg, l4_word_t nr, l4_map_item_t *map_item)
{
  return _L4_msg_get_map_item (msg, nr, map_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_msg_get_grant_item (l4_msg_t msg, l4_word_t nr, l4_grant_item_t *grant_item)
{
  return _L4_msg_get_grant_item (msg, nr, grant_item);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_msg_get_string_item (l4_msg_t msg, l4_word_t nr,
			l4_string_item_t *string_item)
{
  return _L4_msg_get_string_item (msg, nr, string_item);
}



/* IPC interface.  */

static inline l4_word_t
_L4_attribute_always_inline
l4_timeouts (l4_time_t send_timeout, l4_time_t receive_timeout)
{
  return _L4_timeouts (send_timeout, receive_timeout);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_ipc (l4_thread_id_t dest, l4_thread_id_t from_spec,
	l4_word_t timeouts, l4_thread_id_t *from)
{
  return _L4_ipc (dest, from_spec, timeouts, from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_lipc (l4_thread_id_t dest, l4_thread_id_t from_spec,
	l4_word_t timeouts, l4_thread_id_t *from)
{
  return _L4_lipc (dest, from_spec, timeouts, from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_call_timeouts (l4_thread_id_t dest, l4_time_t send_timeout,
		  l4_time_t receive_timeout)
{
  return _L4_call_timeouts (dest, send_timeout, receive_timeout);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_call (l4_thread_id_t dest)
{
  return _L4_call (dest);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_send_timeout (l4_thread_id_t dest, l4_time_t send_timeout)
{
  return _L4_send_timeout (dest, send_timeout);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_send (l4_thread_id_t dest)
{
  return _L4_send (dest);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_reply (l4_thread_id_t dest)
{
  return _L4_reply (dest);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_receive_timeout (l4_thread_id_t from, l4_time_t receive_timeout)
{
  return _L4_receive_timeout (from, receive_timeout);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_receive (l4_thread_id_t from)
{
  return _L4_receive (from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_wait_timeout (l4_time_t receive_timeout, l4_thread_id_t *from)
{
  return _L4_wait_timeout (receive_timeout, from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_wait (l4_thread_id_t *from)
{
  return _L4_wait (from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_reply_wait_timeout (l4_thread_id_t dest, l4_time_t receive_timeout,
		       l4_thread_id_t *from)
{
  return _L4_reply_wait_timeout (dest, receive_timeout, from);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_reply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
{
  return _L4_reply_wait (dest, from);
}


static inline void
_L4_attribute_always_inline
l4_sleep (l4_time_t time)
{
  _L4_sleep (time);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_lcall (l4_thread_id_t dest)
{
  return _L4_lcall (dest);
}


static inline l4_msg_tag_t
_L4_attribute_always_inline
l4_lreply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
{
  return _L4_lreply_wait (dest, from);
}


static inline bool
_L4_attribute_always_inline
l4_ipc_succeeded (l4_msg_tag_t tag)
{
  return _L4_ipc_succeeded (tag);
}


static inline bool
_L4_attribute_always_inline
l4_ipc_failed (l4_msg_tag_t tag)
{
  return _L4_ipc_failed (tag);
}


static inline bool
_L4_attribute_always_inline
l4_ipc_propagated (l4_msg_tag_t tag)
{
  return _L4_ipc_propagated (tag);
}


static inline bool
_L4_attribute_always_inline
l4_ipc_redirected (l4_msg_tag_t tag)
{
  return _L4_ipc_redirected (tag);
}


static inline bool
_L4_attribute_always_inline
l4_ipc_xcpu (l4_msg_tag_t tag)
{
  return _L4_ipc_xcpu (tag);
}


static inline void
_L4_attribute_always_inline
l4_set_propagation (l4_msg_tag_t *tag)
{
  return _L4_set_propagation (tag);
}


static inline void
_L4_attribute_always_inline
l4_clear_propagation (l4_msg_tag_t *tag)
{
  return _L4_clear_propagation (tag);
}