L4Re - L4 Runtime Environment
kernel_object.h
Go to the documentation of this file.
1 
5 /*
6  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7  * Alexander Warg <warg@os.inf.tu-dresden.de>,
8  * Björn Döbel <doebel@os.inf.tu-dresden.de>
9  * economic rights: Technische Universität Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction. Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License. This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24 #ifndef __L4SYS__KERNEL_OBJECT_H__
25 #define __L4SYS__KERNEL_OBJECT_H__
26 
27 #include <l4/sys/types.h>
28 #include <l4/sys/compiler.h>
29 #include <l4/sys/utcb.h>
30 
49 L4_INLINE l4_msgtag_t
50 l4_invoke_debugger(l4_cap_idx_t obj, l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW;
51 
52 
53 /**************************************************************************
54  * Implementation
55  **************************************************************************/
56 
58 #include <l4/sys/ipc.h>
59 
60 enum L4_kobject_op {
61  L4_KOBJECT_OP_DEC_REFCNT = 0,
62  L4_KOBJECT_OP_REGISTER_IRQ,
63 };
64 
65 L4_INLINE l4_msgtag_t
66 l4_kobject_dec_refcnt_u(l4_cap_idx_t obj, l4_mword_t diff, l4_utcb_t *u) L4_NOTHROW;
67 
68 L4_INLINE l4_msgtag_t
69 l4_kobject_dec_refcnt(l4_cap_idx_t obj, l4_mword_t diff) L4_NOTHROW;
70 
71 L4_INLINE l4_msgtag_t
72 l4_kobject_dec_refcnt_u(l4_cap_idx_t obj, l4_mword_t diff, l4_utcb_t *u) L4_NOTHROW
73 {
74  l4_msg_regs_t *m = l4_utcb_mr_u(u);
75  m->mr[0] = L4_KOBJECT_OP_DEC_REFCNT;
76  m->mr[1] = diff;
77  return l4_ipc_call(obj, u, l4_msgtag(L4_PROTO_KOBJECT, 2, 0, 0), L4_IPC_NEVER);
78 }
79 
80 L4_INLINE l4_msgtag_t
81 l4_kobject_dec_refcnt(l4_cap_idx_t obj, l4_mword_t diff) L4_NOTHROW
82 {
83  return l4_kobject_dec_refcnt_u(obj, diff, l4_utcb());
84 }
85 
86 #endif /* ! __L4SYS__KERNEL_OBJECT_H__ */
Encapsulation of the message-register block in the UTCB.
Definition: utcb.h:78
Low-level kernel debugger functions.
Protocol for messages to a a generic kobject.
Definition: types.h:62
signed long l4_mword_t
Signed machine word.
Definition: l4int.h:49
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition: utcb.h:80
Common L4 ABI Data Types.
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition: ipc.h:445
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:341
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
#define L4_IPC_NEVER
never timeout
Definition: __timeout.h:80
L4 compiler related defines.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition: types.h:407
Message tag data structure.
Definition: types.h:158
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185