1*54b7adb1Schristos /* $NetBSD: aoutm68k_mod.c,v 1.3 2014/03/07 01:33:43 christos Exp $ */
292ce8c6aSad
392ce8c6aSad /*-
492ce8c6aSad * Copyright (c) 2008 The NetBSD Foundation, Inc.
592ce8c6aSad * All rights reserved.
692ce8c6aSad *
792ce8c6aSad * This code is derived from software developed for The NetBSD Foundation
892ce8c6aSad * by Andrew Doran.
992ce8c6aSad *
1092ce8c6aSad * Redistribution and use in source and binary forms, with or without
1192ce8c6aSad * modification, are permitted provided that the following conditions
1292ce8c6aSad * are met:
1392ce8c6aSad * 1. Redistributions of source code must retain the above copyright
1492ce8c6aSad * notice, this list of conditions and the following disclaimer.
1592ce8c6aSad * 2. Redistributions in binary form must reproduce the above copyright
1692ce8c6aSad * notice, this list of conditions and the following disclaimer in the
1792ce8c6aSad * documentation and/or other materials provided with the distribution.
1892ce8c6aSad *
1992ce8c6aSad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2092ce8c6aSad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2192ce8c6aSad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2292ce8c6aSad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2392ce8c6aSad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2492ce8c6aSad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2592ce8c6aSad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2692ce8c6aSad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2792ce8c6aSad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2892ce8c6aSad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2992ce8c6aSad * POSSIBILITY OF SUCH DAMAGE.
3092ce8c6aSad */
3192ce8c6aSad
3292ce8c6aSad #include <sys/cdefs.h>
33*54b7adb1Schristos __KERNEL_RCSID(0, "$NetBSD: aoutm68k_mod.c,v 1.3 2014/03/07 01:33:43 christos Exp $");
3492ce8c6aSad
3592ce8c6aSad #include <sys/param.h>
3692ce8c6aSad #include <sys/module.h>
3792ce8c6aSad #include <sys/exec.h>
3892ce8c6aSad #include <sys/exec_aout.h>
3992ce8c6aSad #include <sys/signalvar.h>
4092ce8c6aSad
4192ce8c6aSad extern struct emul emul_netbsd_aoutm68k;
4292ce8c6aSad
43721e82b5Schristos MODULE(MODULE_CLASS_EXEC, compat_aoutm68k, "exec_aout");
4492ce8c6aSad
45*54b7adb1Schristos static struct execsw aoutm68k_execsw = {
46*54b7adb1Schristos .es_hdrsz = sizeof(struct exec),
47*54b7adb1Schristos .es_makecmds = exec_aout_makecmds,
48*54b7adb1Schristos .u = {
49*54b7adb1Schristos .elf_probe_func = NULL,
50*54b7adb1Schristos },
51*54b7adb1Schristos .es_emul = &emul_netbsd_aoutm68k,
52*54b7adb1Schristos .es_prio = EXECSW_PRIO_FIRST, /* before exec_aout */
53*54b7adb1Schristos .es_arglen = 0,
54*54b7adb1Schristos .es_copyargs = copyargs,
55*54b7adb1Schristos .es_setregs = NULL,
56*54b7adb1Schristos .es_coredump = coredump_netbsd,
57*54b7adb1Schristos .es_setup_stack = exec_setup_stack,
5892ce8c6aSad };
5992ce8c6aSad
6092ce8c6aSad static int
compat_aoutm68k_modcmd(modcmd_t cmd,void * arg)6192ce8c6aSad compat_aoutm68k_modcmd(modcmd_t cmd, void *arg)
6292ce8c6aSad {
6392ce8c6aSad
6492ce8c6aSad switch (cmd) {
6592ce8c6aSad case MODULE_CMD_INIT:
66*54b7adb1Schristos return exec_add(&aoutm68k_execsw, 1);
6792ce8c6aSad
6892ce8c6aSad case MODULE_CMD_FINI:
69*54b7adb1Schristos return exec_remove(&aoutm68k_execsw, 1);
7092ce8c6aSad
7192ce8c6aSad default:
7292ce8c6aSad return ENOTTY;
7392ce8c6aSad }
7492ce8c6aSad }
75