1994-10-14 08:53:16 +00:00
|
|
|
|
/*-
|
|
|
|
|
* Copyright (c) 1994 Sean Eric Fagan
|
|
|
|
|
* Copyright (c) 1994 S<EFBFBD>ren Schmidt
|
|
|
|
|
* 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
|
|
|
|
|
* in this position and unchanged.
|
|
|
|
|
* 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. The name of the author may not be used to endorse or promote products
|
2002-06-02 20:05:59 +00:00
|
|
|
|
* derived from this software without specific prior written permission
|
1994-10-14 08:53:16 +00:00
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
|
* $FreeBSD$
|
1994-10-14 08:53:16 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/systm.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
|
#include <sys/fcntl.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
#include <sys/imgact.h>
|
|
|
|
|
#include <sys/kernel.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
|
#include <sys/lock.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
#include <sys/malloc.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
|
#include <sys/mman.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
#include <sys/mount.h>
|
1996-05-01 02:43:13 +00:00
|
|
|
|
#include <sys/namei.h>
|
|
|
|
|
#include <sys/vnode.h>
|
1995-12-07 12:48:31 +00:00
|
|
|
|
|
1994-10-14 08:53:16 +00:00
|
|
|
|
#include <vm/vm.h>
|
1995-12-07 12:48:31 +00:00
|
|
|
|
#include <vm/pmap.h>
|
|
|
|
|
#include <vm/vm_map.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
#include <vm/vm_kern.h>
|
1995-12-07 12:48:31 +00:00
|
|
|
|
#include <vm/vm_extern.h>
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
|
|
|
|
|
#include <i386/ibcs2/coff.h>
|
|
|
|
|
#include <i386/ibcs2/ibcs2_util.h>
|
|
|
|
|
|
2000-04-29 13:32:16 +00:00
|
|
|
|
MODULE_DEPEND(coff, ibcs2, 1, 1, 1);
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
extern struct sysentvec ibcs2_svr3_sysvec;
|
|
|
|
|
|
2002-03-20 05:48:58 +00:00
|
|
|
|
static int coff_load_file(struct thread *td, char *name);
|
|
|
|
|
static int exec_coff_imgact(struct image_params *imgp);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
|
2002-03-20 05:48:58 +00:00
|
|
|
|
static int load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
|
1994-10-14 08:53:16 +00:00
|
|
|
|
static int
|
1997-08-25 22:15:31 +00:00
|
|
|
|
load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset,
|
|
|
|
|
caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
{
|
|
|
|
|
size_t map_len;
|
|
|
|
|
vm_offset_t map_offset;
|
1995-04-08 15:52:30 +00:00
|
|
|
|
vm_offset_t map_addr;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
int error;
|
|
|
|
|
unsigned char *data_buf = 0;
|
|
|
|
|
size_t copy_len;
|
|
|
|
|
|
|
|
|
|
map_offset = trunc_page(offset);
|
1998-10-13 08:24:45 +00:00
|
|
|
|
map_addr = trunc_page((vm_offset_t)vmaddr);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
if (memsz > filsz) {
|
|
|
|
|
/*
|
|
|
|
|
* We have the stupid situation that
|
|
|
|
|
* the section is longer than it is on file,
|
|
|
|
|
* which means it has zero-filled areas, and
|
|
|
|
|
* we have to work for it. Stupid iBCS!
|
|
|
|
|
*/
|
|
|
|
|
map_len = trunc_page(offset + filsz) - trunc_page(map_offset);
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* The only stuff we care about is on disk, and we
|
|
|
|
|
* don't care if we map in more than is really there.
|
|
|
|
|
*/
|
|
|
|
|
map_len = round_page(offset + filsz) - trunc_page(map_offset);
|
|
|
|
|
}
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): vm_mmap(&vmspace->vm_map, &0x%08lx, 0x%x, 0x%x, "
|
1996-03-12 06:20:19 +00:00
|
|
|
|
"VM_PROT_ALL, MAP_PRIVATE | MAP_FIXED, vp, 0x%x)\n",
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
__FILE__, __LINE__, map_addr, map_len, prot, map_offset));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = vm_mmap(&vmspace->vm_map,
|
1994-10-14 08:53:16 +00:00
|
|
|
|
&map_addr,
|
|
|
|
|
map_len,
|
|
|
|
|
prot,
|
|
|
|
|
VM_PROT_ALL,
|
1996-03-12 06:20:19 +00:00
|
|
|
|
MAP_PRIVATE | MAP_FIXED,
|
1995-04-08 15:52:30 +00:00
|
|
|
|
(caddr_t) vp,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
map_offset)) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return error;
|
|
|
|
|
|
|
|
|
|
if (memsz == filsz) {
|
|
|
|
|
/* We're done! */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Now we have screwball stuff, to accomodate stupid COFF.
|
|
|
|
|
* We have to map the remaining bit of the file into the kernel's
|
|
|
|
|
* memory map, allocate some anonymous memory, copy that last
|
|
|
|
|
* bit into it, and then we're done. *sigh*
|
|
|
|
|
* For clean-up reasons, we actally map in the file last.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
copy_len = (offset + filsz) - trunc_page(offset + filsz);
|
1998-10-13 08:24:45 +00:00
|
|
|
|
map_addr = trunc_page((vm_offset_t)vmaddr + filsz);
|
|
|
|
|
map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1996-01-19 23:00:38 +00:00
|
|
|
|
DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx,0x%x, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", __FILE__, __LINE__, map_addr, map_len));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1995-02-20 23:52:39 +00:00
|
|
|
|
if (map_len != 0) {
|
1995-04-08 15:52:30 +00:00
|
|
|
|
error = vm_map_find(&vmspace->vm_map, NULL, 0, &map_addr,
|
1996-01-19 23:00:38 +00:00
|
|
|
|
map_len, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0);
|
1995-02-20 23:52:39 +00:00
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
}
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = vm_mmap(kernel_map,
|
1995-04-08 15:52:30 +00:00
|
|
|
|
(vm_offset_t *) &data_buf,
|
|
|
|
|
PAGE_SIZE,
|
|
|
|
|
VM_PROT_READ,
|
|
|
|
|
VM_PROT_READ,
|
1996-03-12 06:20:19 +00:00
|
|
|
|
0,
|
1995-04-08 15:52:30 +00:00
|
|
|
|
(caddr_t) vp,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
trunc_page(offset + filsz))) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return error;
|
|
|
|
|
|
1996-03-12 06:13:08 +00:00
|
|
|
|
error = copyout(data_buf, (caddr_t) map_addr, copy_len);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1995-04-08 15:52:30 +00:00
|
|
|
|
if (vm_map_remove(kernel_map,
|
|
|
|
|
(vm_offset_t) data_buf,
|
|
|
|
|
(vm_offset_t) data_buf + PAGE_SIZE))
|
1995-02-20 23:52:39 +00:00
|
|
|
|
panic("load_coff_section vm_map_remove failed");
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1996-03-12 06:13:08 +00:00
|
|
|
|
return error;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
|
1998-02-09 06:11:36 +00:00
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
|
coff_load_file(struct thread *td, char *name)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
|
struct proc *p = td->td_proc;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
struct vmspace *vmspace = p->p_vmspace;
|
|
|
|
|
int error;
|
|
|
|
|
struct nameidata nd;
|
1995-11-06 12:52:37 +00:00
|
|
|
|
struct vnode *vp;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
struct vattr attr;
|
|
|
|
|
struct filehdr *fhdr;
|
|
|
|
|
struct aouthdr *ahdr;
|
|
|
|
|
struct scnhdr *scns;
|
|
|
|
|
char *ptr = 0;
|
|
|
|
|
int nscns;
|
|
|
|
|
unsigned long text_offset = 0, text_address = 0, text_size = 0;
|
|
|
|
|
unsigned long data_offset = 0, data_address = 0, data_size = 0;
|
|
|
|
|
unsigned long bss_size = 0;
|
|
|
|
|
int i;
|
|
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
|
NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, td);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
|
1994-10-14 08:53:16 +00:00
|
|
|
|
error = namei(&nd);
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
|
1995-11-06 12:52:37 +00:00
|
|
|
|
vp = nd.ni_vp;
|
|
|
|
|
if (vp == NULL)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return ENOEXEC;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
|
1995-11-06 12:52:37 +00:00
|
|
|
|
if (vp->v_writecount) {
|
1994-10-14 08:53:16 +00:00
|
|
|
|
error = ETXTBSY;
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
|
if ((error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
|
1995-11-06 12:52:37 +00:00
|
|
|
|
if ((vp->v_mount->mnt_flag & MNT_NOEXEC)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|| ((attr.va_mode & 0111) == 0)
|
2001-01-27 00:01:31 +00:00
|
|
|
|
|| (attr.va_type != VREG))
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
|
|
if (attr.va_size == 0) {
|
|
|
|
|
error = ENOEXEC;
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
|
if ((error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td)) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
|
if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td)) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
|
1995-09-13 02:12:51 +00:00
|
|
|
|
/*
|
|
|
|
|
* Lose the lock on the vnode. It's no longer needed, and must not
|
|
|
|
|
* exist for the pagefault paging to work below.
|
|
|
|
|
*/
|
2001-09-12 08:38:13 +00:00
|
|
|
|
VOP_UNLOCK(vp, 0, td);
|
1995-09-13 02:12:51 +00:00
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = vm_mmap(kernel_map,
|
1995-04-08 15:52:30 +00:00
|
|
|
|
(vm_offset_t *) &ptr,
|
|
|
|
|
PAGE_SIZE,
|
|
|
|
|
VM_PROT_READ,
|
|
|
|
|
VM_PROT_READ,
|
1996-03-12 06:20:19 +00:00
|
|
|
|
0,
|
1995-11-06 12:52:37 +00:00
|
|
|
|
(caddr_t) vp,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
0)) != 0)
|
1999-11-14 17:33:40 +00:00
|
|
|
|
goto unlocked_fail;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
fhdr = (struct filehdr *)ptr;
|
|
|
|
|
|
|
|
|
|
if (fhdr->f_magic != I386_COFF) {
|
|
|
|
|
error = ENOEXEC;
|
|
|
|
|
goto dealloc_and_fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nscns = fhdr->f_nscns;
|
|
|
|
|
|
|
|
|
|
if ((nscns * sizeof(struct scnhdr)) > PAGE_SIZE) {
|
|
|
|
|
/*
|
|
|
|
|
* XXX -- just fail. I'm so lazy.
|
|
|
|
|
*/
|
|
|
|
|
error = ENOEXEC;
|
|
|
|
|
goto dealloc_and_fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ahdr = (struct aouthdr*)(ptr + sizeof(struct filehdr));
|
|
|
|
|
|
|
|
|
|
scns = (struct scnhdr*)(ptr + sizeof(struct filehdr)
|
|
|
|
|
+ sizeof(struct aouthdr));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nscns; i++) {
|
|
|
|
|
if (scns[i].s_flags & STYP_NOLOAD)
|
|
|
|
|
continue;
|
|
|
|
|
else if (scns[i].s_flags & STYP_TEXT) {
|
|
|
|
|
text_address = scns[i].s_vaddr;
|
|
|
|
|
text_size = scns[i].s_size;
|
|
|
|
|
text_offset = scns[i].s_scnptr;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
}
|
1994-10-14 08:53:16 +00:00
|
|
|
|
else if (scns[i].s_flags & STYP_DATA) {
|
|
|
|
|
data_address = scns[i].s_vaddr;
|
|
|
|
|
data_size = scns[i].s_size;
|
|
|
|
|
data_offset = scns[i].s_scnptr;
|
|
|
|
|
} else if (scns[i].s_flags & STYP_BSS) {
|
|
|
|
|
bss_size = scns[i].s_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = load_coff_section(vmspace, vp, text_offset,
|
1998-08-16 01:21:52 +00:00
|
|
|
|
(caddr_t)(void *)(uintptr_t)text_address,
|
1994-10-14 08:53:16 +00:00
|
|
|
|
text_size, text_size,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
VM_PROT_READ | VM_PROT_EXECUTE)) != 0) {
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto dealloc_and_fail;
|
|
|
|
|
}
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = load_coff_section(vmspace, vp, data_offset,
|
1998-08-16 01:21:52 +00:00
|
|
|
|
(caddr_t)(void *)(uintptr_t)data_address,
|
1994-10-14 08:53:16 +00:00
|
|
|
|
data_size + bss_size, data_size,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
VM_PROT_ALL)) != 0) {
|
1994-10-14 08:53:16 +00:00
|
|
|
|
goto dealloc_and_fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error = 0;
|
|
|
|
|
|
1999-11-14 17:33:40 +00:00
|
|
|
|
dealloc_and_fail:
|
1995-04-08 15:52:30 +00:00
|
|
|
|
if (vm_map_remove(kernel_map,
|
|
|
|
|
(vm_offset_t) ptr,
|
|
|
|
|
(vm_offset_t) ptr + PAGE_SIZE))
|
2001-12-10 08:09:49 +00:00
|
|
|
|
panic("%s vm_map_remove failed", __func__);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
fail:
|
2001-09-12 08:38:13 +00:00
|
|
|
|
VOP_UNLOCK(vp, 0, td);
|
1999-11-14 17:33:40 +00:00
|
|
|
|
unlocked_fail:
|
1999-12-15 23:02:35 +00:00
|
|
|
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
1999-11-14 17:33:40 +00:00
|
|
|
|
vrele(nd.ni_vp);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-09 06:11:36 +00:00
|
|
|
|
static int
|
1995-11-06 12:52:37 +00:00
|
|
|
|
exec_coff_imgact(imgp)
|
|
|
|
|
struct image_params *imgp;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
{
|
1996-09-03 22:19:16 +00:00
|
|
|
|
const struct filehdr *fhdr = (const struct filehdr*)imgp->image_header;
|
|
|
|
|
const struct aouthdr *ahdr;
|
|
|
|
|
const struct scnhdr *scns;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
int i;
|
1997-04-13 01:48:35 +00:00
|
|
|
|
struct vmspace *vmspace;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
int nscns;
|
1996-06-12 05:11:41 +00:00
|
|
|
|
int error;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
unsigned long text_offset = 0, text_address = 0, text_size = 0;
|
|
|
|
|
unsigned long data_offset = 0, data_address = 0, data_size = 0;
|
|
|
|
|
unsigned long bss_size = 0;
|
|
|
|
|
caddr_t hole;
|
|
|
|
|
|
|
|
|
|
if (fhdr->f_magic != I386_COFF ||
|
|
|
|
|
!(fhdr->f_flags & F_EXEC)) {
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): return -1\n", __FILE__, __LINE__));
|
|
|
|
|
return -1;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nscns = fhdr->f_nscns;
|
|
|
|
|
if ((nscns * sizeof(struct scnhdr)) > PAGE_SIZE) {
|
|
|
|
|
/*
|
|
|
|
|
* For now, return an error -- need to be able to
|
|
|
|
|
* read in all of the section structures.
|
|
|
|
|
*/
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): return -1\n", __FILE__, __LINE__));
|
|
|
|
|
return -1;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-09-03 22:19:16 +00:00
|
|
|
|
ahdr = (const struct aouthdr*)
|
|
|
|
|
((const char*)(imgp->image_header) + sizeof(struct filehdr));
|
1995-11-06 12:52:37 +00:00
|
|
|
|
imgp->entry_addr = ahdr->entry;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1996-09-03 22:19:16 +00:00
|
|
|
|
scns = (const struct scnhdr*)
|
|
|
|
|
((const char*)(imgp->image_header) + sizeof(struct filehdr) +
|
|
|
|
|
sizeof(struct aouthdr));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = exec_extract_strings(imgp)) != 0) {
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): return %d\n", __FILE__, __LINE__, error));
|
|
|
|
|
return error;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-20 02:56:12 +00:00
|
|
|
|
exec_new_vmspace(imgp, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK);
|
1997-04-13 01:48:35 +00:00
|
|
|
|
vmspace = imgp->proc->p_vmspace;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < nscns; i++) {
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("i = %d, scns[i].s_name = %s, scns[i].s_vaddr = %08lx, "
|
|
|
|
|
"scns[i].s_scnptr = %d\n", i, scns[i].s_name,
|
|
|
|
|
scns[i].s_vaddr, scns[i].s_scnptr));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
if (scns[i].s_flags & STYP_NOLOAD) {
|
|
|
|
|
/*
|
|
|
|
|
* A section that is not loaded, for whatever
|
|
|
|
|
* reason. It takes precedance over other flag
|
|
|
|
|
* bits...
|
|
|
|
|
*/
|
|
|
|
|
continue;
|
|
|
|
|
} else if (scns[i].s_flags & STYP_TEXT) {
|
|
|
|
|
text_address = scns[i].s_vaddr;
|
|
|
|
|
text_size = scns[i].s_size;
|
|
|
|
|
text_offset = scns[i].s_scnptr;
|
|
|
|
|
} else if (scns[i].s_flags & STYP_DATA) {
|
|
|
|
|
/* .data section */
|
|
|
|
|
data_address = scns[i].s_vaddr;
|
|
|
|
|
data_size = scns[i].s_size;
|
|
|
|
|
data_offset = scns[i].s_scnptr;
|
|
|
|
|
} else if (scns[i].s_flags & STYP_BSS) {
|
|
|
|
|
/* .bss section */
|
|
|
|
|
bss_size = scns[i].s_size;
|
|
|
|
|
} else if (scns[i].s_flags & STYP_LIB) {
|
1996-06-12 05:11:41 +00:00
|
|
|
|
char *buf = 0;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
int foff = trunc_page(scns[i].s_scnptr);
|
|
|
|
|
int off = scns[i].s_scnptr - foff;
|
|
|
|
|
int len = round_page(scns[i].s_size + PAGE_SIZE);
|
|
|
|
|
int j;
|
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = vm_mmap(kernel_map,
|
1995-04-08 15:52:30 +00:00
|
|
|
|
(vm_offset_t *) &buf,
|
|
|
|
|
len,
|
|
|
|
|
VM_PROT_READ,
|
|
|
|
|
VM_PROT_READ,
|
1996-03-12 06:20:19 +00:00
|
|
|
|
0,
|
1995-11-06 12:52:37 +00:00
|
|
|
|
(caddr_t) imgp->vp,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
foff)) != 0) {
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return ENOEXEC;
|
|
|
|
|
}
|
1995-10-10 17:33:19 +00:00
|
|
|
|
if(scns[i].s_size) {
|
|
|
|
|
char *libbuf;
|
|
|
|
|
int emul_path_len = strlen(ibcs2_emul_path);
|
|
|
|
|
|
|
|
|
|
libbuf = malloc(MAXPATHLEN + emul_path_len,
|
|
|
|
|
M_TEMP, M_WAITOK);
|
|
|
|
|
strcpy(libbuf, ibcs2_emul_path);
|
|
|
|
|
|
|
|
|
|
for (j = off; j < scns[i].s_size + off; j++) {
|
|
|
|
|
char *libname;
|
|
|
|
|
|
|
|
|
|
libname = buf + j + 4 * *(long*)(buf + j + 4);
|
|
|
|
|
j += 4* *(long*)(buf + j);
|
|
|
|
|
|
|
|
|
|
DPRINTF(("%s(%d): shared library %s\n",
|
|
|
|
|
__FILE__, __LINE__, libname));
|
|
|
|
|
strcpy(&libbuf[emul_path_len], libname);
|
2002-02-07 20:58:47 +00:00
|
|
|
|
/* XXXKSE only 1:1 in coff */ error = coff_load_file(
|
|
|
|
|
FIRST_THREAD_IN_PROC(imgp->proc), libbuf);
|
1995-10-10 17:33:19 +00:00
|
|
|
|
if (error)
|
2002-02-07 20:58:47 +00:00
|
|
|
|
error = coff_load_file(
|
|
|
|
|
FIRST_THREAD_IN_PROC(imgp->proc),
|
|
|
|
|
libname);
|
1995-10-10 17:33:19 +00:00
|
|
|
|
if (error)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
free(libbuf, M_TEMP);
|
|
|
|
|
}
|
1995-04-08 15:52:30 +00:00
|
|
|
|
if (vm_map_remove(kernel_map,
|
|
|
|
|
(vm_offset_t) buf,
|
|
|
|
|
(vm_offset_t) buf + len))
|
1995-02-20 23:52:39 +00:00
|
|
|
|
panic("exec_coff_imgact vm_map_remove failed");
|
1994-10-14 08:53:16 +00:00
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Map in .text now
|
|
|
|
|
*/
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): load_coff_section(vmspace, "
|
1995-11-06 12:52:37 +00:00
|
|
|
|
"imgp->vp, %08lx, %08lx, 0x%x, 0x%x, 0x%x)\n",
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
__FILE__, __LINE__, text_offset, text_address,
|
|
|
|
|
text_size, text_size, VM_PROT_READ | VM_PROT_EXECUTE));
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = load_coff_section(vmspace, imgp->vp,
|
1998-08-16 01:21:52 +00:00
|
|
|
|
text_offset,
|
|
|
|
|
(caddr_t)(void *)(uintptr_t)text_address,
|
1994-10-14 08:53:16 +00:00
|
|
|
|
text_size, text_size,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
VM_PROT_READ | VM_PROT_EXECUTE)) != 0) {
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Map in .data and .bss now
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): load_coff_section(vmspace, "
|
1995-11-06 12:52:37 +00:00
|
|
|
|
"imgp->vp, 0x%08lx, 0x%08lx, 0x%x, 0x%x, 0x%x)\n",
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
__FILE__, __LINE__, data_offset, data_address,
|
|
|
|
|
data_size + bss_size, data_size, VM_PROT_ALL));
|
1999-01-28 01:59:53 +00:00
|
|
|
|
if ((error = load_coff_section(vmspace, imgp->vp,
|
1998-08-16 01:21:52 +00:00
|
|
|
|
data_offset,
|
|
|
|
|
(caddr_t)(void *)(uintptr_t)data_address,
|
1994-10-14 08:53:16 +00:00
|
|
|
|
data_size + bss_size, data_size,
|
1999-01-28 01:59:53 +00:00
|
|
|
|
VM_PROT_ALL)) != 0) {
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error));
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
1995-11-06 12:52:37 +00:00
|
|
|
|
imgp->interpreted = 0;
|
|
|
|
|
imgp->proc->p_sysent = &ibcs2_svr3_sysvec;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
vmspace->vm_tsize = round_page(text_size) >> PAGE_SHIFT;
|
|
|
|
|
vmspace->vm_dsize = round_page(data_size + bss_size) >> PAGE_SHIFT;
|
1998-08-16 01:21:52 +00:00
|
|
|
|
vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)text_address;
|
|
|
|
|
vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t)data_address;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
1998-10-13 08:24:45 +00:00
|
|
|
|
hole = (caddr_t)trunc_page((vm_offset_t)vmspace->vm_daddr) + ctob(vmspace->vm_dsize);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-19 23:00:38 +00:00
|
|
|
|
DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx, PAGE_SIZE, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n",
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
__FILE__, __LINE__, hole));
|
|
|
|
|
DPRINTF(("imgact: error = %d\n", error));
|
|
|
|
|
|
1995-04-08 15:52:30 +00:00
|
|
|
|
error = vm_map_find(&vmspace->vm_map, NULL, 0,
|
1996-01-19 23:00:38 +00:00
|
|
|
|
(vm_offset_t *) &hole, PAGE_SIZE, FALSE,
|
|
|
|
|
VM_PROT_ALL, VM_PROT_ALL, 0);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
|
DPRINTF(("IBCS2: start vm_dsize = 0x%x, vm_daddr = 0x%x end = 0x%x\n",
|
|
|
|
|
ctob(vmspace->vm_dsize), vmspace->vm_daddr,
|
|
|
|
|
ctob(vmspace->vm_dsize) + vmspace->vm_daddr ));
|
|
|
|
|
DPRINTF(("%s(%d): returning successfully!\n", __FILE__, __LINE__));
|
|
|
|
|
|
1995-08-24 10:32:37 +00:00
|
|
|
|
/* Indicate that this file should not be modified */
|
1995-11-06 12:52:37 +00:00
|
|
|
|
imgp->vp->v_flag |= VTEXT;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Tell kern_execve.c about it, with a little help from the linker.
|
|
|
|
|
*/
|
1999-05-09 16:04:14 +00:00
|
|
|
|
static struct execsw coff_execsw = { exec_coff_imgact, "coff" };
|
1998-10-16 03:55:01 +00:00
|
|
|
|
EXEC_SET(coff, coff_execsw);
|