1 /* $NetBSD: linux_machdep.h,v 1.2 2001/09/02 08:39:37 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 struct linux_sigcontext { 46 unsigned long long sc_regs[32]; 47 unsigned long long sc_fpregs[32]; 48 unsigned long long sc_mdhi; 49 unsigned long long sc_mdlo; 50 unsigned long long sc_pc; 51 unsigned int sc_status; 52 unsigned int sc_ownedfp; 53 unsigned int sc_fpc_csr; 54 unsigned int sc_fpc_eir; 55 unsigned int sc_cause; 56 unsigned int sc_badvaddr; 57 } 58 #else 59 /* 60 * From Linux's include/asm-mips64/sigcontext.h 61 */ 62 struct linux_sigcontext { 63 unsigned int lsc_regmask; /* Unused */ 64 unsigned int lsc_status; 65 unsigned long long lsc_pc; 66 unsigned long long lsc_regs[32]; 67 unsigned long long lsc_fpregs[32]; /* Unused */ 68 unsigned int lsc_ownedfp; 69 unsigned int lsc_fpc_csr; /* Unused */ 70 unsigned int lsc_fpc_eir; /* Unused */ 71 unsigned int lsc_ssflags; /* Unused */ 72 unsigned long long lsc_mdhi; 73 unsigned long long lsc_mdlo; 74 unsigned int lsc_cause; /* Unused */ 75 unsigned int lsc_badvaddr; /* Unused */ 76 unsigned long lsc_sigset[4]; /* kernel's sigset_t */ 77 }; 78 #endif 79 80 /* 81 * From Linux's include/asm-mips/elf.h 82 */ 83 #define LINUX_ELF_NGREG 45 84 #define LINUX_ELF_NFPREG 33 85 typedef unsigned long linux_elf_greg_t; 86 typedef linux_elf_greg_t linux_elf_gregset_t[LINUX_ELF_NGREG]; 87 88 /* 89 * From Linux's arch/mips/kernel/signal.c 90 */ 91 struct linux_sigframe { 92 unsigned int lsf_ass[4]; 93 unsigned int lsf_code[2]; 94 struct linux_sigcontext lsf_sc; 95 sigset_t lsf_mask; 96 }; 97 98 /* 99 * From Linux's include/asm-mips/ucontext.h 100 */ 101 struct linux_ucontext { 102 unsigned long luc_flags; 103 struct linux_ucontext *luc_link; 104 linux_stack_t luc_stack; 105 struct linux_sigcontext luc_mcontext; 106 linux_sigset_t luc_sigmask; 107 }; 108 109 /* 110 * From Linux's arch/mips/kernel/signal.c, the real rt_sigframe 111 */ 112 struct linux_rt_sigframe 113 { 114 unsigned int lrs_ass[4]; 115 unsigned int lrs_code[2]; 116 struct linux_siginfo lrs_info; 117 struct linux_ucontext lrs_uc; 118 }; 119 120 #ifdef _KERNEL 121 __BEGIN_DECLS 122 void linux_sendsig __P((sig_t, int, sigset_t *, u_long)); 123 dev_t linux_fakedev __P((dev_t)); 124 __END_DECLS 125 #endif /* _KERNEL */ 126 127 /* 128 * Major device numbers of VT device on both Linux and NetBSD. Used in 129 * ugly patch to fake device numbers. 130 * 131 * LINUX_CONS_MAJOR is from Linux's include/linux/major.h 132 */ 133 #define LINUX_CONS_MAJOR 4 134 #define NETBSD_WSCONS_MAJOR 47 /* XXX */ 135 136 /* 137 * Linux ioctl calls for the keyboard. 138 * 139 * From Linux's include/linux/kd.h 140 */ 141 #define LINUX_KDGKBMODE 0x4b44 142 #define LINUX_KDSKBMODE 0x4b45 143 #define LINUX_KDMKTONE 0x4b30 144 #define LINUX_KDSETMODE 0x4b3a 145 #define LINUX_KDENABIO 0x4b36 146 #define LINUX_KDDISABIO 0x4b37 147 #define LINUX_KDGETLED 0x4b31 148 #define LINUX_KDSETLED 0x4b32 149 #define LINUX_KDGKBTYPE 0x4B33 150 #define LINUX_KDGKBENT 0x4B46 151 152 /* 153 * Mode for KDSKBMODE which we don't have (we just use plain mode for this) 154 * 155 * From Linux's include/linux/kd.h 156 */ 157 #define LINUX_K_MEDIUMRAW 2 158 159 /* 160 * VT ioctl calls in Linux (the ones that the pcvt emulation in 161 * wscons can handle) 162 * 163 * From Linux's include/linux/vt.h 164 */ 165 #define LINUX_VT_OPENQRY 0x5600 166 #define LINUX_VT_GETMODE 0x5601 167 #define LINUX_VT_SETMODE 0x5602 168 #define LINUX_VT_GETSTATE 0x5603 169 #define LINUX_VT_RELDISP 0x5605 170 #define LINUX_VT_ACTIVATE 0x5606 171 #define LINUX_VT_WAITACTIVE 0x5607 172 #define LINUX_VT_DISALLOCATE 0x5608 173 174 /* 175 * This range used by VMWare (XXX) 176 * 177 * From Linux's include/linux/vt.h 178 * XXX not needed for mips 179 */ 180 #define LINUX_VMWARE_NONE 200 181 #define LINUX_VMWARE_LAST 237 182 183 /* 184 * Range of ioctls to just pass on, so that LKMs (like VMWare) can 185 * handle them. 186 * 187 * From Linux's include/linux/vt.h 188 */ 189 #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE 190 #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8) 191 192 #ifdef _KERNEL 193 __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */ 194 void linux_syscall_intern __P((struct proc *)); 195 __END_DECLS 196 #endif /* !_KERNEL */ 197 198 #endif /* _MIPS_LINUX_MACHDEP_H */ 199