Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

2nd try Re: a.out dynamic binaries emulation

From: Marc Espie <espie(at)nerim.net>
Date: Sat Apr 26 2003 - 10:43:01 EDT

Here's a new one, with a few fixes based on people comments.

I'd like to be able to commit this soon... so I'd need some okay, and if people can check I didn't break any arch, I'd love it.

Index: sys/arch/i386/conf/GENERIC



RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v retrieving revision 1.332
diff -u -p -r1.332 GENERIC
--- sys/arch/i386/conf/GENERIC	28 Mar 2003 00:49:13 -0000	1.332

+++ sys/arch/i386/conf/GENERIC 26 Apr 2003 14:42:00 -0000
@@ -30,6 +30,7 @@ option COMPAT_IBCS2 # binary compatibil option COMPAT_LINUX # binary compatibility with Linux option COMPAT_FREEBSD # binary compatibility with FreeBSD option COMPAT_BSDOS # binary compatibility with BSD/OS
+option COMPAT_AOUT_TRANSLATE #a.out binary are emulated
maxusers 32 # estimated number of users

Index: sys/arch/i386/i386/trap.c



RCS file: /cvs/src/sys/arch/i386/i386/trap.c,v retrieving revision 1.53
diff -u -p -r1.53 trap.c
--- sys/arch/i386/i386/trap.c	16 Jan 2003 04:15:17 -0000	1.53

+++ sys/arch/i386/i386/trap.c 26 Apr 2003 14:42:01 -0000
@@ -91,6 +91,9 @@ extern struct emul emul_aout_freebsd, em  #ifdef COMPAT_BSDOS
 extern struct emul emul_bsdos;
 #endif
+#ifdef COMPAT_AOUT_TRANSLATE
+extern struct emul emul_aout_translate;
+#endif
 

 #include "npx.h"  

@@ -643,6 +646,9 @@ syscall(frame)

 #ifdef COMPAT_FREEBSD
 		    && p->p_emul != &emul_aout_freebsd
 		    && p->p_emul != &emul_elf_freebsd

+#endif
+#ifdef COMPAT_AOUT_TRANSLATE
+ && p->p_emul != &emul_aout_translate
 #endif
 #ifdef COMPAT_BSDOS

                     && p->p_emul != &emul_bsdos
Index: sys/compat/common/Makefile



RCS file: /cvs/src/sys/compat/common/Makefile,v retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- sys/compat/common/Makefile	30 Jan 2003 03:29:49 -0000	1.13

+++ sys/compat/common/Makefile 26 Apr 2003 14:42:03 -0000
@@ -9,7 +9,8 @@ MACHINE_ARCH= ${XMACHINE_ARCH} .PATH: ${COMPATDIR} -SRCS= compat_exec.c compat_util.c compat_dir.c compat_vm.c kern_exit_43.c \
+SRCS= compat_exec.c compat_util.c compat_dir.c compat_vm.c \
kern_ipc_23.c kern_info_09.c kern_info_43.c \ kern_resource_43.c kern_sig_43.c tty_43.c uipc_syscalls_43.c \ vfs_syscalls_25.c vfs_syscalls_43.c vm_43.c
Index: sys/compat/common/exec_aout_translate.c

RCS file: sys/compat/common/exec_aout_translate.c diff -N sys/compat/common/exec_aout_translate.c
--- /dev/null	1 Jan 1970 00:00:00 -0000

+++ sys/compat/common/exec_aout_translate.c 26 Apr 2003 14:42:03 -0000
@@ -0,0 +1,166 @@
+/* $OpenBSD$ */
+
+/*
+ * Copyright (c) 2003 Marc Espie
+ * 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. 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
Index: sys/kern/exec_aout.c

RCS file: /cvs/src/sys/kern/exec_aout.c,v retrieving revision 1.8
diff -u -p -r1.8 exec_aout.c
--- sys/kern/exec_aout.c	26 Jul 2002 23:32:50 -0000	1.8

+++ sys/kern/exec_aout.c 26 Apr 2003 14:42:04 -0000
@@ -41,6 +41,9 @@
 #include <uvm/uvm_extern.h>  
Do you need help?X

 #if defined(_KERN_DO_AOUT)
+#if defined(COMPAT_AOUT_TRANSLATE)
 

 /*

  • exec_aout_makecmds(): Check if it's an a.out-format executable. @@ -89,6 +92,9 @@ exec_aout_makecmds(p, epp)
 	if (error)
 		kill_vmcmds(&epp->ep_vmcmds);

+#ifdef COMPAT_AOUT_TRANSLATE
+ epp->ep_emul = &emul_aout_translate;
 

         return error;
 }
Index: sys/kern/init_main.c



RCS file: /cvs/src/sys/kern/init_main.c,v retrieving revision 1.101
diff -u -p -r1.101 init_main.c
--- sys/kern/init_main.c	6 Mar 2003 17:06:18 -0000	1.101

+++ sys/kern/init_main.c 26 Apr 2003 14:42:05 -0000
@@ -159,6 +159,31 @@ struct emul emul_native = { esigcode,

 };  

+#ifdef COMPAT_AOUT_TRANSLATE
+extern struct sysent aout_translate_sysent[];

 /*
  * System startup; initialize the world, create process 0, mount root
  * filesystem, and fork to create init and pagedaemon.  Most of the
@@ -197,6 +222,9 @@ main(framep)
 	printf(copyright);
 	printf("\n");
 

+#ifdef COMPAT_AOUT_TRANSLATE
+ aout_translate_init();
+#endif
uvm_init(); disk_init(); /* must come before autoconfiguration */ tty_init(); /* initialise tty's */
Do you need more help?X

Index: share/man/man4/options.4

RCS file: /cvs/src/share/man/man4/options.4,v retrieving revision 1.120
diff -u -p -r1.120 options.4
--- share/man/man4/options.4	3 Apr 2003 06:47:59 -0000	1.120

+++ share/man/man4/options.4 26 Apr 2003 14:42:07 -0000
@@ -164,6 +164,12 @@ applications built for the same architec
 This option is available on the alpha architecture.  See
 .Xr compat_osf1 8 .
+.It Cd Option COMPAT_AOUT_TRANSLATE
+On those ELF architectures that require it, this enables
+full compatibility with old a.out binaries, by allowing the
+a.out dynamic linking system to reside under
+.Pa /emul/a.out .
+This option is available on the i386 architecture.
 .It Cd option COMPAT_43
 Use of this option is discouraged.
 It enables compatibility with
Index: etc/rc

RCS file: /cvs/src/etc/rc,v
retrieving revision 1.226
diff -u -p -r1.226 rc
--- etc/rc	8 Apr 2003 01:53:43 -0000	1.226

+++ etc/rc 26 Apr 2003 14:42:08 -0000
@@ -401,6 +401,19 @@ if [ -f /sbin/ldconfig ]; then ldconfig $shlib_dirs

 fi  

+if [ -f /emul/a.out/sbin/ldconfig ]; then
 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then

 	echo -n "ssh-keygen: generating new DSA host key... "
 	if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
Index: etc/rc.conf

RCS file: /cvs/src/etc/rc.conf,v
retrieving revision 1.86
diff -u -p -r1.86 rc.conf
--- etc/rc.conf	10 Mar 2003 01:05:28 -0000	1.86

+++ etc/rc.conf 26 Apr 2003 14:42:08 -0000
@@ -83,6 +83,7 @@ afs_mount_point=/afs # Mountpoint for A afs_device=/dev/xfs0 # Device used by afsd afsd_flags=-z # Flags passed to afsd shlib_dirs= # extra directories for ldconfig
+aout_shlib_dirs= # extra directories for compat a.out ldconfig

 local_rcconf="/etc/rc.conf.local" Received on Sat Apr 26 10:48:14 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:48:39 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library