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

source code of glibc/sysdeps/powerpc/powerpc32/setjmp-common.S