xref: /netbsd-src/sys/compat/linux/arch/mips/linux_machdep.h (revision 1ca5c1b28139779176bd5c13ad7c5f25c0bcd5f8)
1 /* $NetBSD: linux_machdep.h,v 1.4 2001/09/30 20:52:40 manu Exp $ */
2 
3 /*-
4  * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Frank van der Linden and Emmanuel Dreyfus.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _MIPS_LINUX_MACHDEP_H
40 #define _MIPS_LINUX_MACHDEP_H
41 
42 #include <compat/linux/common/linux_signal.h>
43 
44 #if defined(ELFSIZE) && (ELFSIZE == 64)
45 /*
46  * From Linux's include/asm-mips64/sigcontext.h
47  */
48 struct linux_sigcontext {
49 	unsigned long long sc_regs[32];
50 	unsigned long long sc_fpregs[32];
51 	unsigned long long sc_mdhi;
52 	unsigned long long sc_mdlo;
53 	unsigned long long sc_pc;
54 	unsigned int sc_status;
55 	unsigned int sc_ownedfp;
56 	unsigned int sc_fpc_csr;
57 	unsigned int sc_fpc_eir;
58 	unsigned int sc_cause;
59 	unsigned int sc_badvaddr;
60 }
61 #else
62 /*
63  * From Linux's include/asm-mips/sigcontext.h
64  */
65 struct linux_sigcontext {
66 	unsigned int lsc_regmask;		/* Unused */
67 	unsigned int lsc_status;
68 	unsigned long long lsc_pc;
69 	unsigned long long lsc_regs[32];
70 	unsigned long long lsc_fpregs[32];	/* Unused */
71 	unsigned int lsc_ownedfp;
72 	unsigned int lsc_fpc_csr;		/* Unused */
73 	unsigned int lsc_fpc_eir;		/* Unused */
74 	unsigned int lsc_ssflags;		/* Unused */
75 	unsigned long long lsc_mdhi;
76 	unsigned long long lsc_mdlo;
77 	unsigned int lsc_cause;	  		/* Unused */
78 	unsigned int lsc_badvaddr;	  	/* Unused */
79 	unsigned long lsc_sigset[4]; 		/* kernel's sigset_t */
80 };
81 #endif
82 
83 /*
84  * From Linux's include/asm-mips/elf.h
85  */
86 #define LINUX_ELF_NGREG 45
87 #define LINUX_ELF_NFPREG 33
88 typedef unsigned long linux_elf_greg_t;
89 typedef linux_elf_greg_t linux_elf_gregset_t[LINUX_ELF_NGREG];
90 
91 /*
92  * From Linux's arch/mips/kernel/signal.c
93  */
94 struct linux_sigframe {
95 	unsigned int lsf_ass[4];
96 	unsigned int lsf_code[2];
97 	struct linux_sigcontext lsf_sc;
98 	linux_sigset_t lsf_mask;
99 };
100 
101 /*
102  * From Linux's include/asm-mips/ucontext.h
103  */
104 struct linux_ucontext {
105 	unsigned long luc_flags;
106 	struct linux_ucontext *luc_link;
107 	linux_stack_t luc_stack;
108 	struct linux_sigcontext luc_mcontext;
109 	linux_sigset_t luc_sigmask;
110 };
111 
112 /*
113  * From Linux's arch/mips/kernel/signal.c
114  */
115 struct linux_rt_sigframe
116 {
117 	unsigned int lrs_ass[4];
118 	unsigned int lrs_code[2];
119 	struct linux_siginfo lrs_info;
120 	struct linux_ucontext lrs_uc;
121 };
122 
123 /*
124  * From Linux's include/asm-mips/sysmips.h
125  */
126 #define LINUX_SETNAME		1	/* set hostname                  */
127 #define LINUX_FLUSH_CACHE	3	/* writeback and invalidate caches */
128 #define LINUX_MIPS_FIXADE	7	/* control address error fixing  */
129 #define LINUX_MIPS_RDNVRAM	10	/* read NVRAM */
130 #define LINUX_MIPS_ATOMIC_SET	2001	/* atomically set variable       */
131 
132 /*
133  * From Linux's include/linux/utsname.h
134  */
135 #define LINUX___NEW_UTS_LEN	64
136 
137 #ifdef _KERNEL
138 __BEGIN_DECLS
139 void linux_sendsig __P((sig_t, int, sigset_t *, u_long));
140 dev_t linux_fakedev __P((dev_t));
141 __END_DECLS
142 #endif /* _KERNEL */
143 
144 /*
145  * Major device numbers of VT device on both Linux and NetBSD. Used in
146  * ugly patch to fake device numbers.
147  *
148  * LINUX_CONS_MAJOR is from Linux's include/linux/major.h
149  */
150 #define LINUX_CONS_MAJOR 4
151 #define NETBSD_WSCONS_MAJOR 47 /* XXX */
152 
153 /*
154  * Linux ioctl calls for the keyboard.
155  *
156  * From Linux's include/linux/kd.h
157  */
158 #define LINUX_KDGKBMODE	0x4b44
159 #define LINUX_KDSKBMODE	0x4b45
160 #define LINUX_KDMKTONE	0x4b30
161 #define LINUX_KDSETMODE	0x4b3a
162 #define LINUX_KDENABIO	0x4b36
163 #define LINUX_KDDISABIO	0x4b37
164 #define LINUX_KDGETLED	0x4b31
165 #define LINUX_KDSETLED	0x4b32
166 #define LINUX_KDGKBTYPE	0x4B33
167 #define LINUX_KDGKBENT	0x4B46
168 
169 /*
170  * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
171  *
172  * From Linux's include/linux/kd.h
173  */
174 #define LINUX_K_MEDIUMRAW 2
175 
176 /*
177  * VT ioctl calls in Linux (the ones that the pcvt emulation in
178  * wscons can handle)
179  *
180  * From Linux's include/linux/vt.h
181  */
182 #define LINUX_VT_OPENQRY	0x5600
183 #define LINUX_VT_GETMODE	0x5601
184 #define LINUX_VT_SETMODE	0x5602
185 #define LINUX_VT_GETSTATE	0x5603
186 #define LINUX_VT_RELDISP	0x5605
187 #define LINUX_VT_ACTIVATE	0x5606
188 #define LINUX_VT_WAITACTIVE 	0x5607
189 #define LINUX_VT_DISALLOCATE	0x5608
190 
191 /*
192  * This range used by VMWare (XXX)
193  *
194  * From Linux's include/linux/vt.h
195  * XXX not needed for mips
196  */
197 #define LINUX_VMWARE_NONE 200
198 #define LINUX_VMWARE_LAST 237
199 
200 /*
201  * Range of ioctls to just pass on, so that LKMs (like VMWare) can
202  * handle them.
203  *
204  * From Linux's include/linux/vt.h
205  */
206 #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE
207 #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8)
208 
209 #ifdef _KERNEL
210 __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */
211 void linux_syscall_intern __P((struct proc *));
212 __END_DECLS
213 #endif /* !_KERNEL */
214 
215 #endif /* _MIPS_LINUX_MACHDEP_H */
216