3 * \brief Inter-thread setjmp/longjmp
6 * \author Jork Loeser <jork.loeser@inf.tu-dresden.de>
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.
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>
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)];
44 l4_thread_jmp_buf_s s;
45 l4_thread_jmp_buf raw;
46 } l4_thread_jmp_buf_u;
48 /*\brief inter-thread setjmp
50 * \param env jump buffer
51 * \retval 0 returned directly
52 * \retval !0 returned from longjmp
54 * Use this function to prepare a longjmp from another thread for this thread.
58 L4_CV int l4_thread_setjmp(l4_thread_jmp_buf env);
60 /*!\brief inter-thread longjmp
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
67 * This function sets #thread to the location obtained by its former
68 * l4_thread_setjump on #env.
71 * \note In contrast to longjmp(3), this function returns.
73 L4_CV void l4_thread_longjmp(l4_threadid_t thread, l4_thread_jmp_buf env, int val);