1 /*
2  *  x86_64 signal definitions
3  *
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program 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
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef _TARGET_ARCH_SIGNAL_H_
19 #define _TARGET_ARCH_SIGNAL_H_
20 
21 #include "cpu.h"
22 
23 /* Size of the signal trampolin code placed on the stack. */
24 #define TARGET_SZSIGCODE    0
25 
26 /* compare to  x86/include/_limits.h */
27 #define TARGET_MINSIGSTKSZ  (512 * 4)               /* min sig stack size */
28 #define TARGET_SIGSTKSZ     (MINSIGSTKSZ + 32768)   /* recommended size */
29 
30 #define TARGET_MC_GET_CLEAR_RET 0x0001
31 
32 struct target_sigcontext {
33     /* to be added */
34 };
35 
36 typedef struct target_mcontext {
37 } target_mcontext_t;
38 
39 typedef struct target_ucontext {
40     target_sigset_t   uc_sigmask;
41     target_mcontext_t uc_mcontext;
42     abi_ulong         uc_link;
43     target_stack_t    uc_stack;
44     int32_t           uc_flags;
45     int32_t         __spare__[4];
46 } target_ucontext_t;
47 
48 struct target_sigframe {
49     abi_ulong   sf_signum;
50     abi_ulong   sf_siginfo;    /* code or pointer to sf_si */
51     abi_ulong   sf_ucontext;   /* points to sf_uc */
52     abi_ulong   sf_addr;       /* undocumented 4th arg */
53     target_ucontext_t   sf_uc; /* = *sf_uncontext */
54     target_siginfo_t    sf_si; /* = *sf_siginfo (SA_SIGINFO case)*/
55     uint32_t    __spare__[2];
56 };
57 
58 /*
59  * Compare to amd64/amd64/machdep.c sendsig()
60  * Assumes that target stack frame memory is locked.
61  */
62 static inline abi_long set_sigtramp_args(CPUX86State *regs,
63         int sig, struct target_sigframe *frame, abi_ulong frame_addr,
64         struct target_sigaction *ka)
65 {
66     /* XXX return -TARGET_EOPNOTSUPP; */
67     return 0;
68 }
69 
70 /* Compare to amd64/amd64/machdep.c get_mcontext() */
71 static inline abi_long get_mcontext(CPUX86State *regs,
72                 target_mcontext_t *mcp, int flags)
73 {
74     /* XXX */
75     return -TARGET_EOPNOTSUPP;
76 }
77 
78 /* Compare to amd64/amd64/machdep.c set_mcontext() */
79 static inline abi_long set_mcontext(CPUX86State *regs,
80         target_mcontext_t *mcp, int srflag)
81 {
82     /* XXX */
83     return -TARGET_EOPNOTSUPP;
84 }
85 
86 static inline abi_long get_ucontext_sigreturn(CPUX86State *regs,
87         abi_ulong target_sf, abi_ulong *target_uc)
88 {
89     /* XXX */
90     *target_uc = 0;
91     return -TARGET_EOPNOTSUPP;
92 }
93 
94 #endif /* !TARGET_ARCH_SIGNAL_H_ */
95