Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove exec_aout support in compat_freebsd. The only rea...



details:   https://anonhg.NetBSD.org/src/rev/dd216833c918
branches:  trunk
changeset: 825758:dd216833c918
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 29 10:39:48 2017 +0000

description:
Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).

diffstat:

 sys/compat/freebsd/files.freebsd       |   3 +-
 sys/compat/freebsd/freebsd_exec.h      |  63 +-----------------------
 sys/compat/freebsd/freebsd_exec_aout.c |  91 ----------------------------------
 sys/compat/freebsd/freebsd_mod.c       |  29 +---------
 sys/modules/compat_freebsd/Makefile    |   6 +-
 5 files changed, 8 insertions(+), 184 deletions(-)

diffs (287 lines):

diff -r fd0e82f1847e -r dd216833c918 sys/compat/freebsd/files.freebsd
--- a/sys/compat/freebsd/files.freebsd  Sat Jul 29 07:30:39 2017 +0000
+++ b/sys/compat/freebsd/files.freebsd  Sat Jul 29 10:39:48 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.freebsd,v 1.13 2014/11/17 01:01:57 uebayasi Exp $
+#      $NetBSD: files.freebsd,v 1.14 2017/07/29 10:39:48 maxv Exp $
 #
 # Config file description for machine-independent FreeBSD compat code.
 # Included by ports that need it.
@@ -9,7 +9,6 @@
 define compat_freebsd
 file   compat/freebsd/freebsd_exec.c           compat_freebsd
 file   compat/freebsd/freebsd_exec_elf32.c     compat_freebsd & exec_elf32
-file   compat/freebsd/freebsd_exec_aout.c      compat_freebsd & exec_aout
 file   compat/freebsd/freebsd_file.c           compat_freebsd
 file   compat/freebsd/freebsd_fork.c           compat_freebsd
 file   compat/freebsd/freebsd_ioctl.c          compat_freebsd
diff -r fd0e82f1847e -r dd216833c918 sys/compat/freebsd/freebsd_exec.h
--- a/sys/compat/freebsd/freebsd_exec.h Sat Jul 29 07:30:39 2017 +0000
+++ b/sys/compat/freebsd/freebsd_exec.h Sat Jul 29 10:39:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_exec.h,v 1.17 2009/12/10 14:13:53 matt Exp $   */
+/*     $NetBSD: freebsd_exec.h,v 1.18 2017/07/29 10:39:48 maxv Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -29,72 +29,11 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)exec.h        8.1 (Berkeley) 6/11/93
- *     from: imgact_aout.h,v 1.2 1994/12/30 08:06:19 bde Exp
  */
 
 #ifndef        _FREEBSD_EXEC_H
 #define        _FREEBSD_EXEC_H
 
-#ifdef EXEC_AOUT
-#define FREEBSD_N_GETMAGIC(ex) \
-       ( (ex).a_midmag & 0xffff )
-#define FREEBSD_N_GETMID(ex) \
-       ( ((ex).a_midmag >> 16) & 0x03ff )
-#define FREEBSD_N_GETFLAG(ex) \
-       ( ((ex).a_midmag >> 26) & 0x3f )
-#define FREEBSD_N_SETMAGIC(ex,mag,mid,flag) \
-       ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \
-       ((mag) & 0xffff) )
-
-#define FREEBSD_N_ALIGN(ex,x) \
-       (FREEBSD_N_GETMAGIC(ex) == ZMAGIC || \
-        FREEBSD_N_GETMAGIC(ex) == QMAGIC ? \
-        ((x) + FREEBSD___LDPGSZ - 1) & \
-        ~(unsigned long)(FREEBSD___LDPGSZ - 1) : (x))
-
-/* Valid magic number check. */
-#define        FREEBSD_N_BADMAG(ex) \
-       (FREEBSD_N_GETMAGIC(ex) != OMAGIC && \
-        FREEBSD_N_GETMAGIC(ex) != NMAGIC && \
-        FREEBSD_N_GETMAGIC(ex) != ZMAGIC && \
-        FREEBSD_N_GETMAGIC(ex) != QMAGIC)
-
-/* Address of the bottom of the text segment. */
-#define FREEBSD_N_TXTADDR(ex) \
-       ((FREEBSD_N_GETMAGIC(ex) == OMAGIC || \
-         FREEBSD_N_GETMAGIC(ex) == NMAGIC || \
-         FREEBSD_N_GETMAGIC(ex) == ZMAGIC) ? 0 : AOUT_LDPGSZ)
-
-/* Address of the bottom of the data segment. */
-#define FREEBSD_N_DATADDR(ex) \
-       FREEBSD_N_ALIGN(ex, FREEBSD_N_TXTADDR(ex) + (ex).a_text)
-
-/* Text segment offset. */
-#define        FREEBSD_N_TXTOFF(ex) \
-       (FREEBSD_N_GETMAGIC(ex) == ZMAGIC ? AOUT_LDPGSZ : \
-        FREEBSD_N_GETMAGIC(ex) == QMAGIC ? 0 : sizeof(struct exec))
-
-/* Data segment offset. */
-#define        FREEBSD_N_DATOFF(ex) \
-       FREEBSD_N_ALIGN(ex, FREEBSD_N_TXTOFF(ex) + (ex).a_text)
-
-/* Relocation table offset. */
-#define FREEBSD_N_RELOFF(ex) \
-       FREEBSD_N_ALIGN(ex, FREEBSD_N_DATOFF(ex) + (ex).a_data)
-
-/* Symbol table offset. */
-#define FREEBSD_N_SYMOFF(ex) \
-       (FREEBSD_N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize)
-
-/* String table offset. */
-#define        FREEBSD_N_STROFF(ex)    (FREEBSD_N_SYMOFF(ex) + (ex).a_syms)
-
-#define        FREEBSD_AOUT_HDR_SIZE   sizeof(struct exec)
-
-int exec_freebsd_aout_makecmds(struct lwp *, struct exec_package *);
-
-#endif /* EXEC_AOUT */
-
 #ifdef EXEC_ELF32
 #define FREEBSD_ELF_BRAND_STRING "FreeBSD"
 #define FREEBSD_ELF_INTERP_PREFIX_STRING "/usr/libexec/ld-elf.so"
diff -r fd0e82f1847e -r dd216833c918 sys/compat/freebsd/freebsd_exec_aout.c
--- a/sys/compat/freebsd/freebsd_exec_aout.c    Sat Jul 29 07:30:39 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*     $NetBSD: freebsd_exec_aout.c,v 1.9 2009/08/16 15:39:30 martin Exp $     */
-
-/*
- * Copyright (c) 1993, 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * 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 Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_exec_aout.c,v 1.9 2009/08/16 15:39:30 martin Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/exec.h>
-#include <sys/exec_aout.h>
-
-#ifndef EXEC_AOUT
-#define EXEC_AOUT      /* to get a.out specific stuff */
-#endif
-
-#include <compat/freebsd/freebsd_exec.h>
-
-/*
-* exec_aout_makecmds(): Check if it's an a.out-format executable.
-*
-* Given a lwp pointer and an exec package pointer, see if the referent
-* of the epp is in a.out format.  First check 'standard' magic numbers for
-* this architecture.  If that fails, try a CPU-dependent hook.
- *
- * This function, in the former case, or the hook, in the latter, is
- * responsible for creating a set of vmcmds which can be used to build
- * the process's vm space and inserting them into the exec package.
- */
-
-int
-exec_freebsd_aout_makecmds(struct lwp *l, struct exec_package *epp)
-{
-       u_long midmag;
-       int error = ENOEXEC;
-       struct exec *execp = epp->ep_hdr;
-
-       if (epp->ep_hdrvalid < sizeof(struct exec))
-               return ENOEXEC;
-
-       midmag = FREEBSD_N_GETMID(*execp) << 16 | FREEBSD_N_GETMAGIC(*execp);
-
-       /* assume FreeBSD's MID_MACHINE and [ZQNO]MAGIC is same as NetBSD's */
-       switch (midmag) {
-       case (MID_MACHINE << 16) | ZMAGIC:
-               error = exec_aout_prep_oldzmagic(l, epp);
-               break;
-       case (MID_MACHINE << 16) | QMAGIC:
-               error = exec_aout_prep_zmagic(l, epp);
-               break;
-       case (MID_MACHINE << 16) | NMAGIC:
-               error = exec_aout_prep_nmagic(l, epp);
-               break;
-       case (MID_MACHINE << 16) | OMAGIC:
-               error = exec_aout_prep_omagic(l, epp);
-               break;
-       }
-       if (error)
-               kill_vmcmds(&epp->ep_vmcmds);
-
-       return error;
-}
diff -r fd0e82f1847e -r dd216833c918 sys/compat/freebsd/freebsd_mod.c
--- a/sys/compat/freebsd/freebsd_mod.c  Sat Jul 29 07:30:39 2017 +0000
+++ b/sys/compat/freebsd/freebsd_mod.c  Sat Jul 29 10:39:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_mod.c,v 1.5 2014/03/07 02:02:16 christos Exp $ */
+/*     $NetBSD: freebsd_mod.c,v 1.6 2017/07/29 10:39:48 maxv Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_mod.c,v 1.5 2014/03/07 02:02:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_mod.c,v 1.6 2017/07/29 10:39:48 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -40,7 +40,6 @@
 #include <sys/module.h>
 #include <sys/exec.h>
 #include <sys/exec_elf.h>
-#include <sys/exec_aout.h>
 #include <sys/signalvar.h>
 
 #include <compat/freebsd/freebsd_exec.h>
@@ -51,16 +50,11 @@
 #else
 # define       MD1     ""
 #endif
-#if defined(EXEC_AOUT)
-#  define      MD2     ",exec_aout"
-#else
-# define       MD2     ""
-#endif
 
 #define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \
     sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1))
 
-MODULE(MODULE_CLASS_EXEC, compat_freebsd, "compat,compat_ossaudio" MD1 MD2);
+MODULE(MODULE_CLASS_EXEC, compat_freebsd, "compat,compat_ossaudio" MD1);
 
 static struct execsw freebsd_execsw[] = {
 #ifdef EXEC_ELF32
@@ -80,23 +74,6 @@
                .es_setup_stack = exec_setup_stack,
        },
 #endif
-#ifdef EXEC_AOUT
-       /* FreeBSD a.out (native word size) */
-       {
-               .es_hdrsz = FREEBSD_AOUT_HDR_SIZE,
-               .es_makecmds = exec_freebsd_aout_makecmds,
-               .u = {
-                       .elf_probe_func = NULL,
-               },
-               .es_emul = &emul_freebsd,
-               .es_prio = EXECSW_PRIO_ANY,
-               .es_arglen = 0,
-               .es_copyargs = copyargs,
-               .es_setregs = NULL,
-               .es_coredump = coredump_netbsd,
-               .es_setup_stack = exec_setup_stack,
-       },
-#endif
 };
 
 static int
diff -r fd0e82f1847e -r dd216833c918 sys/modules/compat_freebsd/Makefile
--- a/sys/modules/compat_freebsd/Makefile       Sat Jul 29 07:30:39 2017 +0000
+++ b/sys/modules/compat_freebsd/Makefile       Sat Jul 29 10:39:48 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.3 2009/02/14 13:56:41 abs Exp $
+#      $NetBSD: Makefile,v 1.4 2017/07/29 10:39:48 maxv Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -10,13 +10,13 @@
 
 .PATH: ${S}/compat/freebsd
 
-SRCS+= freebsd_exec.c freebsd_exec_aout.c freebsd_exec_elf32.c
+SRCS+= freebsd_exec.c freebsd_exec_elf32.c
 SRCS+= freebsd_file.c freebsd_fork.c freebsd_ioctl.c freebsd_ipc.c
 SRCS+= freebsd_misc.c freebsd_ptrace.c freebsd_sched.c freebsd_syscalls.c
 SRCS+= freebsd_sysctl.c freebsd_sysent.c freebsd_mod.c
 
 .if ${MACHINE_ARCH} == "i386"
-CPPFLAGS+=     -DEXEC_ELF32 -DEXEC_AOUT
+CPPFLAGS+=     -DEXEC_ELF32
 .PATH: ${S}/arch/i386/i386
 SRCS+= freebsd_machdep.c freebsd_syscall.c freebsd_sigcode.S
 .endif



Home | Main Index | Thread Index | Old Index