Home | History | Annotate | Line # | Download | only in mips
linux_machdep.h revision 1.9
      1  1.9  martin /* $NetBSD: linux_machdep.h,v 1.9 2008/04/28 20:23:43 martin Exp $ */
      2  1.1    manu 
      3  1.1    manu /*-
      4  1.1    manu  * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
      5  1.1    manu  * All rights reserved.
      6  1.1    manu  *
      7  1.1    manu  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1    manu  * by Frank van der Linden and Emmanuel Dreyfus.
      9  1.1    manu  *
     10  1.1    manu  * Redistribution and use in source and binary forms, with or without
     11  1.1    manu  * modification, are permitted provided that the following conditions
     12  1.1    manu  * are met:
     13  1.1    manu  * 1. Redistributions of source code must retain the above copyright
     14  1.1    manu  *    notice, this list of conditions and the following disclaimer.
     15  1.1    manu  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1    manu  *    notice, this list of conditions and the following disclaimer in the
     17  1.1    manu  *    documentation and/or other materials provided with the distribution.
     18  1.1    manu  *
     19  1.1    manu  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1    manu  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1    manu  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1    manu  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1    manu  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1    manu  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1    manu  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1    manu  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1    manu  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1    manu  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1    manu  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1    manu  */
     31  1.1    manu 
     32  1.1    manu #ifndef _MIPS_LINUX_MACHDEP_H
     33  1.1    manu #define _MIPS_LINUX_MACHDEP_H
     34  1.1    manu 
     35  1.7     chs #include <compat/linux/common/linux_types.h>
     36  1.1    manu #include <compat/linux/common/linux_signal.h>
     37  1.7     chs #include <compat/linux/common/linux_siginfo.h>
     38  1.1    manu 
     39  1.2    manu #if defined(ELFSIZE) && (ELFSIZE == 64)
     40  1.6   perry /*
     41  1.6   perry  * From Linux's include/asm-mips64/sigcontext.h
     42  1.3    manu  */
     43  1.2    manu struct linux_sigcontext {
     44  1.2    manu 	unsigned long long sc_regs[32];
     45  1.2    manu 	unsigned long long sc_fpregs[32];
     46  1.2    manu 	unsigned long long sc_mdhi;
     47  1.2    manu 	unsigned long long sc_mdlo;
     48  1.2    manu 	unsigned long long sc_pc;
     49  1.2    manu 	unsigned int sc_status;
     50  1.2    manu 	unsigned int sc_ownedfp;
     51  1.2    manu 	unsigned int sc_fpc_csr;
     52  1.2    manu 	unsigned int sc_fpc_eir;
     53  1.2    manu 	unsigned int sc_cause;
     54  1.2    manu 	unsigned int sc_badvaddr;
     55  1.2    manu }
     56  1.2    manu #else
     57  1.6   perry /*
     58  1.6   perry  * From Linux's include/asm-mips/sigcontext.h
     59  1.1    manu  */
     60  1.6   perry struct linux_sigcontext {
     61  1.1    manu 	unsigned int lsc_regmask;		/* Unused */
     62  1.1    manu 	unsigned int lsc_status;
     63  1.1    manu 	unsigned long long lsc_pc;
     64  1.1    manu 	unsigned long long lsc_regs[32];
     65  1.1    manu 	unsigned long long lsc_fpregs[32];	/* Unused */
     66  1.1    manu 	unsigned int lsc_ownedfp;
     67  1.1    manu 	unsigned int lsc_fpc_csr;		/* Unused */
     68  1.1    manu 	unsigned int lsc_fpc_eir;		/* Unused */
     69  1.1    manu 	unsigned int lsc_ssflags;		/* Unused */
     70  1.1    manu 	unsigned long long lsc_mdhi;
     71  1.1    manu 	unsigned long long lsc_mdlo;
     72  1.1    manu 	unsigned int lsc_cause;	  		/* Unused */
     73  1.1    manu 	unsigned int lsc_badvaddr;	  	/* Unused */
     74  1.6   perry 	unsigned long lsc_sigset[4]; 		/* kernel's sigset_t */
     75  1.1    manu };
     76  1.2    manu #endif
     77  1.1    manu 
     78  1.1    manu /*
     79  1.1    manu  * From Linux's include/asm-mips/elf.h
     80  1.1    manu  */
     81  1.1    manu #define LINUX_ELF_NGREG 45
     82  1.1    manu #define LINUX_ELF_NFPREG 33
     83  1.1    manu typedef unsigned long linux_elf_greg_t;
     84  1.1    manu typedef linux_elf_greg_t linux_elf_gregset_t[LINUX_ELF_NGREG];
     85  1.1    manu 
     86  1.1    manu /*
     87  1.1    manu  * From Linux's arch/mips/kernel/signal.c
     88  1.1    manu  */
     89  1.1    manu struct linux_sigframe {
     90  1.1    manu 	unsigned int lsf_ass[4];
     91  1.2    manu 	unsigned int lsf_code[2];
     92  1.1    manu 	struct linux_sigcontext lsf_sc;
     93  1.3    manu 	linux_sigset_t lsf_mask;
     94  1.1    manu };
     95  1.1    manu 
     96  1.1    manu /*
     97  1.1    manu  * From Linux's include/asm-mips/ucontext.h
     98  1.1    manu  */
     99  1.1    manu struct linux_ucontext {
    100  1.1    manu 	unsigned long luc_flags;
    101  1.1    manu 	struct linux_ucontext *luc_link;
    102  1.1    manu 	linux_stack_t luc_stack;
    103  1.1    manu 	struct linux_sigcontext luc_mcontext;
    104  1.1    manu 	linux_sigset_t luc_sigmask;
    105  1.1    manu };
    106  1.1    manu 
    107  1.1    manu /*
    108  1.3    manu  * From Linux's arch/mips/kernel/signal.c
    109  1.1    manu  */
    110  1.1    manu struct linux_rt_sigframe
    111  1.1    manu {
    112  1.1    manu 	unsigned int lrs_ass[4];
    113  1.1    manu 	unsigned int lrs_code[2];
    114  1.1    manu 	struct linux_siginfo lrs_info;
    115  1.1    manu 	struct linux_ucontext lrs_uc;
    116  1.1    manu };
    117  1.4    manu 
    118  1.4    manu /*
    119  1.4    manu  * From Linux's include/asm-mips/sysmips.h
    120  1.4    manu  */
    121  1.4    manu #define LINUX_SETNAME		1	/* set hostname                  */
    122  1.4    manu #define LINUX_FLUSH_CACHE	3	/* writeback and invalidate caches */
    123  1.4    manu #define LINUX_MIPS_FIXADE	7	/* control address error fixing  */
    124  1.4    manu #define LINUX_MIPS_RDNVRAM	10	/* read NVRAM */
    125  1.4    manu #define LINUX_MIPS_ATOMIC_SET	2001	/* atomically set variable       */
    126  1.4    manu 
    127  1.4    manu /*
    128  1.4    manu  * From Linux's include/linux/utsname.h
    129  1.4    manu  */
    130  1.6   perry #define LINUX___NEW_UTS_LEN	64
    131  1.1    manu 
    132  1.1    manu /*
    133  1.1    manu  * Major device numbers of VT device on both Linux and NetBSD. Used in
    134  1.1    manu  * ugly patch to fake device numbers.
    135  1.1    manu  *
    136  1.1    manu  * LINUX_CONS_MAJOR is from Linux's include/linux/major.h
    137  1.1    manu  */
    138  1.6   perry #define LINUX_CONS_MAJOR 4
    139  1.1    manu #define NETBSD_WSCONS_MAJOR 47 /* XXX */
    140  1.1    manu 
    141  1.1    manu /*
    142  1.1    manu  * Linux ioctl calls for the keyboard.
    143  1.1    manu  *
    144  1.6   perry  * From Linux's include/linux/kd.h
    145  1.1    manu  */
    146  1.1    manu #define LINUX_KDGKBMODE	0x4b44
    147  1.1    manu #define LINUX_KDSKBMODE	0x4b45
    148  1.1    manu #define LINUX_KDMKTONE	0x4b30
    149  1.1    manu #define LINUX_KDSETMODE	0x4b3a
    150  1.1    manu #define LINUX_KDENABIO	0x4b36
    151  1.1    manu #define LINUX_KDDISABIO	0x4b37
    152  1.1    manu #define LINUX_KDGETLED	0x4b31
    153  1.1    manu #define LINUX_KDSETLED	0x4b32
    154  1.1    manu #define LINUX_KDGKBTYPE	0x4B33
    155  1.1    manu #define LINUX_KDGKBENT	0x4B46
    156  1.1    manu 
    157  1.1    manu /*
    158  1.1    manu  * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
    159  1.1    manu  *
    160  1.1    manu  * From Linux's include/linux/kd.h
    161  1.1    manu  */
    162  1.1    manu #define LINUX_K_MEDIUMRAW 2
    163  1.1    manu 
    164  1.1    manu /*
    165  1.6   perry  * VT ioctl calls in Linux (the ones that the pcvt emulation in
    166  1.1    manu  * wscons can handle)
    167  1.1    manu  *
    168  1.1    manu  * From Linux's include/linux/vt.h
    169  1.1    manu  */
    170  1.1    manu #define LINUX_VT_OPENQRY	0x5600
    171  1.1    manu #define LINUX_VT_GETMODE	0x5601
    172  1.1    manu #define LINUX_VT_SETMODE	0x5602
    173  1.1    manu #define LINUX_VT_GETSTATE	0x5603
    174  1.1    manu #define LINUX_VT_RELDISP	0x5605
    175  1.1    manu #define LINUX_VT_ACTIVATE	0x5606
    176  1.1    manu #define LINUX_VT_WAITACTIVE 	0x5607
    177  1.1    manu #define LINUX_VT_DISALLOCATE	0x5608
    178  1.1    manu 
    179  1.1    manu /*
    180  1.1    manu  * This range used by VMWare (XXX)
    181  1.1    manu  *
    182  1.1    manu  * From Linux's include/linux/vt.h
    183  1.1    manu  * XXX not needed for mips
    184  1.1    manu  */
    185  1.1    manu #define LINUX_VMWARE_NONE 200
    186  1.1    manu #define LINUX_VMWARE_LAST 237
    187  1.1    manu 
    188  1.1    manu /*
    189  1.1    manu  * Range of ioctls to just pass on, so that LKMs (like VMWare) can
    190  1.1    manu  * handle them.
    191  1.6   perry  *
    192  1.1    manu  * From Linux's include/linux/vt.h
    193  1.1    manu  */
    194  1.1    manu #define LINUX_IOCTL_MIN_PASS LINUX_VMWARE_NONE
    195  1.1    manu #define LINUX_IOCTL_MAX_PASS (LINUX_VMWARE_LAST+8)
    196  1.1    manu 
    197  1.1    manu #ifdef _KERNEL
    198  1.1    manu __BEGIN_DECLS /* XXX from NetBSD/i386. Not arch dependent? */
    199  1.8     dsl void linux_syscall_intern(struct proc *);
    200  1.1    manu __END_DECLS
    201  1.1    manu #endif /* !_KERNEL */
    202  1.1    manu 
    203  1.1    manu #endif /* _MIPS_LINUX_MACHDEP_H */
    204