Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 1 | #include "defs.h" |
Dmitry V. Levin | 0e946ab | 2015-07-17 23:56:54 +0000 | [diff] [blame] | 2 | |
| 3 | #include <signal.h> |
| 4 | |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 5 | #include "xlat/sigaltstack_flags.h" |
| 6 | |
| 7 | static void |
| 8 | print_stack_t(struct tcb *tcp, unsigned long addr) |
| 9 | { |
| 10 | stack_t ss; |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 11 | |
| 12 | #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 |
| 13 | if (current_wordsize != sizeof(ss.ss_sp) && current_wordsize == 4) { |
| 14 | struct { |
| 15 | uint32_t ss_sp; |
| 16 | int32_t ss_flags; |
| 17 | uint32_t ss_size; |
| 18 | } ss32; |
Dmitry V. Levin | 401295e | 2015-07-17 01:05:46 +0000 | [diff] [blame] | 19 | |
| 20 | if (umove_or_printaddr(tcp, addr, &ss32)) |
| 21 | return; |
| 22 | |
| 23 | memset(&ss, 0, sizeof(ss)); |
| 24 | ss.ss_sp = (void*)(unsigned long) ss32.ss_sp; |
| 25 | ss.ss_flags = ss32.ss_flags; |
| 26 | ss.ss_size = (unsigned long) ss32.ss_size; |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 27 | } else |
| 28 | #endif |
Dmitry V. Levin | 401295e | 2015-07-17 01:05:46 +0000 | [diff] [blame] | 29 | if (umove_or_printaddr(tcp, addr, &ss)) |
| 30 | return; |
| 31 | |
| 32 | tprints("{ss_sp="); |
| 33 | printaddr((unsigned long) ss.ss_sp); |
| 34 | tprints(", ss_flags="); |
| 35 | printflags(sigaltstack_flags, ss.ss_flags, "SS_???"); |
| 36 | tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size); |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 39 | SYS_FUNC(sigaltstack) |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 40 | { |
| 41 | if (entering(tcp)) { |
| 42 | print_stack_t(tcp, tcp->u_arg[0]); |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 43 | tprints(", "); |
Dmitry V. Levin | 401295e | 2015-07-17 01:05:46 +0000 | [diff] [blame] | 44 | } else { |
Dmitry V. Levin | 174bb2b | 2015-03-26 13:03:25 +0000 | [diff] [blame] | 45 | print_stack_t(tcp, tcp->u_arg[1]); |
| 46 | } |
| 47 | return 0; |
| 48 | } |