blob: 1a4a2295fd34c7d5c47796e3aa614b06690092a2 [file] [log] [blame]
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +00001#include "defs.h"
Dmitry V. Levin0e946ab2015-07-17 23:56:54 +00002
3#include <signal.h>
4
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +00005#include "xlat/sigaltstack_flags.h"
6
7static void
8print_stack_t(struct tcb *tcp, unsigned long addr)
9{
10 stack_t ss;
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +000011
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. Levin401295e2015-07-17 01:05:46 +000019
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. Levin174bb2b2015-03-26 13:03:25 +000027 } else
28#endif
Dmitry V. Levin401295e2015-07-17 01:05:46 +000029 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. Levin174bb2b2015-03-26 13:03:25 +000037}
38
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000039SYS_FUNC(sigaltstack)
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +000040{
41 if (entering(tcp)) {
42 print_stack_t(tcp, tcp->u_arg[0]);
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +000043 tprints(", ");
Dmitry V. Levin401295e2015-07-17 01:05:46 +000044 } else {
Dmitry V. Levin174bb2b2015-03-26 13:03:25 +000045 print_stack_t(tcp, tcp->u_arg[1]);
46 }
47 return 0;
48}