linux_machdep.h revision 1.11 1 1.11 matt /* $NetBSD: linux_machdep.h,v 1.11 2011/02/20 08:14:10 matt Exp $ */
2 1.1 manu
3 1.1 manu /*-
4 1.1 manu * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
5 1.1 manu * All rights reserved.
6 1.1 manu *
7 1.1 manu * This code is derived from software contributed to The NetBSD Foundation
8 1.1 manu * by Frank van der Linden and Emmanuel Dreyfus.
9 1.1 manu *
10 1.1 manu * Redistribution and use in source and binary forms, with or without
11 1.1 manu * modification, are permitted provided that the following conditions
12 1.1 manu * are met:
13 1.1 manu * 1. Redistributions of source code must retain the above copyright
14 1.1 manu * notice, this list of conditions and the following disclaimer.
15 1.1 manu * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 manu * notice, this list of conditions and the following disclaimer in the
17 1.1 manu * documentation and/or other materials provided with the distribution.
18 1.1 manu *
19 1.1 manu * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 manu * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 manu * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 manu * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 manu * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 manu * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 manu * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 manu * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 manu * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 manu * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 manu * POSSIBILITY OF SUCH DAMAGE.
30 1.1 manu */
31 1.1 manu
32 1.1 manu #ifndef _MIPS_LINUX_MACHDEP_H
33 1.1 manu #define _MIPS_LINUX_MACHDEP_H
34 1.1 manu
35 1.7 chs #include <compat/linux/common/linux_types.h>
36 1.1 manu #include <compat/linux/common/linux_signal.h>
37 1.7 chs #include <compat/linux/common/linux_siginfo.h>
38 1.1 manu
39 1.6 perry /*
40 1.6 perry * From Linux's include/asm-mips64/sigcontext.h
41 1.3 manu */
42 1.11 matt #ifndef __mips_o32
43 1.11 matt struct linux_sigcontext { /* N32 too */
44 1.11 matt uint64_t lsc_regs[32];
45 1.11 matt uint64_t lsc_fpregs[32];
46 1.11 matt uint64_t lsc_mdhi;
47 1.11 matt uint64_t lsc_hi1;
48 1.11 matt uint64_t lsc_hi2;
49 1.11 matt uint64_t lsc_hi3;
50 1.11 matt uint64_t lsc_mdlo;
51 1.11 matt uint64_t lsc_lo1;
52 1.11 matt uint64_t lsc_lo2;
53 1.11 matt uint64_t lsc_lo3;
54 1.11 matt uint64_t lsc_pc;
55 1.11 matt uint32_t lsc_fpc_csr;
56 1.11 matt uint32_t lsc_ownedfp;
57 1.11 matt uint32_t lsc_dsp;
58 1.11 matt uint32_t lsc_reserved;
59 1.11 matt };
60 1.11 matt #endif
61 1.11 matt
62 1.6 perry /*
63 1.6 perry * From Linux's include/asm-mips/sigcontext.h
64 1.1 manu */
65 1.11 matt struct
66 1.11 matt #ifdef __mips_o32
67 1.11 matt linux_sigcontext
68 1.11 matt #else
69 1.11 matt linux_sigcontext32
70 1.11 matt #endif
71 1.11 matt {
72 1.11 matt uint32_t lsc_regmask; /* Unused */
73 1.11 matt uint32_t lsc_status;
74 1.11 matt uint64_t lsc_pc;
75 1.11 matt uint64_t lsc_regs[32];
76 1.11 matt uint64_t lsc_fpregs[32]; /* Unused */
77 1.11 matt uint32_t lsc_acx; /* Was owned_fp */
78 1.11 matt uint32_t lsc_fpc_csr; /* Unused */
79 1.11 matt uint32_t lsc_fpc_eir; /* Unused */
80 1.11 matt uint32_t lsc_used_math; /* Unused */
81 1.11 matt uint32_t lsc_dsp; /* dsp status; was ssflags */
82 1.11 matt uint64_t lsc_mdhi;
83 1.11 matt uint64_t lsc_mdlo;
84 1.11 matt uint32_t lsc_hi1; /* Unused; was cause */
85 1.11 matt uint32_t lsc_lo1; /* Unused; was badvddr */
86 1.11 matt uint32_t lsc_sigset[4]; /* kernel's sigset_t */
87 1.1 manu };
88 1.1 manu
89 1.1 manu /*
90 1.1 manu * From Linux's include/asm-mips/elf.h
91 1.1 manu */
92 1.1 manu #define LINUX_ELF_NGREG 45
93 1.1 manu #define LINUX_ELF_NFPREG 33
94 1.1 manu typedef unsigned long linux_elf_greg_t;
95 1.1 manu typedef linux_elf_greg_t linux_elf_gregset_t[LINUX_ELF_NGREG];
96 1.1 manu
97 1.11 matt #ifndef __mips_o32
98 1.11 matt typedef struct linux_sigaltstack32 {
99 1.11 matt int32_t ss_sp;
100 1.11 matt uint32_t ss_size;
101 1.11 matt int ss_flags;
102 1.11 matt } linux_stack32_t;
103 1.11 matt #endif /* !mips_o32 */
104 1.11 matt
105 1.1 manu /*
106 1.1 manu * From Linux's arch/mips/kernel/signal.c
107 1.1 manu */
108 1.1 manu struct linux_sigframe {
109 1.11 matt uint32_t lsf_ass[4];
110 1.11 matt uint32_t lsf_code[2];
111 1.1 manu struct linux_sigcontext lsf_sc;
112 1.3 manu linux_sigset_t lsf_mask;
113 1.1 manu };
114 1.1 manu
115 1.11 matt #ifndef __mips_o32
116 1.11 matt struct linux_sigframe32 {
117 1.11 matt uint32_t lsf_ass[4];
118 1.11 matt uint32_t lsf_code[2];
119 1.11 matt struct linux_sigcontext32 lsf_sc;
120 1.11 matt linux_sigset_t lsf_mask;
121 1.11 matt };
122 1.11 matt #endif /* !mips_o32 */
123 1.11 matt
124 1.1 manu /*
125 1.1 manu * From Linux's include/asm-mips/ucontext.h
126 1.1 manu */
127 1.1 manu struct linux_ucontext {
128 1.1 manu unsigned long luc_flags;
129 1.1 manu struct linux_ucontext *luc_link;
130 1.1 manu linux_stack_t luc_stack;
131 1.1 manu struct linux_sigcontext luc_mcontext;
132 1.1 manu linux_sigset_t luc_sigmask;
133 1.1 manu };
134 1.1 manu
135 1.11 matt #ifndef __mips_o32
136 1.11 matt struct linux_ucontext32 {
137 1.11 matt uint32_t luc_flags;
138 1.11 matt int32_t luc_link;
139 1.11 matt linux_stack32_t luc_stack;
140 1.11 matt struct linux_sigcontext32 luc_mcontext;
141 1.11 matt linux_sigset_t luc_sigmask;
142 1.11 matt };
143 1.11 matt
144 1.11 matt struct linux_ucontextn32 {
145 1.11 matt uint32_t luc_flags;
146 1.11 matt int32_t luc_link;
147 1.11 matt linux_stack32_t luc_stack;
148 1.11 matt struct linux_sigcontext luc_mcontext;
149 1.11 matt linux_sigset_t luc_sigmask;
150 1.11 matt };
151 1.11 matt
152 1.11 matt #endif /* !__mips_o32 */
153 1.11 matt
154 1.1 manu /*
155 1.3 manu * From Linux's arch/mips/kernel/signal.c
156 1.1 manu */
157 1.11 matt struct linux_rt_sigframe {
158 1.11 matt uint32_t lrs_ass[4];
159 1.11 matt uint32_t lrs_code[2];
160 1.1 manu struct linux_siginfo lrs_info;
161 1.1 manu struct linux_ucontext lrs_uc;
162 1.1 manu };
163 1.4 manu
164 1.11 matt #ifndef __mips_o32
165 1.11 matt /*
166 1.11 matt * From Linux's arch/mips/kernel/signal.c
167 1.11 matt */
168 1.11 matt struct linux_rt_sigframe32 {
169 1.11 matt uint32_t lrs_ass[4];
170 1.11 matt uint32_t lrs_code[2];
171 1.11 matt struct linux_siginfo lrs_info;
172 1.11 matt struct linux_ucontext32 lrs_uc;
173 1.11 matt };
174 1.11 matt #endif /* !__mips_o32 */
175 1.11 matt
176 1.4 manu /*
177 1.4 manu * From Linux's include/asm-mips/sysmips.h
178 1.4 manu */
179 1.4 manu #define LINUX_SETNAME 1 /* set hostname */
180 1.4 manu #define LINUX_FLUSH_CACHE 3 /* writeback and invalidate caches */
181 1.4 manu #define LINUX_MIPS_FIXADE 7 /* control address error fixing */
182 1.4 manu #define LINUX_MIPS_RDNVRAM 10 /* read NVRAM */
183 1.4 manu #define LINUX_MIPS_ATOMIC_SET 2001 /* atomically set variable */
184 1.4 manu
185 1.4 manu /*
186 1.4 manu * From Linux's include/linux/utsname.h
187 1.4 manu */
188 1.6 perry #define LINUX___NEW_UTS_LEN 64
189 1.1 manu
190 1.1 manu /*
191 1.1 manu * Major device numbers of VT device on both Linux and NetBSD. Used in
192 1.1 manu * ugly patch to fake device numbers.
193 1.1 manu *
194 1.1 manu * LINUX_CONS_MAJOR is from Linux's include/linux/major.h
195 1.1 manu */
196 1.6 perry #define LINUX_CONS_MAJOR 4
197 1.1 manu #define NETBSD_WSCONS_MAJOR 47 /* XXX */
198 1.1 manu
199 1.1 manu /*
200 1.1 manu * Linux ioctl calls for the keyboard.
201 1.1 manu *
202 1.6 perry * From Linux's include/linux/kd.h
203 1.1 manu */
204 1.1 manu #define LINUX_KDGKBMODE 0x4b44
205 1.1 manu #define LINUX_KDSKBMODE 0x4b45
206 1.1 manu #define LINUX_KDMKTONE 0x4b30
207 1.1 manu #define LINUX_KDSETMODE 0x4b3a
208 1.1 manu #define LINUX_KDENABIO 0x4b36
209 1.1 manu #define LINUX_KDDISABIO 0x4b37
210 1.1 manu #define LINUX_KDGETLED 0x4b31
211 1.1 manu #define LINUX_KDSETLED 0x4b32
212 1.1 manu #define LINUX_KDGKBTYPE 0x4B33
213 1.1 manu #define LINUX_KDGKBENT 0x4B46
214 1.1 manu
215 1.1 manu /*
216 1.1 manu * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
217 1.1 manu *
218 1.1 manu * From Linux's include/linux/kd.h
219 1.1 manu */
220 1.1 manu #define LINUX_K_MEDIUMRAW 2
221 1.1 manu
222 1.1 manu /*
223 1.6 perry * VT ioctl calls in Linux (the ones that the pcvt emulation in
224 1.1 manu * wscons can handle)
225 1.1 manu *
226 1.1 manu * From Linux's include/linux/vt.h
227 1.1 manu */
228 1.1 manu #define LINUX_VT_OPENQRY 0x5600
229 1.1 manu #define LINUX_VT_GETMODE 0x5601
230 1.1 manu #define LINUX_VT_SETMODE 0x5602
231 1.1 manu #define LINUX_VT_GETSTATE 0x5603
232 1.1 manu #define LINUX_VT_RELDISP 0x5605
233 1.1 manu #define LINUX_VT_ACTIVATE 0x5606
234 1.1 manu #define LINUX_VT_WAITACTIVE 0x5607
235 1.1 manu #define LINUX_VT_DISALLOCATE 0x5608
236 1.1 manu
237 1.1 manu /*
238 1.1 manu * This range used by VMWare (XXX)
239 1.1 manu *
240 1.1 manu * From Linux's include/linux/vt.h
241 1.1 manu * XXX not needed for mips
242 1.1 manu */
243 1.1 manu #define LINUX_VMWARE_NONE 200
244 1.1 manu #define LINUX_VMWARE_LAST 237
245 1.1 manu
246 1.1 manu /*
247 1.10 ad * Range of ioctls to just pass on, so that modules (like VMWare) can
248 1.1 manu * handle them.
249 1.6 perry *
250 1.1 manu * From Linux's include/linux/vt.h
251 1.1 manu */
252 1.1 manu #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE
253 1.1 manu #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8)
254 1.1 manu
255 1.1 manu #ifdef _KERNEL
256 1.1 manu __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */
257 1.8 dsl void linux_syscall_intern(struct proc *);
258 1.1 manu __END_DECLS
259 1.1 manu #endif /* !_KERNEL */
260 1.1 manu
261 1.1 manu #endif /* _MIPS_LINUX_MACHDEP_H */
262