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