xref: /netbsd-src/sys/arch/amd64/include/netbsd32_machdep.h (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1 /*	$NetBSD: netbsd32_machdep.h,v 1.5 2004/02/20 16:11:44 drochner Exp $	*/
2 
3 #ifndef _MACHINE_NETBSD32_H_
4 #define _MACHINE_NETBSD32_H_
5 
6 #include <sys/ucontext.h>
7 
8 typedef	u_int32_t netbsd32_pointer_t;
9 #define	NETBSD32PTR64(p32)	((void *)(u_long)(u_int)(p32))
10 
11 typedef netbsd32_pointer_t netbsd32_sigcontextp_t;
12 
13 struct netbsd32_sigcontext13 {
14 	uint32_t	sc_gs;
15 	uint32_t	sc_fs;
16 	uint32_t	sc_es;
17 	uint32_t	sc_ds;
18 	uint32_t	sc_edi;
19 	uint32_t	sc_esi;
20 	uint32_t	sc_ebp;
21 	uint32_t	sc_ebx;
22 	uint32_t	sc_edx;
23 	uint32_t	sc_ecx;
24 	uint32_t	sc_eax;
25 	/* XXX */
26 	uint32_t	sc_eip;
27 	uint32_t	sc_cs;
28 	uint32_t	sc_eflags;
29 	uint32_t	sc_esp;
30 	uint32_t	sc_ss;
31 
32 	uint32_t	sc_onstack;	/* sigstack state to restore */
33 	uint32_t	sc_mask;	/* signal mask to restore (old style) */
34 
35 	uint32_t	sc_trapno;	/* XXX should be above */
36 	uint32_t	sc_err;
37 };
38 
39 struct netbsd32_sigcontext {
40 	uint32_t	sc_gs;
41 	uint32_t	sc_fs;
42 	uint32_t	sc_es;
43 	uint32_t	sc_ds;
44 	uint32_t	sc_edi;
45 	uint32_t	sc_esi;
46 	uint32_t	sc_ebp;
47 	uint32_t	sc_ebx;
48 	uint32_t	sc_edx;
49 	uint32_t	sc_ecx;
50 	uint32_t	sc_eax;
51 	/* XXX */
52 	uint32_t	sc_eip;
53 	uint32_t	sc_cs;
54 	uint32_t	sc_eflags;
55 	uint32_t	sc_esp;
56 	uint32_t	sc_ss;
57 
58 	uint32_t	sc_onstack;	/* sigstack state to restore */
59 	uint32_t	__sc_mask13;	/* signal mask to restore (old style) */
60 
61 	uint32_t	sc_trapno;	/* XXX should be above */
62 	uint32_t	sc_err;
63 
64 	sigset_t sc_mask;		/* signal mask to restore (new style) */
65 };
66 
67 #define sc_sp sc_esp
68 #define sc_fp sc_ebp
69 #define sc_pc sc_eip
70 #define sc_ps sc_eflags
71 
72 struct netbsd32_sigframe_sigcontext {
73 	uint32_t	sf_ra;
74 	int32_t		sf_signum;
75 	int32_t		sf_code;
76 	uint32_t	sf_scp;
77 	struct netbsd32_sigcontext sf_sc;
78 };
79 
80 struct netbsd32_sigframe_siginfo {
81 	uint32_t	sf_ra;
82 	int32_t		sf_signum;
83 	uint32_t	sf_sip;
84 	uint32_t	sf_ucp;
85 	siginfo32_t	sf_si;
86 	ucontext32_t	sf_uc;
87 };
88 
89 struct reg32 {
90 	int	r_eax;
91 	int	r_ecx;
92 	int	r_edx;
93 	int	r_ebx;
94 	int	r_esp;
95 	int	r_ebp;
96 	int	r_esi;
97 	int	r_edi;
98 	int	r_eip;
99 	int	r_eflags;
100 	int	r_cs;
101 	int	r_ss;
102 	int	r_ds;
103 	int	r_es;
104 	int	r_fs;
105 	int	r_gs;
106 };
107 
108 struct fpreg32 {
109 	char	__data[108];
110 };
111 
112 struct mtrr32 {
113 	uint64_t base;
114 	uint64_t len;
115 	uint8_t type;
116 	uint8_t __pad0[3];
117 	int flags;
118 	uint32_t owner;
119 } __attribute__((packed));
120 
121 struct x86_64_get_mtrr_args32 {
122 	uint32_t mtrrp;
123 	uint32_t n;
124 };
125 
126 struct x86_64_set_mtrr_args32 {
127 	uint32_t mtrrp;
128 	uint32_t n;
129 };
130 
131 #define NETBSD32_MID_MACHINE MID_I386
132 
133 #endif /* _MACHINE_NETBSD32_H_ */
134