L4Re - L4 Runtime Environment
task
Go to the documentation of this file.
1 // vi:set ft=cpp: -*- Mode: C++ -*-
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@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 
25 #pragma once
26 
27 #include <l4/sys/task.h>
28 #include <l4/sys/capability>
29 
30 namespace L4 {
31 
43 class Task :
44  public Kobject_t<Task, Kobject, L4_PROTO_TASK,
45  Type_info::Demand_t<2> >
46 {
47 public:
67  l4_msgtag_t map(Cap<Task> const &src_task,
68  l4_fpage_t const &snd_fpage, l4_umword_t snd_base,
69  l4_utcb_t *utcb = l4_utcb()) noexcept
70  { return l4_task_map_u(cap(), src_task.cap(), snd_fpage, snd_base, utcb); }
71 
91  l4_umword_t map_mask,
92  l4_utcb_t *utcb = l4_utcb()) noexcept
93  { return l4_task_unmap_u(cap(), fpage, map_mask, utcb); }
94 
116  unsigned num_fpages,
117  l4_umword_t map_mask,
118  l4_utcb_t *utcb = l4_utcb()) noexcept
119  { return l4_task_unmap_batch_u(cap(), fpages, num_fpages, map_mask, utcb); }
120 
134  l4_utcb_t *utcb = l4_utcb()) noexcept
135  { return l4_task_delete_obj_u(cap(), obj.cap(), utcb); }
136 
148  l4_utcb_t *utcb = l4_utcb()) noexcept
149  { return l4_task_release_cap_u(this->cap(), cap.cap(), utcb); }
150 
168  l4_utcb_t *utcb = l4_utcb()) noexcept
169  { return l4_task_cap_valid_u(this->cap(), cap.cap(), utcb); }
170 
184  Cap<void> const &cap_b,
185  l4_utcb_t *utcb = l4_utcb()) noexcept
186  { return l4_task_cap_equal_u(cap(), cap_a.cap(), cap_b.cap(), utcb); }
187 
203  l4_utcb_t *utcb = l4_utcb()) noexcept
204  { return l4_task_add_ku_mem_u(cap(), fpage, utcb); }
205 
206 };
207 }
208 
209 
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition: capability.h:52
C++ interface of the Task kernel object.
Definition: task:43
l4_msgtag_t release_cap(L4::Cap< void > cap, l4_utcb_t *utcb=l4_utcb()) noexcept
Release capability.
Definition: task:147
L4 low-level kernel interface.
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
L4::Cap related definitions.
l4_msgtag_t cap_equal(Cap< void > const &cap_a, Cap< void > const &cap_b, l4_utcb_t *utcb=l4_utcb()) noexcept
Test whether two capabilities point to the same object with the same rights.
Definition: task:183
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
l4_msgtag_t add_ku_mem(l4_fpage_t const &fpage, l4_utcb_t *utcb=l4_utcb()) noexcept
Add kernel-user memory.
Definition: task:202
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
l4_msgtag_t unmap(l4_fpage_t const &fpage, l4_umword_t map_mask, l4_utcb_t *utcb=l4_utcb()) noexcept
Revoke rights from the task.
Definition: task:90
l4_msgtag_t unmap_batch(l4_fpage_t const *fpages, unsigned num_fpages, l4_umword_t map_mask, l4_utcb_t *utcb=l4_utcb()) noexcept
Revoke rights from a task.
Definition: task:115
L4 flexpage type.
Definition: __l4_fpage.h:83
Helper class to create an L4Re interface class that is derived from a single base class...
Definition: __typeinfo.h:759
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition: kobject:79
C++ interface for capabilities.
Definition: capability.h:13
Message tag data structure.
Definition: types.h:159
l4_msgtag_t cap_valid(Cap< void > const &cap, l4_utcb_t *utcb=l4_utcb()) noexcept
Check whether a capability is present (refers to an object).
Definition: task:167
l4_msgtag_t delete_obj(L4::Cap< void > obj, l4_utcb_t *utcb=l4_utcb()) noexcept
Release capability and delete object.
Definition: task:133
l4_msgtag_t map(Cap< Task > const &src_task, l4_fpage_t const &snd_fpage, l4_umword_t snd_base, l4_utcb_t *utcb=l4_utcb()) noexcept
Map resources available in the source task to a destination task.
Definition: task:67