]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mach/hurd/x86_64/longjmp-ts.c
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / mach / hurd / x86_64 / longjmp-ts.c
CommitLineData
20427b8f 1/* Perform a `longjmp' on a Mach thread_state. x86_64 version.
dff8da6b 2 Copyright (C) 1991-2024 Free Software Foundation, Inc.
20427b8f
SB
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <hurd/signal.h>
20#include <setjmp.h>
21#include <jmpbuf-offsets.h>
22#include <mach/thread_status.h>
23
24
25/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */
26
27void
28_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
29{
30 struct i386_thread_state *ts = state;
31
32 ts->rbx = env[0].__jmpbuf[JB_RBX];
33 ts->rbp = env[0].__jmpbuf[JB_RBP];
34 ts->r12 = env[0].__jmpbuf[JB_R12];
35 ts->r13 = env[0].__jmpbuf[JB_R13];
36 ts->r14 = env[0].__jmpbuf[JB_R14];
37 ts->r15 = env[0].__jmpbuf[JB_R15];
38 ts->ursp = env[0].__jmpbuf[JB_RSP];
39 ts->rip = env[0].__jmpbuf[JB_PC];
40 ts->rax = val ?: 1;
41}