170 lines
4.6 KiB
C
170 lines
4.6 KiB
C
/* $NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 Exp $ */
|
|
|
|
/*-
|
|
* Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
* by Frank van der Linden.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
* must display the following acknowledgement:
|
|
* This product includes software developed by the NetBSD
|
|
* Foundation, Inc. and its contributors.
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#include <sys/param.h>
|
|
|
|
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.1 2002/01/14 23:14:38 bjh21 Exp $");
|
|
|
|
#include <sys/param.h>
|
|
#include <sys/systm.h>
|
|
#include <sys/signalvar.h>
|
|
#include <sys/kernel.h>
|
|
#include <sys/map.h>
|
|
#include <sys/proc.h>
|
|
#include <sys/user.h>
|
|
#include <sys/buf.h>
|
|
#include <sys/reboot.h>
|
|
#include <sys/conf.h>
|
|
#include <sys/exec.h>
|
|
#include <sys/file.h>
|
|
#include <sys/callout.h>
|
|
#include <sys/malloc.h>
|
|
#include <sys/mbuf.h>
|
|
#include <sys/msgbuf.h>
|
|
#include <sys/mount.h>
|
|
#include <sys/vnode.h>
|
|
#include <sys/device.h>
|
|
#include <sys/syscallargs.h>
|
|
#include <sys/filedesc.h>
|
|
#include <sys/exec_elf.h>
|
|
#include <sys/disklabel.h>
|
|
#include <sys/ioctl.h>
|
|
#include <miscfs/specfs/specdev.h>
|
|
|
|
#include <compat/linux/common/linux_types.h>
|
|
#include <compat/linux/common/linux_signal.h>
|
|
#include <compat/linux/common/linux_util.h>
|
|
#include <compat/linux/common/linux_ioctl.h>
|
|
#include <compat/linux/common/linux_hdio.h>
|
|
#include <compat/linux/common/linux_exec.h>
|
|
#include <compat/linux/common/linux_machdep.h>
|
|
|
|
#include <compat/linux/linux_syscallargs.h>
|
|
|
|
void
|
|
linux_setregs(p, epp, stack)
|
|
struct proc *p;
|
|
struct exec_package *epp;
|
|
u_long stack;
|
|
{
|
|
/* struct pcb *pcb = &p->p_addr->u_pcb; */
|
|
|
|
setregs(p, epp, stack);
|
|
}
|
|
|
|
void
|
|
linux_sendsig(catcher, sig, mask, code)
|
|
sig_t catcher;
|
|
int sig;
|
|
sigset_t *mask;
|
|
u_long code;
|
|
{
|
|
|
|
panic("linux_sendsig not implemented");
|
|
}
|
|
/*
|
|
* System call to cleanup state after a signal
|
|
* has been taken. Reset signal mask and
|
|
* stack state from context left by sendsig (above).
|
|
* Return to previous pc and psl as specified by
|
|
* context left by sendsig. Check carefully to
|
|
* make sure that the user has not modified the
|
|
* psl to gain improper privileges or to cause
|
|
* a machine fault.
|
|
*/
|
|
int
|
|
linux_sys_rt_sigreturn(p, v, retval)
|
|
struct proc *p;
|
|
void *v;
|
|
register_t *retval;
|
|
{
|
|
/* XXX XAX write me */
|
|
return(ENOSYS);
|
|
}
|
|
|
|
int
|
|
linux_sys_sigreturn(p, v, retval)
|
|
struct proc *p;
|
|
void *v;
|
|
register_t *retval;
|
|
{
|
|
|
|
return ENOSYS;
|
|
}
|
|
|
|
/*
|
|
* major device numbers remapping
|
|
*/
|
|
dev_t
|
|
linux_fakedev(dev)
|
|
dev_t dev;
|
|
{
|
|
/* XXX write me */
|
|
return dev;
|
|
}
|
|
|
|
/*
|
|
* We come here in a last attempt to satisfy a Linux ioctl() call
|
|
*/
|
|
int
|
|
linux_machdepioctl(p, v, retval)
|
|
struct proc *p;
|
|
void *v;
|
|
register_t *retval;
|
|
{
|
|
struct linux_sys_ioctl_args /* {
|
|
syscallarg(int) fd;
|
|
syscallarg(u_long) com;
|
|
syscallarg(caddr_t) data;
|
|
} */ *uap = v;
|
|
struct sys_ioctl_args bia;
|
|
u_long com;
|
|
|
|
SCARG(&bia, fd) = SCARG(uap, fd);
|
|
SCARG(&bia, data) = SCARG(uap, data);
|
|
com = SCARG(uap, com);
|
|
|
|
switch (com) {
|
|
default:
|
|
printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
|
|
return EINVAL;
|
|
}
|
|
SCARG(&bia, com) = com;
|
|
return sys_ioctl(p, &bia, retval);
|
|
}
|