1/*
2 * Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _ARCH_SIGNAL_H_
6#define _ARCH_SIGNAL_H_
7
8
9/*
10 * Architecture-specific structure passed to signal handlers
11 */
12
13#if __i386__
14
15typedef struct packed_fp_stack {
16	unsigned char	st0[10];
17	unsigned char	st1[10];
18	unsigned char	st2[10];
19	unsigned char	st3[10];
20	unsigned char	st4[10];
21	unsigned char	st5[10];
22	unsigned char	st6[10];
23	unsigned char	st7[10];
24} packed_fp_stack;
25
26typedef struct packed_mmx_regs {
27	unsigned char	mm0[10];
28	unsigned char	mm1[10];
29	unsigned char	mm2[10];
30	unsigned char	mm3[10];
31	unsigned char	mm4[10];
32	unsigned char	mm5[10];
33	unsigned char	mm6[10];
34	unsigned char	mm7[10];
35} packed_mmx_regs;
36
37typedef struct old_extended_regs {
38	unsigned short	fp_control;
39	unsigned short	_reserved1;
40	unsigned short	fp_status;
41	unsigned short	_reserved2;
42	unsigned short	fp_tag;
43	unsigned short	_reserved3;
44	unsigned long	fp_eip;
45	unsigned short	fp_cs;
46	unsigned short	fp_opcode;
47	unsigned long	fp_datap;
48	unsigned short	fp_ds;
49	unsigned short	_reserved4;
50	union {
51		packed_fp_stack	fp;
52		packed_mmx_regs	mmx;
53	} fp_mmx;
54} old_extended_regs;
55
56typedef struct fp_stack {
57	unsigned char	st0[10];
58	unsigned char	_reserved_42_47[6];
59	unsigned char	st1[10];
60	unsigned char	_reserved_58_63[6];
61	unsigned char	st2[10];
62	unsigned char	_reserved_74_79[6];
63	unsigned char	st3[10];
64	unsigned char	_reserved_90_95[6];
65	unsigned char	st4[10];
66	unsigned char	_reserved_106_111[6];
67	unsigned char	st5[10];
68	unsigned char	_reserved_122_127[6];
69	unsigned char	st6[10];
70	unsigned char	_reserved_138_143[6];
71	unsigned char	st7[10];
72	unsigned char	_reserved_154_159[6];
73} fp_stack;
74
75typedef struct mmx_regs {
76	unsigned char	mm0[10];
77	unsigned char	_reserved_42_47[6];
78	unsigned char	mm1[10];
79	unsigned char	_reserved_58_63[6];
80	unsigned char	mm2[10];
81	unsigned char	_reserved_74_79[6];
82	unsigned char	mm3[10];
83	unsigned char	_reserved_90_95[6];
84	unsigned char	mm4[10];
85	unsigned char	_reserved_106_111[6];
86	unsigned char	mm5[10];
87	unsigned char	_reserved_122_127[6];
88	unsigned char	mm6[10];
89	unsigned char	_reserved_138_143[6];
90	unsigned char	mm7[10];
91	unsigned char	_reserved_154_159[6];
92} mmx_regs;
93
94typedef struct xmmx_regs {
95	unsigned char	xmm0[16];
96	unsigned char	xmm1[16];
97	unsigned char	xmm2[16];
98	unsigned char	xmm3[16];
99	unsigned char	xmm4[16];
100	unsigned char	xmm5[16];
101	unsigned char	xmm6[16];
102	unsigned char	xmm7[16];
103} xmmx_regs;
104
105typedef struct new_extended_regs {
106	unsigned short	fp_control;
107	unsigned short	fp_status;
108	unsigned short	fp_tag;
109	unsigned short	fp_opcode;
110	unsigned long	fp_eip;
111	unsigned short	fp_cs;
112	unsigned short	res_14_15;
113	unsigned long	fp_datap;
114	unsigned short	fp_ds;
115	unsigned short	_reserved_22_23;
116	unsigned long	mxcsr;
117	unsigned long	_reserved_28_31;
118	union {
119		fp_stack fp;
120		mmx_regs mmx;
121	} fp_mmx;
122	xmmx_regs xmmx;
123	unsigned char	_reserved_288_511[224];
124} new_extended_regs;
125
126typedef struct extended_regs {
127	union {
128		old_extended_regs	old_format;
129		new_extended_regs	new_format;
130	} state;
131	unsigned long	format;
132} extended_regs;
133
134struct vregs {
135	unsigned long			eip;
136	unsigned long			eflags;
137	unsigned long			eax;
138	unsigned long			ecx;
139	unsigned long			edx;
140	unsigned long			esp;
141	unsigned long			ebp;
142	unsigned long			_reserved_1;
143	extended_regs	xregs;
144	unsigned long			edi;
145	unsigned long			esi;
146	unsigned long			ebx;
147};
148
149#endif /* __i386__ */
150
151#endif /* _ARCH_SIGNAL_H_ */
152