1 /*
2 * Copyright (c) 2015-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifndef SIZEOF_STRUCT_SPARC_STACKF
9 # define SIZEOF_STRUCT_SPARC_STACKF sizeof(struct sparc_stackf)
10 #endif
11 #ifndef SIZEOF_STRUCT_PT_REGS
12 # define SIZEOF_STRUCT_PT_REGS sizeof(struct pt_regs)
13 #endif
14 #ifndef PERSONALITY_WORDSIZE
15 # define PERSONALITY_WORDSIZE PERSONALITY0_WORDSIZE
16 #endif
17
18 static void
19 arch_sigreturn(struct tcb *tcp)
20 {
21 kernel_ulong_t addr;
22 if (!get_stack_pointer(tcp, &addr))
23 return;
24 addr += SIZEOF_STRUCT_SPARC_STACKF + SIZEOF_STRUCT_PT_REGS;
25 struct {
26 unsigned int mask;
27 char fpu_save[PERSONALITY_WORDSIZE];
28 char insns[PERSONALITY_WORDSIZE * 2] ATTRIBUTE_ALIGNED(8);
29 unsigned int extramask[NSIG_BYTES / sizeof(int) - 1];
30 } frame;
31
32 if (!umove_or_printaddr(tcp, addr, &frame)) {
33 unsigned int mask[NSIG_BYTES / sizeof(int)];
34
35 mask[0] = frame.mask;
36 memcpy(mask + 1, frame.extramask, sizeof(frame.extramask));
37 tprintsigmask_addr(mask);
38 }
39 }
40
41 #undef PERSONALITY_WORDSIZE
42 #undef SIZEOF_STRUCT_PT_REGS
43 #undef SIZEOF_STRUCT_SPARC_STACKF