]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/l4util/include/stack.h
Update
[l4.git] / l4 / pkg / l4re-core / l4util / include / stack.h
1 /**
2  * \file
3  * \brief  Some helper functions for stack manipulation. Newer versions of
4  *         gcc forbid to cast the lvalue of an expression resulting that
5  *         the following expression is invalid:
6  *
7  *         *--((l4_threadid_t)esp) = tid
8  *
9  * \date   03/2004
10  * \author Frank Mehnert <fm3@os.inf.tu-dresden.de> */
11
12 /*
13  * (c) 2003-2009 Author(s)
14  *     economic rights: Technische Universität Dresden (Germany)
15  * This file is part of TUD:OS and distributed under the terms of the
16  * GNU Lesser General Public License 2.1.
17  * Please see the COPYING-LGPL-2.1 file for details.
18  */
19
20 #ifndef _L4UTIL_STACK_H
21 #define _L4UTIL_STACK_H
22
23 #include <l4/sys/types.h>
24 #include <l4/sys/compiler.h>
25
26 EXTERN_C_BEGIN
27
28 L4_INLINE void l4util_stack_push_mword(l4_addr_t *stack, l4_mword_t val);
29
30 /*****************************************************************************/
31 /**
32  * \brief Get current stack pointer.
33  *
34  * \return stack pointer.
35  */
36 L4_INLINE l4_addr_t l4util_stack_get_sp(void);
37
38 /*
39  * Implementations.
40  */
41
42 #include <l4/util/stack_impl.h>
43
44 L4_INLINE void
45 l4util_stack_push_mword(l4_addr_t *stack, l4_mword_t val)
46 {
47   l4_mword_t *esp = (l4_mword_t*)(*stack);
48   *--esp = val;
49   *stack = (l4_addr_t)esp;
50 }
51
52 EXTERN_C_END
53
54 #endif