Home | History | Annotate | Line # | Download | only in i386
linux_machdep.h revision 1.24
      1 /*	$NetBSD: linux_machdep.h,v 1.24 2002/11/26 18:42:38 christos Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1995, 2000 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.
      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 _I386_LINUX_MACHDEP_H
     40 #define _I386_LINUX_MACHDEP_H
     41 
     42 #include <compat/linux/common/linux_types.h>
     43 #include <compat/linux/common/linux_signal.h>
     44 #include <compat/linux/common/linux_siginfo.h>
     45 
     46 /*
     47  * The Linux sigcontext, pretty much a standard 386 trapframe.
     48  */
     49 
     50 struct linux_sigcontext {
     51 	int	sc_gs;
     52 	int	sc_fs;
     53 	int	sc_es;
     54 	int	sc_ds;
     55 	int	sc_edi;
     56 	int	sc_esi;
     57 	int	sc_ebp;
     58 	int	sc_esp;
     59 	int	sc_ebx;
     60 	int	sc_edx;
     61 	int	sc_ecx;
     62 	int	sc_eax;
     63 	int	sc_trapno;
     64 	int	sc_err;
     65 	int	sc_eip;
     66 	int	sc_cs;
     67 	int	sc_eflags;
     68 	int	sc_esp_at_signal;
     69 	int	sc_ss;
     70 	int	sc_387;
     71 	/* XXX check this */
     72 	linux_old_sigset_t sc_mask;
     73 	int	sc_cr2;
     74 };
     75 
     76 /*
     77  * We make the stack look like Linux expects it when calling a signal
     78  * handler, but use the BSD way of calling the handler and sigreturn().
     79  * This means that we need to pass the pointer to the handler too.
     80  * It is appended to the frame to not interfere with the rest of it.
     81  */
     82 
     83 struct linux_sigframe {
     84 	int	sf_sig;
     85 	struct	linux_siginfo  *sf_sip;
     86 	struct	linux_sigcontext *sf_scp;
     87 	sig_t	sf_handler;
     88 	struct	linux_siginfo  sf_si;
     89 	struct	linux_sigcontext sf_sc;
     90 };
     91 
     92 #ifdef _KERNEL
     93 __BEGIN_DECLS
     94 void linux_sendsig __P((int, sigset_t *, u_long));
     95 __END_DECLS
     96 #endif /* _KERNEL */
     97 
     98 /*
     99  * Major device numbers of VT device on both Linux and NetBSD. Used in
    100  * ugly patch to fake device numbers.
    101  */
    102 #define LINUX_CONS_MAJOR   4
    103 
    104 /*
    105  * Linux ioctl calls for the keyboard.
    106  */
    107 #define LINUX_KDGKBMODE   0x4b44
    108 #define LINUX_KDSKBMODE   0x4b45
    109 #define LINUX_KDMKTONE    0x4b30
    110 #define LINUX_KDSETMODE   0x4b3a
    111 #define LINUX_KDGETMODE   0x4b3b
    112 #define LINUX_KDENABIO    0x4b36
    113 #define LINUX_KDDISABIO   0x4b37
    114 #define LINUX_KDGETLED    0x4b31
    115 #define LINUX_KDSETLED    0x4b32
    116 #define LINUX_KDGKBTYPE   0x4b33
    117 #define LINUX_KDGKBENT    0x4b46
    118 #define LINUX_KIOCSOUND   0x4b2f
    119 
    120 /*
    121  * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
    122  */
    123 #define LINUX_K_MEDIUMRAW 2
    124 
    125 /*
    126  * VT ioctl calls in Linux (the ones that the pcvt emulation in wscons can handle)
    127  */
    128 #define LINUX_VT_OPENQRY    0x5600
    129 #define LINUX_VT_GETMODE    0x5601
    130 #define LINUX_VT_SETMODE    0x5602
    131 #define LINUX_VT_GETSTATE   0x5603
    132 #define LINUX_VT_RELDISP    0x5605
    133 #define LINUX_VT_ACTIVATE   0x5606
    134 #define LINUX_VT_WAITACTIVE 0x5607
    135 #define LINUX_VT_DISALLOCATE	0x5608
    136 
    137 /*
    138  * This range used by VMWare (XXX)
    139  */
    140 #define LINUX_VMWARE_NONE 200
    141 #define LINUX_VMWARE_LAST 237
    142 
    143 /*
    144  * Range of ioctls to just pass on, so that LKMs (like VMWare) can
    145  * handle them.
    146  */
    147 #define LINUX_IOCTL_MIN_PASS	LINUX_VMWARE_NONE
    148 #define LINUX_IOCTL_MAX_PASS	(LINUX_VMWARE_LAST+8)
    149 
    150 #ifdef _KERNEL
    151 __BEGIN_DECLS
    152 void linux_syscall_intern __P((struct proc *));
    153 __END_DECLS
    154 #endif /* !_KERNEL */
    155 
    156 #endif /* _I386_LINUX_MACHDEP_H */
    157