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