linux_machdep.h revision 1.31 1 1.31 christos /* $NetBSD: linux_machdep.h,v 1.31 2007/06/13 02:11:40 christos Exp $ */
2 1.1 fvdl
3 1.9 fvdl /*-
4 1.16 mycroft * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
5 1.1 fvdl * All rights reserved.
6 1.1 fvdl *
7 1.9 fvdl * This code is derived from software contributed to The NetBSD Foundation
8 1.9 fvdl * by Frank van der Linden.
9 1.9 fvdl *
10 1.1 fvdl * Redistribution and use in source and binary forms, with or without
11 1.1 fvdl * modification, are permitted provided that the following conditions
12 1.1 fvdl * are met:
13 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
14 1.1 fvdl * notice, this list of conditions and the following disclaimer.
15 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
17 1.1 fvdl * documentation and/or other materials provided with the distribution.
18 1.1 fvdl * 3. All advertising materials mentioning features or use of this software
19 1.1 fvdl * must display the following acknowledgement:
20 1.9 fvdl * This product includes software developed by the NetBSD
21 1.9 fvdl * Foundation, Inc. and its contributors.
22 1.9 fvdl * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.9 fvdl * contributors may be used to endorse or promote products derived
24 1.9 fvdl * from this software without specific prior written permission.
25 1.1 fvdl *
26 1.9 fvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.9 fvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.9 fvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.9 fvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.9 fvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.9 fvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.9 fvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.9 fvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.9 fvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.9 fvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.9 fvdl * POSSIBILITY OF SUCH DAMAGE.
37 1.1 fvdl */
38 1.1 fvdl
39 1.8 erh #ifndef _I386_LINUX_MACHDEP_H
40 1.8 erh #define _I386_LINUX_MACHDEP_H
41 1.1 fvdl
42 1.24 christos #include <compat/linux/common/linux_types.h>
43 1.21 christos #include <compat/linux/common/linux_signal.h>
44 1.24 christos #include <compat/linux/common/linux_siginfo.h>
45 1.21 christos
46 1.1 fvdl /*
47 1.1 fvdl * The Linux sigcontext, pretty much a standard 386 trapframe.
48 1.1 fvdl */
49 1.25 christos struct linux_fpreg {
50 1.25 christos uint16_t mant[4];
51 1.25 christos uint16_t expo;
52 1.25 christos };
53 1.25 christos
54 1.25 christos struct linux_fpxreg {
55 1.25 christos uint16_t mant[4];
56 1.25 christos uint16_t expo;
57 1.25 christos uint16_t pad[3];
58 1.25 christos };
59 1.25 christos
60 1.25 christos struct linux_xmmreg {
61 1.25 christos uint32_t reg[4];
62 1.25 christos };
63 1.25 christos
64 1.25 christos struct linux_fpstate {
65 1.25 christos uint32_t cw;
66 1.25 christos uint32_t sw;
67 1.25 christos uint32_t tag;
68 1.25 christos uint32_t ipoff;
69 1.25 christos uint32_t cssel;
70 1.25 christos uint32_t dataoff;
71 1.25 christos uint32_t datasel;
72 1.25 christos struct linux_fpreg st[8];
73 1.25 christos uint16_t status;
74 1.25 christos uint16_t magic;
75 1.25 christos uint32_t fxsr_env[6];
76 1.25 christos uint32_t mxcsr;
77 1.25 christos uint32_t reserved;
78 1.25 christos struct linux_fpxreg fxsr_st[8];
79 1.25 christos struct linux_xmmreg xmm[8];
80 1.25 christos uint32_t padding[56];
81 1.25 christos };
82 1.25 christos
83 1.1 fvdl
84 1.1 fvdl struct linux_sigcontext {
85 1.3 mycroft int sc_gs;
86 1.3 mycroft int sc_fs;
87 1.7 mycroft int sc_es;
88 1.7 mycroft int sc_ds;
89 1.7 mycroft int sc_edi;
90 1.7 mycroft int sc_esi;
91 1.7 mycroft int sc_ebp;
92 1.3 mycroft int sc_esp;
93 1.7 mycroft int sc_ebx;
94 1.7 mycroft int sc_edx;
95 1.7 mycroft int sc_ecx;
96 1.7 mycroft int sc_eax;
97 1.7 mycroft int sc_trapno;
98 1.7 mycroft int sc_err;
99 1.7 mycroft int sc_eip;
100 1.7 mycroft int sc_cs;
101 1.7 mycroft int sc_eflags;
102 1.7 mycroft int sc_esp_at_signal;
103 1.7 mycroft int sc_ss;
104 1.25 christos struct linux_fpstate *sc_387;
105 1.10 fvdl /* XXX check this */
106 1.10 fvdl linux_old_sigset_t sc_mask;
107 1.3 mycroft int sc_cr2;
108 1.1 fvdl };
109 1.1 fvdl
110 1.26 christos struct linux_libc_fpreg {
111 1.26 christos unsigned short significand[4];
112 1.26 christos unsigned short exponent;
113 1.26 christos };
114 1.26 christos
115 1.26 christos struct linux_libc_fpstate {
116 1.26 christos unsigned long cw;
117 1.26 christos unsigned long sw;
118 1.26 christos unsigned long tag;
119 1.26 christos unsigned long ipoff;
120 1.26 christos unsigned long cssel;
121 1.26 christos unsigned long dataoff;
122 1.26 christos unsigned long datasel;
123 1.26 christos struct linux_libc_fpreg _st[8];
124 1.26 christos unsigned long status;
125 1.26 christos };
126 1.26 christos
127 1.26 christos struct linux_ucontext {
128 1.26 christos unsigned long uc_flags;
129 1.26 christos struct ucontext *uc_link;
130 1.26 christos struct linux_sigaltstack uc_stack;
131 1.26 christos struct linux_sigcontext uc_mcontext;
132 1.26 christos linux_sigset_t uc_sigmask;
133 1.26 christos struct linux_libc_fpstate uc_fpregs_mem;
134 1.26 christos };
135 1.26 christos
136 1.1 fvdl /*
137 1.1 fvdl * We make the stack look like Linux expects it when calling a signal
138 1.1 fvdl * handler, but use the BSD way of calling the handler and sigreturn().
139 1.1 fvdl * This means that we need to pass the pointer to the handler too.
140 1.1 fvdl * It is appended to the frame to not interfere with the rest of it.
141 1.1 fvdl */
142 1.25 christos struct linux_rt_sigframe {
143 1.3 mycroft int sf_sig;
144 1.24 christos struct linux_siginfo *sf_sip;
145 1.26 christos struct linux_ucontext *sf_ucp;
146 1.25 christos struct linux_siginfo sf_si;
147 1.26 christos struct linux_ucontext sf_uc;
148 1.24 christos sig_t sf_handler;
149 1.25 christos };
150 1.25 christos
151 1.25 christos struct linux_sigframe {
152 1.25 christos int sf_sig;
153 1.3 mycroft struct linux_sigcontext sf_sc;
154 1.25 christos sig_t sf_handler;
155 1.1 fvdl };
156 1.4 fvdl
157 1.4 fvdl /*
158 1.28 christos * Used in ugly patch to fake device numbers.
159 1.4 fvdl */
160 1.28 christos /* Major device numbers for new style ptys. */
161 1.28 christos #define LINUX_PTC_MAJOR 2
162 1.28 christos #define LINUX_PTS_MAJOR 3
163 1.28 christos /* Major device numbers of VT device on both Linux and NetBSD. */
164 1.28 christos #define LINUX_CONS_MAJOR 4
165 1.4 fvdl
166 1.4 fvdl /*
167 1.4 fvdl * Linux ioctl calls for the keyboard.
168 1.4 fvdl */
169 1.4 fvdl #define LINUX_KDGKBMODE 0x4b44
170 1.4 fvdl #define LINUX_KDSKBMODE 0x4b45
171 1.4 fvdl #define LINUX_KDMKTONE 0x4b30
172 1.4 fvdl #define LINUX_KDSETMODE 0x4b3a
173 1.19 fvdl #define LINUX_KDGETMODE 0x4b3b
174 1.4 fvdl #define LINUX_KDENABIO 0x4b36
175 1.4 fvdl #define LINUX_KDDISABIO 0x4b37
176 1.4 fvdl #define LINUX_KDGETLED 0x4b31
177 1.4 fvdl #define LINUX_KDSETLED 0x4b32
178 1.20 fvdl #define LINUX_KDGKBTYPE 0x4b33
179 1.20 fvdl #define LINUX_KDGKBENT 0x4b46
180 1.20 fvdl #define LINUX_KIOCSOUND 0x4b2f
181 1.6 drochner
182 1.4 fvdl /*
183 1.4 fvdl * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
184 1.4 fvdl */
185 1.4 fvdl #define LINUX_K_MEDIUMRAW 2
186 1.4 fvdl
187 1.4 fvdl /*
188 1.12 veego * VT ioctl calls in Linux (the ones that the pcvt emulation in wscons can handle)
189 1.4 fvdl */
190 1.4 fvdl #define LINUX_VT_OPENQRY 0x5600
191 1.4 fvdl #define LINUX_VT_GETMODE 0x5601
192 1.4 fvdl #define LINUX_VT_SETMODE 0x5602
193 1.6 drochner #define LINUX_VT_GETSTATE 0x5603
194 1.4 fvdl #define LINUX_VT_RELDISP 0x5605
195 1.4 fvdl #define LINUX_VT_ACTIVATE 0x5606
196 1.4 fvdl #define LINUX_VT_WAITACTIVE 0x5607
197 1.15 fvdl #define LINUX_VT_DISALLOCATE 0x5608
198 1.17 fvdl
199 1.17 fvdl /*
200 1.17 fvdl * This range used by VMWare (XXX)
201 1.17 fvdl */
202 1.17 fvdl #define LINUX_VMWARE_NONE 200
203 1.17 fvdl #define LINUX_VMWARE_LAST 237
204 1.17 fvdl
205 1.17 fvdl /*
206 1.17 fvdl * Range of ioctls to just pass on, so that LKMs (like VMWare) can
207 1.17 fvdl * handle them.
208 1.17 fvdl */
209 1.17 fvdl #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE
210 1.17 fvdl #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8)
211 1.13 jdolecek
212 1.30 christos #define LINUX_UNAME_ARCH linux_get_uname_arch()
213 1.31 christos #define LINUX_NPTL
214 1.30 christos
215 1.18 mycroft #ifdef _KERNEL
216 1.18 mycroft __BEGIN_DECLS
217 1.30 christos void linux_syscall_intern(struct proc *);
218 1.30 christos const char *linux_get_uname_arch(void);
219 1.18 mycroft __END_DECLS
220 1.18 mycroft #endif /* !_KERNEL */
221 1.1 fvdl
222 1.8 erh #endif /* _I386_LINUX_MACHDEP_H */
223