1 /* $NetBSD: linux_machdep.h,v 1.9 2008/04/28 20:23:43 martin Exp $ */
4 * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Emmanuel Dreyfus.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MIPS_LINUX_MACHDEP_H
33 #define _MIPS_LINUX_MACHDEP_H
35 #include <compat/linux/common/linux_types.h>
36 #include <compat/linux/common/linux_signal.h>
37 #include <compat/linux/common/linux_siginfo.h>
39 #if defined(ELFSIZE) && (ELFSIZE == 64)
41 * From Linux's include/asm-mips64/sigcontext.h
43 struct linux_sigcontext
{
44 unsigned long long sc_regs
[32];
45 unsigned long long sc_fpregs
[32];
46 unsigned long long sc_mdhi
;
47 unsigned long long sc_mdlo
;
48 unsigned long long sc_pc
;
49 unsigned int sc_status
;
50 unsigned int sc_ownedfp
;
51 unsigned int sc_fpc_csr
;
52 unsigned int sc_fpc_eir
;
53 unsigned int sc_cause
;
54 unsigned int sc_badvaddr
;
58 * From Linux's include/asm-mips/sigcontext.h
60 struct linux_sigcontext
{
61 unsigned int lsc_regmask
; /* Unused */
62 unsigned int lsc_status
;
63 unsigned long long lsc_pc
;
64 unsigned long long lsc_regs
[32];
65 unsigned long long lsc_fpregs
[32]; /* Unused */
66 unsigned int lsc_ownedfp
;
67 unsigned int lsc_fpc_csr
; /* Unused */
68 unsigned int lsc_fpc_eir
; /* Unused */
69 unsigned int lsc_ssflags
; /* Unused */
70 unsigned long long lsc_mdhi
;
71 unsigned long long lsc_mdlo
;
72 unsigned int lsc_cause
; /* Unused */
73 unsigned int lsc_badvaddr
; /* Unused */
74 unsigned long lsc_sigset
[4]; /* kernel's sigset_t */
79 * From Linux's include/asm-mips/elf.h
81 #define LINUX_ELF_NGREG 45
82 #define LINUX_ELF_NFPREG 33
83 typedef unsigned long linux_elf_greg_t
;
84 typedef linux_elf_greg_t linux_elf_gregset_t
[LINUX_ELF_NGREG
];
87 * From Linux's arch/mips/kernel/signal.c
89 struct linux_sigframe
{
90 unsigned int lsf_ass
[4];
91 unsigned int lsf_code
[2];
92 struct linux_sigcontext lsf_sc
;
93 linux_sigset_t lsf_mask
;
97 * From Linux's include/asm-mips/ucontext.h
99 struct linux_ucontext
{
100 unsigned long luc_flags
;
101 struct linux_ucontext
*luc_link
;
102 linux_stack_t luc_stack
;
103 struct linux_sigcontext luc_mcontext
;
104 linux_sigset_t luc_sigmask
;
108 * From Linux's arch/mips/kernel/signal.c
110 struct linux_rt_sigframe
112 unsigned int lrs_ass
[4];
113 unsigned int lrs_code
[2];
114 struct linux_siginfo lrs_info
;
115 struct linux_ucontext lrs_uc
;
119 * From Linux's include/asm-mips/sysmips.h
121 #define LINUX_SETNAME 1 /* set hostname */
122 #define LINUX_FLUSH_CACHE 3 /* writeback and invalidate caches */
123 #define LINUX_MIPS_FIXADE 7 /* control address error fixing */
124 #define LINUX_MIPS_RDNVRAM 10 /* read NVRAM */
125 #define LINUX_MIPS_ATOMIC_SET 2001 /* atomically set variable */
128 * From Linux's include/linux/utsname.h
130 #define LINUX___NEW_UTS_LEN 64
133 * Major device numbers of VT device on both Linux and NetBSD. Used in
134 * ugly patch to fake device numbers.
136 * LINUX_CONS_MAJOR is from Linux's include/linux/major.h
138 #define LINUX_CONS_MAJOR 4
139 #define NETBSD_WSCONS_MAJOR 47 /* XXX */
142 * Linux ioctl calls for the keyboard.
144 * From Linux's include/linux/kd.h
146 #define LINUX_KDGKBMODE 0x4b44
147 #define LINUX_KDSKBMODE 0x4b45
148 #define LINUX_KDMKTONE 0x4b30
149 #define LINUX_KDSETMODE 0x4b3a
150 #define LINUX_KDENABIO 0x4b36
151 #define LINUX_KDDISABIO 0x4b37
152 #define LINUX_KDGETLED 0x4b31
153 #define LINUX_KDSETLED 0x4b32
154 #define LINUX_KDGKBTYPE 0x4B33
155 #define LINUX_KDGKBENT 0x4B46
158 * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
160 * From Linux's include/linux/kd.h
162 #define LINUX_K_MEDIUMRAW 2
165 * VT ioctl calls in Linux (the ones that the pcvt emulation in
168 * From Linux's include/linux/vt.h
170 #define LINUX_VT_OPENQRY 0x5600
171 #define LINUX_VT_GETMODE 0x5601
172 #define LINUX_VT_SETMODE 0x5602
173 #define LINUX_VT_GETSTATE 0x5603
174 #define LINUX_VT_RELDISP 0x5605
175 #define LINUX_VT_ACTIVATE 0x5606
176 #define LINUX_VT_WAITACTIVE 0x5607
177 #define LINUX_VT_DISALLOCATE 0x5608
180 * This range used by VMWare (XXX)
182 * From Linux's include/linux/vt.h
183 * XXX not needed for mips
185 #define LINUX_VMWARE_NONE 200
186 #define LINUX_VMWARE_LAST 237
189 * Range of ioctls to just pass on, so that modules (like VMWare) can
192 * From Linux's include/linux/vt.h
194 #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE
195 #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8)
198 __BEGIN_DECLS
/* XXX from NetBSD/i386. Not arch dependent? */
199 void linux_syscall_intern(struct proc
*);
201 #endif /* !_KERNEL */
203 #endif /* _MIPS_LINUX_MACHDEP_H */