1 /*
2 * Copyright (c) 2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifdef MPERS_IS_m32
9 # include "../arm/arch_prstatus_regset.c"
10 #else
11
12 static void
13 arch_decode_prstatus_regset(struct tcb *const tcp,
14 const kernel_ulong_t addr,
15 const kernel_ulong_t size)
16 {
17 struct_prstatus_regset regs;
18 const size_t fetch_size = MIN(sizeof(regs), size);
19
20 if (!size || size & 7) {
21 printaddr(addr);
22 } else if (!umoven_or_printaddr(tcp, addr, fetch_size, ®s)) {
23 tprint_struct_begin();
24 PRINT_FIELD_ARRAY_UPTO(regs, regs,
25 fetch_size / 8, tcp,
26 print_xint_array_member);
27 if (fetch_size > offsetof(struct_prstatus_regset, sp)) {
28 tprint_struct_next();
29 PRINT_FIELD_X(regs, sp);
30 }
31 if (fetch_size > offsetof(struct_prstatus_regset, pc)) {
32 tprint_struct_next();
33 PRINT_FIELD_X(regs, pc);
34 }
35 if (fetch_size > offsetof(struct_prstatus_regset, pstate)) {
36 tprint_struct_next();
37 PRINT_FIELD_X(regs, pstate);
38 }
39 if (size > sizeof(regs)) {
40 tprint_struct_next();
41 tprint_more_data_follows();
42 }
43 tprint_struct_end();
44 }
45 }
46
47 #endif /* !MPERS_IS_m32 */