1 /* $NetBSD: linux_machdep.h,v 1.10 2008/11/12 12:36:10 ad 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 * 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. 30 */ 31 32 #ifndef _MIPS_LINUX_MACHDEP_H 33 #define _MIPS_LINUX_MACHDEP_H 34 35 #include <compat/linux/common/linux_types.h> 36 #include <compat/linux/common/linux_signal.h> 37 #include <compat/linux/common/linux_siginfo.h> 38 39 #if defined(ELFSIZE) && (ELFSIZE == 64) 40 /* 41 * From Linux's include/asm-mips64/sigcontext.h 42 */ 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; 55 } 56 #else 57 /* 58 * From Linux's include/asm-mips/sigcontext.h 59 */ 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 */ 75 }; 76 #endif 77 78 /* 79 * From Linux's include/asm-mips/elf.h 80 */ 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]; 85 86 /* 87 * From Linux's arch/mips/kernel/signal.c 88 */ 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; 94 }; 95 96 /* 97 * From Linux's include/asm-mips/ucontext.h 98 */ 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; 105 }; 106 107 /* 108 * From Linux's arch/mips/kernel/signal.c 109 */ 110 struct linux_rt_sigframe 111 { 112 unsigned int lrs_ass[4]; 113 unsigned int lrs_code[2]; 114 struct linux_siginfo lrs_info; 115 struct linux_ucontext lrs_uc; 116 }; 117 118 /* 119 * From Linux's include/asm-mips/sysmips.h 120 */ 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 */ 126 127 /* 128 * From Linux's include/linux/utsname.h 129 */ 130 #define LINUX___NEW_UTS_LEN 64 131 132 /* 133 * Major device numbers of VT device on both Linux and NetBSD. Used in 134 * ugly patch to fake device numbers. 135 * 136 * LINUX_CONS_MAJOR is from Linux's include/linux/major.h 137 */ 138 #define LINUX_CONS_MAJOR 4 139 #define NETBSD_WSCONS_MAJOR 47 /* XXX */ 140 141 /* 142 * Linux ioctl calls for the keyboard. 143 * 144 * From Linux's include/linux/kd.h 145 */ 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 156 157 /* 158 * Mode for KDSKBMODE which we don't have (we just use plain mode for this) 159 * 160 * From Linux's include/linux/kd.h 161 */ 162 #define LINUX_K_MEDIUMRAW 2 163 164 /* 165 * VT ioctl calls in Linux (the ones that the pcvt emulation in 166 * wscons can handle) 167 * 168 * From Linux's include/linux/vt.h 169 */ 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 178 179 /* 180 * This range used by VMWare (XXX) 181 * 182 * From Linux's include/linux/vt.h 183 * XXX not needed for mips 184 */ 185 #define LINUX_VMWARE_NONE 200 186 #define LINUX_VMWARE_LAST 237 187 188 /* 189 * Range of ioctls to just pass on, so that modules (like VMWare) can 190 * handle them. 191 * 192 * From Linux's include/linux/vt.h 193 */ 194 #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE 195 #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8) 196 197 #ifdef _KERNEL 198 __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */ 199 void linux_syscall_intern(struct proc *); 200 __END_DECLS 201 #endif /* !_KERNEL */ 202 203 #endif /* _MIPS_LINUX_MACHDEP_H */ 204