1/* setjmp for PowerPC.
2   Copyright (C) 1995-2022 Free Software Foundation, Inc.
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 <sysdep.h>
20#include <stap-probe.h>
21#define _ASM
22#ifdef __NO_VMX__
23# include <novmxsetjmp.h>
24#else
25# include <jmpbuf-offsets.h>
26#endif
27
28ENTRY (__sigsetjmp_symbol)
29
30#ifdef PTR_MANGLE
31	mr   r5,r1
32	PTR_MANGLE(r5, r10)
33	stw  r5,(JB_GPR1*4)(3)
34#else
35	stw  r1,(JB_GPR1*4)(3)
36#endif
37	mflr r0
38	/* setjmp probe expects longjmp first argument (4@3), second argument
39	   (-4@4), and target address (4@0), respectively.  */
40	LIBC_PROBE (setjmp, 3, 4@3, -4@4, 4@0)
41	stw  r14,((JB_GPRS+14-14)*4)(3)
42#ifdef PTR_MANGLE
43	PTR_MANGLE2 (r0, r10)
44	li   r10,0
45#endif
46	stw  r0,(JB_LR*4)(3)
47	stw  r15,((JB_GPRS+15-14)*4)(3)
48	mfcr r0
49	stw  r16,((JB_GPRS+16-14)*4)(3)
50	stw  r0,(JB_CR*4)(3)
51	stw  r17,((JB_GPRS+17-14)*4)(3)
52	stw  r18,((JB_GPRS+18-14)*4)(3)
53	stw  r19,((JB_GPRS+19-14)*4)(3)
54	stw  r20,((JB_GPRS+20-14)*4)(3)
55	stw  r21,((JB_GPRS+21-14)*4)(3)
56	stw  r22,((JB_GPRS+22-14)*4)(3)
57	stw  r23,((JB_GPRS+23-14)*4)(3)
58	stw  r24,((JB_GPRS+24-14)*4)(3)
59	stw  r25,((JB_GPRS+25-14)*4)(3)
60	stw  r26,((JB_GPRS+26-14)*4)(3)
61	stw  r27,((JB_GPRS+27-14)*4)(3)
62	stw  r28,((JB_GPRS+28-14)*4)(3)
63	stw  r29,((JB_GPRS+29-14)*4)(3)
64	stw  r30,((JB_GPRS+30-14)*4)(3)
65	stw  r31,((JB_GPRS+31-14)*4)(3)
66#if IS_IN (rtld)
67	li   r3,0
68	blr
69#else
70	b __sigjmp_save_symbol@local
71#endif
72END (__sigsetjmp_symbol)
73