Commit Graph

190 Commits

Author SHA1 Message Date
kristerw 084ae1f838 ibcs2_debug is used only for IBCS2_DEBUG, so no need to define it otherwise. 2002-12-21 15:48:57 +00:00
jdolecek 47cd9b85d6 Get the dynamic interpreter location using emul_find_interp(), so that
it checks both the alternative/emul tree, and the non-emul tree.
This makes it possible to run chrooted emulated binaries without need
to setup shadow /emul tree within the chroot hierarchy.
Only tested for COMPAT_LINUX, changes to other compat modules were
mechanical.
Fixes kern/19161 by Christian Groessler.
2002-11-29 19:13:14 +00:00
christos 116bcb05d0 rename: s/sa_/<compat>sa/g 2002-11-26 18:43:20 +00:00
jdolecek 1524c4bf08 set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL 2002-11-01 19:26:21 +00:00
chs 993948e989 count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
2002-10-05 22:34:02 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
simonb 4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
simonb c8cb48355a Commit remaining part of PR1623 so the code in the PR actually gets
executed(!).
2002-09-23 04:55:09 +00:00
simonb 67f65715f9 ttspeedtab() is a function that returns an int, and returns -1 if
there's an error.  Store the result of this function in a signed
variable instead of an unsigned variable before checking if the return
value is greater than zero.
2002-09-23 04:49:32 +00:00
manu 80ee637534 - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
2002-09-21 21:14:54 +00:00
itojun f731d2b75a wrong semicolon at EOL. notified by wiz 2002-08-08 00:15:32 +00:00
itojun c1f124cb75 typo 2002-08-07 00:18:21 +00:00
itojun 8fc9db2b63 buffer len check. from silvio@qualys.com 2002-08-06 22:50:37 +00:00
itojun 8dd04cdcd7 correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls.  from openbsd
2002-08-03 00:12:48 +00:00
thorpej 011d4d5f44 Add kernel support for having userland provide the signal trampoline:
* struct sigacts gets a new sigact_sigdesc structure, which has the
  sigaction and the trampoline/version.  Version 0 means "legacy kernel
  provided trampoline".  Other versions are coordinated with machine-
  dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
  the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
  trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions.  Instead,
  sendsig() looks up the handler by peeking in the sigacts for the
  process getting the signal (since it has to look in there for the
  trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
  its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later.  Kernel
version not bumped; we will ride the 1.6C bump made recently.
2002-07-04 23:32:02 +00:00
christos ac29fb3782 make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
2002-03-31 22:22:43 +00:00
christos 381e6a7764 make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
2002-03-16 20:43:48 +00:00
lukem dab6ef8b56 add RCSIDs (including regeneration of files as appropriate) 2001-11-13 02:07:52 +00:00
thorpej e8ee04475d - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings.  Stop overloading VTEXT for this purpose (VTEXT
  also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
  mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
  than making a function call to do this (it no longer makes sense to
  use a function call, since we no longer overload VTEXT with VEXECMAP's
  meaning).

VEXECMAP suggested by Chuq Silvers.
2001-10-30 15:32:01 +00:00
jdolecek ef8abe0767 Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
2001-09-18 19:36:32 +00:00
christos 97c9d7a9dd rename elf32_read_from to exec_read_from since it is used in many places
now.
2001-07-14 02:05:05 +00:00
christos 0f380fac15 Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
2001-06-18 02:00:48 +00:00
manu a7cdf998ec Removed obsoletes EMUL_NO_BSD_ASYNCIO_PIPE and EMUL_NO_SIGIO_ON_READ flags.
Async I/O OS specifities should now handled in OS specific code. Linux
has been done, but other emulation should be handled. See case LINUX_F_SETFL
in sys/compat/linux/common/linux_file.c:linux_sys_fcntl() for more details.

The data that has been collected yet:

                                  Net Free Open Linux SunOS AIX OSF1 Darwin
send SIGIO to write end of pipe		Y  N    N     N     N    N   Y     Y
send SIGIO to read end of pipe      Y  Y    N     N     N    ?   Y     ?
send SIGIO to write end of socket   Y  Y    Y     N     N    Y   Y     Y
send SIGIO to read end of socket    Y  Y    Y     Y     Y    ?   Y     ?
2001-06-16 21:44:27 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
mrg 6a89288a37 use _KERNEL_OPT. 2001-05-30 11:37:21 +00:00
kristerw 7ae7504033 Added a 'break' on the last line in a switch statement, since the ISO
C standard do not permit labels at the end of compound statements.
2001-05-24 10:49:31 +00:00
manu 7e6929fe90 Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
2001-05-07 09:55:12 +00:00
thorpej 1b6a66420e Regen; add sy_flags. 2001-01-27 07:23:06 +00:00
jdolecek 13ca559d39 Use CHECK_ALT_SYMLINK() instead CHECK_ALT_EXISTS() where appropriate.
This addresses kern/11757.
2001-01-22 20:08:03 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
jdolecek e9e91a0fb5 split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
2000-12-22 22:58:52 +00:00
mycroft f495cd9dc6 Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN.  If this is defined, e_syscall is replaced by
  e_syscall_intern, which is called at key places in the kernel.  This can be
  used to set a MD syscall handler pointer.  This obsoletes and replaces the
  *_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL.  If this is defined, certain (deprecated) elements in
  struct emul are omitted.
2000-12-11 05:28:59 +00:00
mycroft f0689d5505 Regen. 2000-12-11 03:07:06 +00:00
mycroft 23babc12e5 Round up sysent table size. 2000-12-11 03:06:49 +00:00
jdolecek 87a6bee3a9 prototype ibcs2_syscall() in compat/ibcs2/ibcs2_exec.c 2000-12-09 12:45:44 +00:00
jdolecek a6ca890142 always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
2000-12-09 12:38:23 +00:00
mycroft dd92250590 Regen. 2000-12-09 07:11:17 +00:00
mycroft 9b7a9b2897 Get rid of the damn EMUL_GET* flags. 2000-12-09 07:10:34 +00:00
mycroft f348afacb9 Regen. 2000-12-09 05:37:01 +00:00
mycroft 9682cf0b09 Add the %% separators. 2000-12-09 05:27:28 +00:00
jdolecek 65203b4ec6 if IBCS2_MACHDEP_HAS_SEPARATED_SYSCALL is defined, put ibcs2_syscall to
emul_ibcs2
define IBCS2_MACHDEP_HAS_SEPARATED_SYSCALL in i386 ibcs2_machdep.h
2000-12-02 16:09:44 +00:00
jdolecek f1badb80a7 put executable format specific code from ibcs2_exec.c to separate
files ibcs2_exec_coff.c, ibcs2_exec_elf32.c, ibcs2_exec_xout.c as
appropriate
2000-12-01 19:17:41 +00:00
jdolecek 01040d97a2 add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
2000-12-01 12:28:30 +00:00
jdolecek 6626f506b3 LKMify 2000-11-30 19:05:26 +00:00
jdolecek 73f3cd8c7e LKMify 2000-11-29 21:51:49 +00:00
jdolecek baae0324b9 restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
  provide single struct emul per emulation
* elf:
  - kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
    per emulation and contains pointer to respective probe function
  - interp is allocated via MALLOC() rather than on stack
  - elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
  to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
  emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
  part of appropriate execsw[] entry
* constify couple of structures
2000-11-21 00:37:49 +00:00
jdolecek 78b866e95a change the type of *syscallnames[] array to 'const char * const foo[]' 2000-11-13 21:32:15 +00:00
sommerfeld 6b88a0fc51 Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.
2000-08-29 14:33:25 +00:00
matt 4e1f5ebf66 When reading dir entry by dir entry, we need to pad out the receive buffer
to at least a block to make ufs_readdir happy.
2000-08-23 21:11:47 +00:00
cgd 0199b04bef update for changed makesyscalls.master 2000-08-18 19:35:15 +00:00