1 /**
2  * \file
3  * \brief ARM-specific thread related definitions.
4  */
5 /*
6  * (c) 2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7  *     economic rights: Technische Universität Dresden (Germany)
8  *
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU General Public License 2.
11  * Please see the COPYING-GPL-2 file for details.
12  *
13  * As a special exception, you may use this file as part of a free software
14  * library without restriction.  Specifically, if other files instantiate
15  * templates or use macros or inline functions from this file, or you compile
16  * this file and link it with other files to produce an executable, this
17  * file does not by itself cause the resulting executable to be covered by
18  * the GNU General Public License.  This exception does not however
19  * invalidate any other reasons why the executable file might be covered by
20  * the GNU General Public License.
21  */
22 #pragma once
23 
24 #include_next <l4/sys/thread.h>
25 
26 /**
27  * \brief Set the TPIDRURO thread specific register.
28  * \ingroup l4_thread_api
29  *
30  * \param thread   Thread to manipulate
31  * \param tpidruro The value to be set
32  * \return System call return tag
33  */
34 L4_INLINE l4_msgtag_t
35 l4_thread_arm_set_tpidruro(l4_cap_idx_t thread, l4_addr_t tpidruro) L4_NOTHROW;
36 
37 /**
38  * \internal
39  * \ingroup l4_thread_api
40  */
41 L4_INLINE l4_msgtag_t
42 l4_thread_arm_set_tpidruro_u(l4_cap_idx_t thread, l4_addr_t tpidruro,
43                              l4_utcb_t *utcb) L4_NOTHROW;
44 
45 /* IMPLEMENTATION -----------------------------------------------------------*/
46 
47 L4_INLINE l4_msgtag_t
l4_thread_arm_set_tpidruro_u(l4_cap_idx_t thread,l4_addr_t tpidruro,l4_utcb_t * utcb)48 l4_thread_arm_set_tpidruro_u(l4_cap_idx_t thread, l4_addr_t tpidruro,
49                              l4_utcb_t *utcb) L4_NOTHROW
50 {
51   l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
52   v->mr[0] = L4_THREAD_ARM_TPIDRURO_OP;
53   v->mr[1] = tpidruro;
54   return l4_ipc_call(thread, utcb, l4_msgtag(L4_PROTO_THREAD, 2, 0, 0),
55                      L4_IPC_NEVER);
56 }
57 
58 L4_INLINE l4_msgtag_t
l4_thread_arm_set_tpidruro(l4_cap_idx_t thread,l4_addr_t tpidruro)59 l4_thread_arm_set_tpidruro(l4_cap_idx_t thread, l4_addr_t tpidruro) L4_NOTHROW
60 {
61   return l4_thread_arm_set_tpidruro_u(thread, tpidruro, l4_utcb());
62 }
63