1 /* $NetBSD: linux_machdep.h,v 1.11 2011/02/20 08:14:10 matt 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 /* 40 * From Linux's include/asm-mips64/sigcontext.h 41 */ 42 #ifndef __mips_o32 43 struct linux_sigcontext { /* N32 too */ 44 uint64_t lsc_regs[32]; 45 uint64_t lsc_fpregs[32]; 46 uint64_t lsc_mdhi; 47 uint64_t lsc_hi1; 48 uint64_t lsc_hi2; 49 uint64_t lsc_hi3; 50 uint64_t lsc_mdlo; 51 uint64_t lsc_lo1; 52 uint64_t lsc_lo2; 53 uint64_t lsc_lo3; 54 uint64_t lsc_pc; 55 uint32_t lsc_fpc_csr; 56 uint32_t lsc_ownedfp; 57 uint32_t lsc_dsp; 58 uint32_t lsc_reserved; 59 }; 60 #endif 61 62 /* 63 * From Linux's include/asm-mips/sigcontext.h 64 */ 65 struct 66 #ifdef __mips_o32 67 linux_sigcontext 68 #else 69 linux_sigcontext32 70 #endif 71 { 72 uint32_t lsc_regmask; /* Unused */ 73 uint32_t lsc_status; 74 uint64_t lsc_pc; 75 uint64_t lsc_regs[32]; 76 uint64_t lsc_fpregs[32]; /* Unused */ 77 uint32_t lsc_acx; /* Was owned_fp */ 78 uint32_t lsc_fpc_csr; /* Unused */ 79 uint32_t lsc_fpc_eir; /* Unused */ 80 uint32_t lsc_used_math; /* Unused */ 81 uint32_t lsc_dsp; /* dsp status; was ssflags */ 82 uint64_t lsc_mdhi; 83 uint64_t lsc_mdlo; 84 uint32_t lsc_hi1; /* Unused; was cause */ 85 uint32_t lsc_lo1; /* Unused; was badvddr */ 86 uint32_t lsc_sigset[4]; /* kernel's sigset_t */ 87 }; 88 89 /* 90 * From Linux's include/asm-mips/elf.h 91 */ 92 #define LINUX_ELF_NGREG 45 93 #define LINUX_ELF_NFPREG 33 94 typedef unsigned long linux_elf_greg_t; 95 typedef linux_elf_greg_t linux_elf_gregset_t[LINUX_ELF_NGREG]; 96 97 #ifndef __mips_o32 98 typedef struct linux_sigaltstack32 { 99 int32_t ss_sp; 100 uint32_t ss_size; 101 int ss_flags; 102 } linux_stack32_t; 103 #endif /* !mips_o32 */ 104 105 /* 106 * From Linux's arch/mips/kernel/signal.c 107 */ 108 struct linux_sigframe { 109 uint32_t lsf_ass[4]; 110 uint32_t lsf_code[2]; 111 struct linux_sigcontext lsf_sc; 112 linux_sigset_t lsf_mask; 113 }; 114 115 #ifndef __mips_o32 116 struct linux_sigframe32 { 117 uint32_t lsf_ass[4]; 118 uint32_t lsf_code[2]; 119 struct linux_sigcontext32 lsf_sc; 120 linux_sigset_t lsf_mask; 121 }; 122 #endif /* !mips_o32 */ 123 124 /* 125 * From Linux's include/asm-mips/ucontext.h 126 */ 127 struct linux_ucontext { 128 unsigned long luc_flags; 129 struct linux_ucontext *luc_link; 130 linux_stack_t luc_stack; 131 struct linux_sigcontext luc_mcontext; 132 linux_sigset_t luc_sigmask; 133 }; 134 135 #ifndef __mips_o32 136 struct linux_ucontext32 { 137 uint32_t luc_flags; 138 int32_t luc_link; 139 linux_stack32_t luc_stack; 140 struct linux_sigcontext32 luc_mcontext; 141 linux_sigset_t luc_sigmask; 142 }; 143 144 struct linux_ucontextn32 { 145 uint32_t luc_flags; 146 int32_t luc_link; 147 linux_stack32_t luc_stack; 148 struct linux_sigcontext luc_mcontext; 149 linux_sigset_t luc_sigmask; 150 }; 151 152 #endif /* !__mips_o32 */ 153 154 /* 155 * From Linux's arch/mips/kernel/signal.c 156 */ 157 struct linux_rt_sigframe { 158 uint32_t lrs_ass[4]; 159 uint32_t lrs_code[2]; 160 struct linux_siginfo lrs_info; 161 struct linux_ucontext lrs_uc; 162 }; 163 164 #ifndef __mips_o32 165 /* 166 * From Linux's arch/mips/kernel/signal.c 167 */ 168 struct linux_rt_sigframe32 { 169 uint32_t lrs_ass[4]; 170 uint32_t lrs_code[2]; 171 struct linux_siginfo lrs_info; 172 struct linux_ucontext32 lrs_uc; 173 }; 174 #endif /* !__mips_o32 */ 175 176 /* 177 * From Linux's include/asm-mips/sysmips.h 178 */ 179 #define LINUX_SETNAME 1 /* set hostname */ 180 #define LINUX_FLUSH_CACHE 3 /* writeback and invalidate caches */ 181 #define LINUX_MIPS_FIXADE 7 /* control address error fixing */ 182 #define LINUX_MIPS_RDNVRAM 10 /* read NVRAM */ 183 #define LINUX_MIPS_ATOMIC_SET 2001 /* atomically set variable */ 184 185 /* 186 * From Linux's include/linux/utsname.h 187 */ 188 #define LINUX___NEW_UTS_LEN 64 189 190 /* 191 * Major device numbers of VT device on both Linux and NetBSD. Used in 192 * ugly patch to fake device numbers. 193 * 194 * LINUX_CONS_MAJOR is from Linux's include/linux/major.h 195 */ 196 #define LINUX_CONS_MAJOR 4 197 #define NETBSD_WSCONS_MAJOR 47 /* XXX */ 198 199 /* 200 * Linux ioctl calls for the keyboard. 201 * 202 * From Linux's include/linux/kd.h 203 */ 204 #define LINUX_KDGKBMODE 0x4b44 205 #define LINUX_KDSKBMODE 0x4b45 206 #define LINUX_KDMKTONE 0x4b30 207 #define LINUX_KDSETMODE 0x4b3a 208 #define LINUX_KDENABIO 0x4b36 209 #define LINUX_KDDISABIO 0x4b37 210 #define LINUX_KDGETLED 0x4b31 211 #define LINUX_KDSETLED 0x4b32 212 #define LINUX_KDGKBTYPE 0x4B33 213 #define LINUX_KDGKBENT 0x4B46 214 215 /* 216 * Mode for KDSKBMODE which we don't have (we just use plain mode for this) 217 * 218 * From Linux's include/linux/kd.h 219 */ 220 #define LINUX_K_MEDIUMRAW 2 221 222 /* 223 * VT ioctl calls in Linux (the ones that the pcvt emulation in 224 * wscons can handle) 225 * 226 * From Linux's include/linux/vt.h 227 */ 228 #define LINUX_VT_OPENQRY 0x5600 229 #define LINUX_VT_GETMODE 0x5601 230 #define LINUX_VT_SETMODE 0x5602 231 #define LINUX_VT_GETSTATE 0x5603 232 #define LINUX_VT_RELDISP 0x5605 233 #define LINUX_VT_ACTIVATE 0x5606 234 #define LINUX_VT_WAITACTIVE 0x5607 235 #define LINUX_VT_DISALLOCATE 0x5608 236 237 /* 238 * This range used by VMWare (XXX) 239 * 240 * From Linux's include/linux/vt.h 241 * XXX not needed for mips 242 */ 243 #define LINUX_VMWARE_NONE 200 244 #define LINUX_VMWARE_LAST 237 245 246 /* 247 * Range of ioctls to just pass on, so that modules (like VMWare) can 248 * handle them. 249 * 250 * From Linux's include/linux/vt.h 251 */ 252 #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE 253 #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8) 254 255 #ifdef _KERNEL 256 __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */ 257 void linux_syscall_intern(struct proc *); 258 __END_DECLS 259 #endif /* !_KERNEL */ 260 261 #endif /* _MIPS_LINUX_MACHDEP_H */ 262