Home | History | Annotate | Line # | Download | only in arm
linux_machdep.c revision 1.1
      1 /*	$NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 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 #include <sys/param.h>
     40 
     41 __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 Exp $");
     42 
     43 #include <sys/param.h>
     44 #include <sys/systm.h>
     45 #include <sys/signalvar.h>
     46 #include <sys/kernel.h>
     47 #include <sys/map.h>
     48 #include <sys/proc.h>
     49 #include <sys/user.h>
     50 #include <sys/buf.h>
     51 #include <sys/reboot.h>
     52 #include <sys/conf.h>
     53 #include <sys/exec.h>
     54 #include <sys/file.h>
     55 #include <sys/callout.h>
     56 #include <sys/malloc.h>
     57 #include <sys/mbuf.h>
     58 #include <sys/msgbuf.h>
     59 #include <sys/mount.h>
     60 #include <sys/vnode.h>
     61 #include <sys/device.h>
     62 #include <sys/syscallargs.h>
     63 #include <sys/filedesc.h>
     64 #include <sys/exec_elf.h>
     65 #include <sys/disklabel.h>
     66 #include <sys/ioctl.h>
     67 #include <miscfs/specfs/specdev.h>
     68 
     69 #include <compat/linux/common/linux_types.h>
     70 #include <compat/linux/common/linux_signal.h>
     71 #include <compat/linux/common/linux_util.h>
     72 #include <compat/linux/common/linux_ioctl.h>
     73 #include <compat/linux/common/linux_hdio.h>
     74 #include <compat/linux/common/linux_exec.h>
     75 #include <compat/linux/common/linux_machdep.h>
     76 
     77 #include <compat/linux/linux_syscallargs.h>
     78 
     79 void
     80 linux_setregs(p, epp, stack)
     81 	struct proc *p;
     82 	struct exec_package *epp;
     83 	u_long stack;
     84 {
     85 /*	struct pcb *pcb = &p->p_addr->u_pcb; */
     86 
     87 	setregs(p, epp, stack);
     88 }
     89 
     90 void
     91 linux_sendsig(catcher, sig, mask, code)
     92 	sig_t catcher;
     93 	int sig;
     94 	sigset_t *mask;
     95 	u_long code;
     96 {
     97 
     98 	panic("linux_sendsig not implemented");
     99 }
    100 /*
    101  * System call to cleanup state after a signal
    102  * has been taken.  Reset signal mask and
    103  * stack state from context left by sendsig (above).
    104  * Return to previous pc and psl as specified by
    105  * context left by sendsig. Check carefully to
    106  * make sure that the user has not modified the
    107  * psl to gain improper privileges or to cause
    108  * a machine fault.
    109  */
    110 int
    111 linux_sys_rt_sigreturn(p, v, retval)
    112 	struct proc *p;
    113 	void *v;
    114 	register_t *retval;
    115 {
    116 	/* XXX XAX write me */
    117 	return(ENOSYS);
    118 }
    119 
    120 int
    121 linux_sys_sigreturn(p, v, retval)
    122 	struct proc *p;
    123 	void *v;
    124 	register_t *retval;
    125 {
    126 
    127 	return ENOSYS;
    128 }
    129 
    130 /*
    131  * major device numbers remapping
    132  */
    133 dev_t
    134 linux_fakedev(dev)
    135 	dev_t dev;
    136 {
    137   /* XXX write me */
    138   return dev;
    139 }
    140 
    141 /*
    142  * We come here in a last attempt to satisfy a Linux ioctl() call
    143  */
    144 int
    145 linux_machdepioctl(p, v, retval)
    146 	struct proc *p;
    147 	void *v;
    148 	register_t *retval;
    149 {
    150 	struct linux_sys_ioctl_args /* {
    151 		syscallarg(int) fd;
    152 		syscallarg(u_long) com;
    153 		syscallarg(caddr_t) data;
    154 	} */ *uap = v;
    155 	struct sys_ioctl_args bia;
    156 	u_long com;
    157 
    158 	SCARG(&bia, fd) = SCARG(uap, fd);
    159 	SCARG(&bia, data) = SCARG(uap, data);
    160 	com = SCARG(uap, com);
    161 
    162 	switch (com) {
    163 	default:
    164 		printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
    165 		return EINVAL;
    166 	}
    167 	SCARG(&bia, com) = com;
    168 	return sys_ioctl(p, &bia, retval);
    169 }
    170