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 typedef struct target_mcontext {
31     abi_ulong   mc_onstack;     /* XXX - sigcontext compat. */
32     abi_ulong   mc_rdi;         /* machine state (struct trapframe) */
33     abi_ulong   mc_rsi;
34     abi_ulong   mc_rdx;
35     abi_ulong   mc_rcx;
36     abi_ulong   mc_r8;
37     abi_ulong   mc_r9;
38     abi_ulong   mc_rax;
39     abi_ulong   mc_rbx;
40     abi_ulong   mc_rbp;
41     abi_ulong   mc_r10;
42     abi_ulong   mc_r11;
43     abi_ulong   mc_r12;
44     abi_ulong   mc_r13;
45     abi_ulong   mc_r14;
46     abi_ulong   mc_r15;
47     uint32_t    mc_trapno;
48     uint16_t    mc_fs;
49     uint16_t    mc_gs;
50     abi_ulong   mc_addr;
51     uint32_t    mc_flags;
52     uint16_t    mc_es;
53     uint16_t    mc_ds;
54     abi_ulong   mc_err;
55     abi_ulong   mc_rip;
56     abi_ulong   mc_cs;
57     abi_ulong   mc_rflags;
58     abi_ulong   mc_rsp;
59     abi_ulong   mc_ss;
60 
61     abi_long    mc_len;                 /* sizeof(mcontext_t) */
62 
63 #define _MC_FPFMT_NODEV         0x10000 /* device not present or configured */
64 #define _MC_FPFMT_XMM           0x10002
65     abi_long    mc_fpformat;
66 #define _MC_FPOWNED_NONE        0x20000 /* FP state not used */
67 #define _MC_FPOWNED_FPU         0x20001 /* FP state came from FPU */
68 #define _MC_FPOWNED_PCB         0x20002 /* FP state came from PCB */
69     abi_long    mc_ownedfp;
70     /*
71      * See <machine/fpu.h> for the internals of mc_fpstate[].
72      */
73     abi_long    mc_fpstate[64] __aligned(16);
74 
75     abi_ulong   mc_fsbase;
76     abi_ulong   mc_gsbase;
77 
78     abi_ulong   mc_xfpustate;
79     abi_ulong   mc_xfpustate_len;
80 
81     abi_long    mc_spare[4];
82 } target_mcontext_t;
83 
84 #define TARGET_MCONTEXT_SIZE 800
85 #define TARGET_UCONTEXT_SIZE 880
86 
87 #include "target_os_ucontext.h"
88 
89 struct target_sigframe {
90     abi_ulong   sf_signum;
91     abi_ulong   sf_siginfo;    /* code or pointer to sf_si */
92     abi_ulong   sf_ucontext;   /* points to sf_uc */
93     abi_ulong   sf_addr;       /* undocumented 4th arg */
94     target_ucontext_t   sf_uc; /* = *sf_uncontext */
95     target_siginfo_t    sf_si; /* = *sf_siginfo (SA_SIGINFO case)*/
96     uint32_t    __spare__[2];
97 };
98 
99 #endif /* !TARGET_ARCH_SIGNAL_H_ */
100