]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4util/include/ARCH-amd64/L4API-l4f/setjmp.h
update
[l4.git] / l4 / pkg / l4util / include / ARCH-amd64 / L4API-l4f / setjmp.h
1 /*!
2  * \file
3  * \brief  Inter-thread setjmp/longjmp
4  *
5  * \date   12/21/2005
6  * \author Jork Loeser <jork.loeser@inf.tu-dresden.de>
7  *
8  */
9 /*
10  * (c) 2004-2009 Author(s)
11  *     economic rights: Technische Universität Dresden (Germany)
12  * This file is part of TUD:OS and distributed under the terms of the
13  * GNU Lesser General Public License 2.1.
14  * Please see the COPYING-LGPL-2.1 file for details.
15  */
16 #ifndef __UTIL_INCLUDE_ARCH_AMD64_L4API_L4F_SETJMP_H_
17 #define __UTIL_INCLUDE_ARCH_AMd64_L4API_L4F_SETJMP_H_
18 #include <l4/sys/types.h>
19 #include <l4/sys/compiler.h>
20
21 EXTERN_C_BEGIN
22
23 typedef struct{
24     l4_umword_t r8;             /* 0x00 */
25     l4_umword_t r9;             /* 0x08 */
26     l4_umword_t r10;            /* 0x10 */
27     l4_umword_t r11;            /* 0x18 */
28     l4_umword_t r12;            /* 0x20 */
29     l4_umword_t r13;            /* 0x28 */
30     l4_umword_t r14;            /* 0x30 */
31     l4_umword_t r15;            /* 0x38 */
32     l4_umword_t rbx;            /* 0x40 */
33     l4_umword_t rsi;            /* 0x48 */
34     l4_umword_t rbp;            /* 0x50 */
35     l4_umword_t rsp;            /* 0x58 */
36     l4_umword_t rip;            /* 0x60 */
37     l4_umword_t rip_caller;     /* 0x68 */
38     l4_umword_t rflags;         /* 0x70 */
39     l4_umword_t stack[40];
40 } l4_thread_jmp_buf_s;
41 typedef int l4_thread_jmp_buf[sizeof(l4_thread_jmp_buf_s)/sizeof(l4_umword_t)];
42
43 typedef union{
44     l4_thread_jmp_buf_s s;
45     l4_thread_jmp_buf raw;
46 } l4_thread_jmp_buf_u;
47
48 /*\brief inter-thread setjmp
49  *
50  * \param       env     jump buffer
51  * \retval      0       returned directly
52  * \retval      !0      returned from longjmp
53  *
54  * Use this function to prepare a longjmp from another thread for this thread.
55  *
56  * \see setjmp(3)
57  */
58 L4_CV int l4_thread_setjmp(l4_thread_jmp_buf env);
59
60 /*!\brief inter-thread longjmp
61  *
62  * \param       thread  thread to apply the longjmp to
63  * \param       env     jump buffer
64  * \param       val     0: setjmp returns with 1
65  * \param       val     !0: return value of setjmp
66  *
67  * This function sets #thread to the location obtained by its former
68  * l4_thread_setjump on #env.
69  *
70  * \see  longjmp(3)
71  * \note In contrast to longjmp(3), this function returns.
72  */
73 L4_CV void l4_thread_longjmp(l4_threadid_t thread, l4_thread_jmp_buf env, int val);
74
75 EXTERN_C_END
76
77 #endif