Add hooks for COMPAT_FREEBSD, from Noriyuki Soda.

This commit is contained in:
mycroft 1995-10-10 01:26:36 +00:00
parent 0ad97bc5c9
commit 2dd293d3c3
14 changed files with 93 additions and 35 deletions

@ -1,4 +1,4 @@
/* $NetBSD: genassym.c,v 1.43 1995/05/07 02:59:30 mycroft Exp $ */
/* $NetBSD: genassym.c,v 1.44 1995/10/10 01:26:36 mycroft Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -60,6 +60,10 @@
#include <machine/linux_machdep.h>
#endif
#ifdef COMPAT_FREEBSD
#include <machine/freebsd_machdep.h>
#endif
#include "isa.h"
#if NISA > 0
#include <i386/isa/isa_machdep.h>
@ -85,6 +89,10 @@ main()
struct linux_sigframe *linux_sigf = 0;
struct linux_sigcontext *linux_sc = 0;
#endif
#ifdef COMPAT_FREEBSD
struct freebsd_sigframe *freebsd_sigf = 0;
struct freebsd_sigcontext *freebsd_sc = 0;
#endif
#define def(N,V) printf("#define\t%s %d\n", N, V)
@ -145,6 +153,11 @@ main()
def("LINUX_SC_EFLAGS", &linux_sc->sc_eflags);
#endif
#ifdef COMPAT_FREEBSD
def("FREEBSD_SIGF_HANDLER", &freebsd_sigf->sf_handler);
def("FREEBSD_SIGF_SC", &freebsd_sigf->sf_sc);
#endif
#if NISA > 0
def("IH_FUN", &ih->ih_fun);
def("IH_ARG", &ih->ih_arg);

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.136 1995/10/07 06:25:37 mycroft Exp $ */
/* $NetBSD: locore.s,v 1.137 1995/10/10 01:26:38 mycroft Exp $ */
#undef DIAGNOSTIC
#define DIAGNOSTIC
@ -52,6 +52,9 @@
#ifdef COMPAT_LINUX
#include <compat/linux/linux_syscall.h>
#endif
#ifdef COMPAT_FREEBSD
#include <compat/freebsd/freebsd_syscall.h>
#endif
#include <machine/cputypes.h>
#include <machine/param.h>
@ -598,6 +601,26 @@ _linux_esigcode:
/*****************************************************************************/
#ifdef COMPAT_FREEBSD
/*
* Signal trampoline; copied to top of user stack.
*/
ENTRY(freebsd_sigcode)
call FREEBSD_SIGF_HANDLER(%esp)
leal FREEBSD_SIGF_SC(%esp),%eax # scp (the call may have clobbered
# the copy at SIGF_SCP(%esp))
pushl %eax
pushl %eax # junk to fake return address
movl $FREEBSD_SYS_freebsd_sigreturn,%eax
int $0x80 # enter kernel with args on stack
movl $FREEBSD_SYS_exit,%eax
int $0x80 # exit if sigreturn fails
.globl _freebsd_esigcode
_freebsd_esigcode:
#endif
/*****************************************************************************/
/*
* The following primitives are used to fill and copy regions of memory.
*/

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.174 1995/10/09 06:34:11 mycroft Exp $ */
/* $NetBSD: machdep.c,v 1.175 1995/10/10 01:26:43 mycroft Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -1227,7 +1227,7 @@ cpu_exec_aout_makecmds(p, epp)
return error;
}
#ifdef COMPAT_NOMID
#if defined(COMPAT_NOMID) || defined(COMPAT_FREEBSD)
/*
* cpu_exec_aout_prep_oldzmagic():
* Prepare the vmcmds to build a vmspace for an old (386BSD) ZMAGIC
@ -1283,7 +1283,7 @@ cpu_exec_aout_prep_oldzmagic(p, epp)
return exec_aout_setup_stack(p, epp);
}
#endif /* COMPAT_NOMID */
#endif /* COMPAT_NOMID || COMPAT_FREEBSD */
u_int
pmap_free_pages()

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.84 1995/06/11 20:24:42 fvdl Exp $ */
/* $NetBSD: trap.c,v 1.85 1995/10/10 01:26:46 mycroft Exp $ */
#undef DEBUG
#define DEBUG
@ -502,6 +502,9 @@ syscall(frame)
#ifdef COMPAT_LINUX
extern struct emul emul_linux_aout, emul_linux_elf;
#endif
#ifdef COMPAT_FREEBSD
extern struct emul emul_freebsd;
#endif
cnt.v_syscall++;
if (ISPL(frame.tf_cs) != SEL_UPL)
@ -541,7 +544,12 @@ syscall(frame)
* Like syscall, but code is a quad, so as to maintain
* quad alignment for the rest of the arguments.
*/
#ifdef COMPAT_FREEBSD
/* FreeBSD has a same function in SYS___syscall */
if (callp != sysent && p->p_emul != &emul_freebsd)
#else
if (callp != sysent)
#endif
break;
code = fuword(params + _QUAD_LOWWORD * sizeof(int));
params += sizeof(quad_t);

@ -1,4 +1,4 @@
/* $NetBSD: exec_conf.c,v 1.13 1995/06/22 21:29:47 fvdl Exp $ */
/* $NetBSD: exec_conf.c,v 1.14 1995/10/10 01:26:50 mycroft Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@ -72,6 +72,10 @@
#include <compat/linux/linux_exec.h>
#endif
#ifdef COMPAT_FREEBSD
#include <compat/freebsd/freebsd_exec.h>
#endif
struct execsw execsw[] = {
#ifdef LKM
{ 0, NULL, }, /* entries for LKMs */
@ -99,6 +103,9 @@ struct execsw execsw[] = {
{ COFF_HDR_SIZE, exec_ibcs2_coff_makecmds, }, /* coff binaries */
{ XOUT_HDR_SIZE, exec_ibcs2_xout_makecmds, }, /* x.out binaries */
#endif
#ifdef COMPAT_FREEBSD
{ FREEBSD_AOUT_HDR_SIZE, exec_freebsd_aout_makecmds, }, /* a.out */
#endif
};
int nexecs = (sizeof execsw / sizeof(*execsw));
int exec_maxhdrsz;

@ -1,4 +1,4 @@
/* $NetBSD: kern_prot.c,v 1.30 1995/10/07 06:28:21 mycroft Exp $ */
/* $NetBSD: kern_prot.c,v 1.31 1995/10/10 01:26:53 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@ -64,7 +64,8 @@ sys_getpid(p, v, retval)
{
*retval = p->p_pid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2) || \
defined(COMPAT_FREEBSD)
retval[1] = p->p_pptr->p_pid;
#endif
return (0);
@ -100,7 +101,8 @@ sys_getuid(p, v, retval)
{
*retval = p->p_cred->p_ruid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2) || \
defined(COMPAT_FREEBSD)
retval[1] = p->p_ucred->cr_uid;
#endif
return (0);
@ -125,7 +127,7 @@ sys_getgid(p, v, retval)
{
*retval = p->p_cred->p_rgid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_FREEBSD)
retval[1] = p->p_ucred->cr_gid;
#endif
return (0);

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.62 1995/09/22 00:11:35 cgd Exp $ */
/* $NetBSD: tty.c,v 1.63 1995/10/10 01:26:57 mycroft Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
@ -167,7 +167,8 @@ ttyopen(device, tp)
if (!ISSET(tp->t_state, TS_ISOPEN)) {
SET(tp->t_state, TS_ISOPEN);
bzero(&tp->t_winsize, sizeof(tp->t_winsize));
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4) || \
defined(COMPAT_FREEBSD)
tp->t_flags = 0;
#endif
}
@ -642,7 +643,8 @@ ttioctl(tp, cmd, data, flag, p)
case TIOCSTAT:
case TIOCSTI:
case TIOCSWINSZ:
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4) || \
defined(COMPAT_FREEBSD)
case TIOCLBIC:
case TIOCLBIS:
case TIOCLSET:
@ -889,7 +891,8 @@ ttioctl(tp, cmd, data, flag, p)
}
break;
default:
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4) || \
defined(COMPAT_FREEBSD)
return (ttcompat(tp, cmd, data, flag, p));
#else
return (-1);

@ -1,4 +1,4 @@
/* $NetBSD: tty_compat.c,v 1.25 1995/10/05 08:50:02 mycroft Exp $ */
/* $NetBSD: tty_compat.c,v 1.26 1995/10/10 01:27:00 mycroft Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@ -38,7 +38,8 @@
/*
* mapping routines for old line discipline (yuck)
*/
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_SVR4) || \
defined(COMPAT_FREEBSD)
#include <sys/param.h>
#include <sys/systm.h>
@ -464,4 +465,4 @@ ttcompatsetlflags(tp, t)
t->c_lflag = lflag;
t->c_cflag = cflag;
}
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_SVR4 */
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_SVR4 || COMPAT_FREEBSD */

@ -1,4 +1,4 @@
/* $NetBSD: tty_conf.c,v 1.15 1994/10/30 21:48:00 cgd Exp $ */
/* $NetBSD: tty_conf.c,v 1.16 1995/10/10 01:27:01 mycroft Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@ -97,7 +97,7 @@ struct linesw linesw[] =
{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */
#ifdef COMPAT_43
#if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
{ ttyopen, ttylclose, ttread, ttwrite, nullioctl,
ttyinput, ttstart, ttymodem }, /* 2- old NTTYDISC */
#else

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.29 1995/04/19 22:33:56 mycroft Exp $ */
/* $NetBSD: tty_pty.c,v 1.30 1995/10/10 01:27:03 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -616,7 +616,7 @@ ptyioctl(dev, cmd, data, flag, p)
ttyflush(tp, FREAD|FWRITE);
return (0);
#ifdef COMPAT_43
#if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
case TIOCSETP:
case TIOCSETN:
#endif
@ -660,11 +660,11 @@ ptyioctl(dev, cmd, data, flag, p)
case TIOCSETA:
case TIOCSETAW:
case TIOCSETAF:
#ifdef COMPAT_43
#if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
case TIOCSETP:
case TIOCSETN:
#endif
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_FREEBSD)
case TIOCSETC:
case TIOCSLTC:
case TIOCLBIS:

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.16 1995/10/07 06:28:46 mycroft Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.17 1995/10/10 01:27:05 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@ -57,7 +57,7 @@
* System call interface to the socket abstraction.
*/
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_LINUX) || \
defined(COMPAT_HPUX)
defined(COMPAT_HPUX) || defined(COMPAT_FREEBSD)
#define COMPAT_OLDSOCK
#define MSG_COMPAT 0x8000
#endif

@ -1,4 +1,4 @@
/* $NetBSD: exec.h,v 1.56 1995/05/16 14:17:34 mycroft Exp $ */
/* $NetBSD: exec.h,v 1.57 1995/10/10 01:27:07 mycroft Exp $ */
/*-
* Copyright (c) 1994 Christopher G. Demetriou
@ -69,7 +69,7 @@ struct ps_strings {
*/
#if defined(COMPAT_SUNOS) || defined(COMPAT_ULTRIX) || \
defined(COMPAT_IBCS2) || defined(COMPAT_SVR4) || defined(COMPAT_OSF1) || \
defined(COMPAT_LINUX)
defined(COMPAT_LINUX) || defined(COMPAT_FREEBSD)
#define STACKGAPLEN 400 /* plenty enough for now */
#else
#define STACKGAPLEN 0

@ -1,4 +1,4 @@
/* $NetBSD: ioctl.h,v 1.18 1995/03/26 20:24:16 jtc Exp $ */
/* $NetBSD: ioctl.h,v 1.19 1995/10/10 01:27:09 mycroft Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
@ -79,9 +79,9 @@ __END_DECLS
* Compatability with old terminal driver
*
* Source level -> #define USE_OLD_TTY
* Kernel level -> options COMPAT_43 or COMPAT_SUNOS
* Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
*/
#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
defined(COMPAT_SVR4)
defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD)
#include <sys/ioctl_compat.h>
#endif

@ -1,4 +1,4 @@
/* $NetBSD: vm_mmap.c,v 1.41 1995/10/07 06:29:00 mycroft Exp $ */
/* $NetBSD: vm_mmap.c,v 1.42 1995/10/10 01:27:11 mycroft Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -102,7 +102,8 @@ sys_sstk(p, v, retval)
return (EOPNOTSUPP);
}
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_OSF1)
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_OSF1) || \
defined(COMPAT_FREEBSD)
/* ARGSUSED */
int
compat_43_sys_getpagesize(p, v, retval)
@ -114,9 +115,9 @@ compat_43_sys_getpagesize(p, v, retval)
*retval = PAGE_SIZE;
return (0);
}
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_OSF1 */
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_OSF1 || COMPAT_FREEBSD */
#ifdef COMPAT_43
#if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
int
compat_43_sys_mmap(p, v, retval)
struct proc *p;