1 /* $OpenBSD: linux_machdep.h,v 1.9 2002/03/14 01:26:33 millert Exp $ */ 2 /* $NetBSD: linux_machdep.h,v 1.5 1996/05/03 19:26:28 christos Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Frank van der Linden 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed for the NetBSD Project 19 * by Frank van der Linden 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #ifndef _LINUX_MACHDEP_H 36 #define _LINUX_MACHDEP_H 37 38 /* 39 * The Linux sigcontext, pretty much a standard 386 trapframe. 40 */ 41 42 struct linux_sigcontext { 43 int sc_gs; 44 int sc_fs; 45 int sc_es; 46 int sc_ds; 47 int sc_edi; 48 int sc_esi; 49 int sc_ebp; 50 int sc_esp; 51 int sc_ebx; 52 int sc_edx; 53 int sc_ecx; 54 int sc_eax; 55 int sc_trapno; 56 int sc_err; 57 int sc_eip; 58 int sc_cs; 59 int sc_eflags; 60 int sc_esp_at_signal; 61 int sc_ss; 62 int sc_387; 63 int sc_mask; 64 int sc_cr2; 65 }; 66 67 /* 68 * We make the stack look like Linux expects it when calling a signal 69 * handler, but use the BSD way of calling the handler and sigreturn(). 70 * This means that we need to pass the pointer to the handler too. 71 * It is appended to the frame to not interfere with the rest of it. 72 */ 73 74 struct linux_sigframe { 75 int sf_sig; 76 struct linux_sigcontext sf_sc; 77 sig_t sf_handler; 78 }; 79 80 #ifdef _KERNEL 81 void linux_sendsig(sig_t, int, int, u_long, int, union sigval); 82 dev_t linux_fakedev(dev_t); 83 #endif 84 85 /* 86 * Major device numbers of VT device on both Linux and NetBSD. Used in 87 * ugly patch to fake device numbers. 88 */ 89 #define LINUX_CONS_MAJOR 4 90 #define NATIVE_CONS_MAJOR 12 91 92 /* 93 * Linux ioctl calls for the keyboard. 94 */ 95 #define LINUX_KDGKBMODE 0x4b44 96 #define LINUX_KDSKBMODE 0x4b45 97 #define LINUX_KDMKTONE 0x4b30 98 #define LINUX_KDSETMODE 0x4b3a 99 #define LINUX_KDGETMODE 0x4b3b 100 #define LINUX_KDENABIO 0x4b36 101 #define LINUX_KDDISABIO 0x4b37 102 #define LINUX_KDGETLED 0x4b31 103 #define LINUX_KDSETLED 0x4b32 104 #define LINUX_KDGKBTYPE 0x4b33 105 #define LINUX_KDGKBENT 0x4b46 106 #define LINUX_KIOCSOUND 0x4b2f 107 108 /* 109 * Mode for KDSKBMODE which we don't have (we just use plain mode for this) 110 */ 111 #define LINUX_K_MEDIUMRAW 2 112 113 /* 114 * VT ioctl calls in Linux (the ones that pcvt can handle) 115 */ 116 #define LINUX_VT_OPENQRY 0x5600 117 #define LINUX_VT_GETMODE 0x5601 118 #define LINUX_VT_SETMODE 0x5602 119 #define LINUX_VT_GETSTATE 0x5603 120 #define LINUX_VT_RELDISP 0x5605 121 #define LINUX_VT_ACTIVATE 0x5606 122 #define LINUX_VT_WAITACTIVE 0x5607 123 #define LINUX_VT_DISALLOCATE 0x5608 124 125 #endif /* _LINUX_MACHDEP_H */