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