Commit Graph

2731 Commits

Author SHA1 Message Date
thorpej c8f5c657b5 Add ULL to a 64-bit integer constant. 2002-11-25 02:11:23 +00:00
manu 5bdd9578e4 Better vm_allocate emulation. 2002-11-24 17:22:59 +00:00
manu 1aaacd96d2 Give a second chance when vm_allocate fail, by finding another free region.
Seems to fix some problems.
2002-11-24 11:49:36 +00:00
wiz ad774d9d77 Fix stack alignment; uses same alignment as COMPAT_LINUX.
Found by manu.
2002-11-23 17:35:06 +00:00
manu 1ee1245718 Add support for two Darwin sysctl 2002-11-23 02:18:53 +00:00
manu af59b63bbd We now have the exact stack initial stack layout of Darwin:
macho_hdr, argc, *argv, NULL, *envp, NULL, progname, NULL,
*progname, **argv, **envp

Where progname is a pointer to the program name as given in the first
argument to execve(), and macho_hdr a pointer to the Mach-O header at
the beginning of the executable file.
2002-11-21 19:53:40 +00:00
jdolecek 2ca4879bd1 g/c also mips-specific linux ELF copyargs function prototype and
linux ELF defines, use generic Aux32Info instead
this also adresses kern/19047 by FUKAUMI Naoki
2002-11-21 15:32:32 +00:00
jdolecek 0a624a0c15 back previous off; port can only supply LINUX_ELF_AUX_ENTRIES if it also
overrides the ELF copyargs function
2002-11-21 15:20:28 +00:00
jdolecek 3590104898 g/c local definition of LINUX_ELF_AUX_ENTRIES 2002-11-21 15:18:37 +00:00
manu 1af0fa979f Better immitate Darwin startup stack layout: there is a slot for the program
name after envp, and the 0x1000 at the beginning is a pointer to the binary
mach header (we don't emulate this correctly yet).
2002-11-20 23:54:39 +00:00
manu a0d341067e Added host_info(PRIORITY_INFO) 2002-11-20 07:17:11 +00:00
christos 733d2a038f Make the OSABI and the branding optional. Tested by Ben Collver, thanks. 2002-11-19 22:38:07 +00:00
christos 63e4ec4bd7 implement mach_insert_port_right() 2002-11-19 19:54:07 +00:00
christos 645fa8d600 remove stack adjustment. 2002-11-19 16:29:32 +00:00
christos 8012fc6cf2 use mach_integer_t instead of just int. 2002-11-19 16:18:43 +00:00
manu fe8f53c2a4 in mach_sys_map_fd, if the mapping failed because of the requested place
is already used, we want to remap to another place. The vmcmd must be
completely rebuild, else things does not work as expected, as the vmcmd has
been modified by the first mapping attempt.
2002-11-17 18:39:48 +00:00
manu 55c5227095 Add vm_map and vnode locking 2002-11-17 16:51:12 +00:00
manu 08616982e5 regen 2002-11-17 02:48:12 +00:00
manu 9215e8d4ed regen 2002-11-17 02:48:11 +00:00
manu 7d02c9fff8 Implement mach_sys_load_shared_file. This are not complete yet, especially
wrt to the flags, but at least it does relocations.
2002-11-17 02:46:24 +00:00
manu a26a564e59 Implment map_fd mach trap
Fix host_info(BASIC_INFO) which was broken wrt to the number of field
returned.
2002-11-16 20:00:29 +00:00
manu 745fc5c9a0 Change a syscal name 2002-11-16 19:59:19 +00:00
uebayasi c041971257 Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.
Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.
2002-11-16 07:40:38 +00:00
wdk b0fb4471b2 Fix LINUX_ELF_AUX_ENTRIES sociability issue with Mips based ports 2002-11-15 22:44:57 +00:00
christos 7ae22e4da5 it is not kosher to include the same file twice. 2002-11-15 16:10:51 +00:00
manu ffc06908b6 Regen 2002-11-14 21:48:23 +00:00
manu 897d942130 Use FreeBSD emulation to get pathname lookups in /emul/darwin. These FreeBSD
emulated system call just check in /emul and call the native system call.
2002-11-14 21:47:15 +00:00
christos 09495207e1 darwin needs us. 2002-11-14 21:38:51 +00:00
christos b165b2e229 improve on debugging. 2002-11-14 21:17:30 +00:00
christos f9ddf42b17 the host basic info belongs with the cpu.
attempt to make the semaphore traps work, by doing nothing.
2002-11-14 19:44:06 +00:00
jdolecek 6788e239e4 we now export information about CLK_TCK via ELF aux args, no need to
hardcode '100' for times(2) anymore; use 'hz' instead
2002-11-13 15:20:04 +00:00
jdolecek cee43b67cc add generic linux compat ELF copyargs function
this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
  even if hz != 100
* glibc gets proper information on real/effective uid and enables
  secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
2002-11-13 15:16:27 +00:00
jdolecek 9def367548 need to use Aux32Info explicitly, not AuxInfo alone, to work
within context of kern/exec_conf.c
2002-11-13 14:35:15 +00:00
jdolecek dc57bd5cb7 eliminate remaining LinuxAuxInfo 2002-11-13 13:42:06 +00:00
jdolecek e97bb63dae need to use LINUX_ELF_AUX_ENTRIES in LINUX_ELF_AUX_ARGSIZ
how this ever could have worked?
2002-11-13 13:40:51 +00:00
jdolecek 3e8efcdd61 use generic ELF AuxInfo, no need to define a 'linux' variant here
simplify LINUX_ELF_AUX_ARGSIZ definition, LINUX_SP_WRAP is always defined here
2002-11-13 13:37:22 +00:00
jdolecek 081a94b01c linux_sys_times(): if tms is NULL, just return the number of ticks since
boot, don't error out; this matches what Linux does

Fixes problem reported in kern/19027
2002-11-13 08:27:10 +00:00
manu 530968e795 The kernel now builds with COMPAT_DARWIN. 2002-11-12 23:40:19 +00:00
manu f3eaadfead Darwin system calls skeleton 2002-11-12 22:04:07 +00:00
manu 114cae0e54 Fix the stack layout on program startup. This should be:
(8 bytes boundary) PAGE_SIZE   argc    argv  .... envp
2002-11-12 19:01:18 +00:00
manu f130f7a839 In mach_reply_port, don't increment the returned port for now, this confuses
the binary on the second launch.
In mach_vm_map, hack in a failure so that we fail exactly like Darwin when
mapping a page at address 0
Add vm_allocate trap
2002-11-12 06:14:39 +00:00
manu 3eb20e3576 mach_ports_lookup allocate one page of memory and returns its address.
On error, most traps return a short packet with just an error code, emulate
this correctly.
2002-11-12 05:18:31 +00:00
manu d56caea9ae - Cleanup msg bits and trailer values
- a few dumb bug fixes
2002-11-11 09:28:00 +00:00
manu 293d243256 Introduce a better error reporting, using mach error codes
It seems there is no need to use dynamic allocation in mach_host_info.
2002-11-11 01:18:44 +00:00
manu 38455f4db0 The message id of replies is simply the message id of the request plus 100... 2002-11-10 22:05:35 +00:00
manu 556831bae9 More mach traps:
mach_port_deallocate, task_get_special_port, mach_ports_lookup,
vm_deallocate, vm_map, host_get_clock_service.
2002-11-10 21:53:40 +00:00
jdolecek f50246965e handle __HAVE_MINIMAL_EMUL 2002-11-10 20:59:03 +00:00
manu e9adbe1e47 Added mach_sys_msg_trap system call, and the host_page_size trap. 2002-11-10 09:41:45 +00:00
manu 4855282dc6 Implment one command of the host_info mach trap, which check for mach_msg_trap
availability
2002-11-10 02:18:03 +00:00
manu 99bc517790 Added sysctl to change all IRIX kernel values reported by uname and systeminfo:
OS name, hw name, kernel version, and so forth.
2002-11-09 09:03:56 +00:00
manu 873ed6f9ee Added support for Darwin's PowerPC-only system calls:
ppccalls, with system call numbers starting at 0x6000
fasttraps, with system call numbers starting at 0x7FF0

Because the Mach system call dispatching code has grown a bit
too much, introduce an inline function to handle it (mach_syscall_dispatch).

While we are there, remove the Mach and Linux includes from
arch/powerpc/powerpc/syscall.c and push them into
arch/powerpc/powerpc/{mach|linux}_syscall.c
2002-11-03 23:17:18 +00:00
jdolecek 7aca3aed62 retval is 'register_t *', not 'int *' 2002-11-02 17:05:19 +00:00
perry 9fcaba1f66 Add lint infrastructure 2002-11-02 07:49:57 +00:00
perry 889bb793ca set LLIBS= so we don't try to check the lint lib against llib-lc.ln 2002-11-02 07:49:29 +00:00
jdolecek 20e698bdc1 set nsysent to 512 (oh well, just three syscalls too many for 256) 2002-11-01 21:24:19 +00:00
jdolecek 3b4db9c39d set nsysent to 256 2002-11-01 21:09:52 +00:00
jdolecek 2cfacee0a0 set nsysent to 256 2002-11-01 20:44:43 +00:00
jdolecek 22ca1fc9f1 set nsysent to 512 2002-11-01 20:32:13 +00:00
jdolecek 8bf8260072 regen: nsysent set to 256 2002-11-01 20:24:23 +00:00
jdolecek 11422af13d nsysent set to 256, and use linux_sys_nosys() 2002-11-01 20:23:23 +00:00
jdolecek d53c88616f add appropriate nsysent, and use linux_sys_nosys as sys_nosys 2002-11-01 20:20:52 +00:00
jdolecek faf637ce78 add appropriate nsysent 2002-11-01 20:20:10 +00:00
jdolecek de9c76a3b0 add appropriate sys_nosys and nsysent (not that it matters here too much) 2002-11-01 20:19:29 +00:00
jdolecek 81d274c850 make compile without DEBUG_MACH 2002-11-01 20:04:40 +00:00
jdolecek e608322a28 regen: bump nsysent to nearest p-o-2 (256) 2002-11-01 19:30:28 +00:00
jdolecek a0d3a3c03f bump nsysent to nearest p-o-2 2002-11-01 19:29:21 +00:00
jdolecek 1524c4bf08 set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL 2002-11-01 19:26:21 +00:00
christos 1e48015df9 more debugging for the overwrite trap. 2002-10-30 15:04:17 +00:00
manu e5620d742d KNF 2002-10-27 22:22:04 +00:00
manu 998f955471 Inaccurate comment fixed: This is not about SVR4, it's Mach 2002-10-27 21:41:51 +00:00
manu f8aec0fd04 Added a cleanup function for the (un)shared region list, so that it does
not grow forever.
2002-10-23 21:30:46 +00:00
manu 13a3d2ed82 In mmap, use the address returned by sys_mmap to keep track of (un)shared
regions
2002-10-23 20:45:38 +00:00
scw 305ef1efe0 Regen to pick up netbsd32___sigaction_sigtramp addition. 2002-10-23 13:18:17 +00:00
scw cb52115837 In preparation for COMPAT_NETBSD32 on SH-5:
- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
   instead of using u_int32_t everywhere,
 - The MD netbsd32_machdep.h header now defines a macro (at least on
   current implementations) which converts a 32-bit pointer to its 64-bit
   equivalent,
 - Change the MI code to utilise the above two items in all the right places,
 - Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
2002-10-23 13:16:38 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
christos ea0cda2cda remove XXX should die comment from the define; otherwise traditional cpp
screws up the elf name formation.
2002-10-22 23:31:24 +00:00
simonb 8465b6a98d Don't call cdevsw_lookup() with an uninitialised variable in
linux_sys_ioctl().
2002-10-22 11:55:10 +00:00
manu eeb799a6c9 Implement MAP_LOCAL option to mmap, which enable the mapping of regions
private to the process within the share group.

There is one bit missing in this implementation: when replicating a change
in a process VM to the other process of the share group, we avoid copying
mappings for private regions in the target process, but we don't prevent
copying private regions from the source process.
2002-10-14 21:14:23 +00:00
manu f3d9e2a4ab Implement IRIX_SGI_NUM_MODULES and IRIX_SGI_MODULE_INFO syssgi() commands. 2002-10-13 22:13:47 +00:00
manu 9d7899c2dc Return the hostid when equested HW_SERIAL (it seems it works like this) 2002-10-13 21:07:41 +00:00
manu 2001eb6db2 Added SGI_RUSAGE command to syssgi (this is a BSD rusage) 2002-10-12 08:53:46 +00:00
jdolecek 63c35652f5 replace irix_usemaFOO functions with noFOO/nullFOO as approprite in cdevsw,
g/c now unneeded functions
2002-10-11 20:07:48 +00:00
thorpej d47fd44e41 Avoid collision with __unused in sys/cdefs.h. 2002-10-10 07:25:21 +00:00
pooka 8e4950499d regen for rfork 2002-10-09 20:24:10 +00:00
pooka 324d517241 FreeBSD rfork emulation 2002-10-09 20:22:47 +00:00
junyoung 33ecb0af91 Get rid of pcb_flags which is no longer existent. 2002-10-09 05:07:55 +00:00
manu 075c3542d8 Added uname emulation so that IRIX's uname -s returns IRIX 2002-10-05 23:17:29 +00:00
manu e9b4436254 Fixed typo in a comment 2002-10-05 23:15:58 +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
manu 6589fa5eda Added an ioctl emulation so that IRIX's tar is able to extract a file. 2002-10-05 21:29:02 +00:00
scw b34d6729f8 Add !defined(_LP64) in the appropriate places to correspond with
sys/syscallargs.h.
2002-09-28 10:20:01 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
thorpej 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +00:00
manu deca50b66c Fill BADVADDR and CAUSE in sigcontext. We still don't restore them, but
it actually fixes a problem:
When /bin/sh gets a SIGSEGV, its signal handler calls brk and the offending
instruction is retried. Usually it gets another SIGSEGV, and things loops
until it pases without the SIGSEGV. This is the normal mode of operation, and
it can be reproduced on IRIX by a 10kB shell script starting by echo /*

However... the signal handler checks for BADVADDR in the saved registers
in struct sigcontext. If it does not find it, it gives up and exit instead
of retrying. Filling the field enables us to carry on normal operation
(which is to get dozens of SIGSEGV) instead of getting a failure at the
first SIGSEGV.
2002-09-25 19:39:16 +00:00
manu 7216eba62a We now fill the struct siginfo when requested (SA_SIGINFO flag to sigaction) 2002-09-25 19:09:50 +00:00
simonb aae67f532c Remove a meaningless type qualifier on a cast. 2002-09-23 05:57:44 +00:00
simonb 4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
simonb 6ddc09dab1 Put storage class first in "static const" declaration. 2002-09-23 05:03:03 +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
martin 062ee8dd14 p->p_sigacts -> p->p_sigctx 2002-09-16 03:41:40 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
christos fad54bde7f Make this match reality [not used yet] 2002-09-05 22:28:10 +00:00
christos 2043e8b0c4 remove XXX: 2002-09-05 22:27:36 +00:00
christos 6cc149625b check out EI_OSABI and EI_ABIVERSION for linux signatures. This is what
http://upx.sourceforge.net/ binaries are like.
2002-09-05 14:32:49 +00:00
martin 5eee9e2b47 Adapt to recent exec changes. 2002-08-29 14:02:50 +00:00
christos 9cf6437e8f Fix internal copyargs too. 2002-08-29 14:01:08 +00:00
christos ff79c1e140 adjust copyargs signature to pass struct proc. 2002-08-29 13:59:23 +00:00
christos f2d5bd5133 s/au_/a_/g noticed by martin 2002-08-29 13:48:42 +00:00
christos 830c5c171a Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
2002-08-26 21:05:59 +00:00
thorpej cf013daeb3 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:18:15 +00:00
manu 652fe89179 - add locks to structures used by the /dev/usema driver and the
usync_cntl() system calls.

- when usync_cntl is used and the process is aborted (eg: by kill -9)
libc does not call usync_cntl() to unblock things. We have to cleanup
data allocated in the kernel. This is now done through the emulation
specific exit hook

- IRIX initialize some data in the system part of the PRDA: the pid and
a prid (PRDA ID?). We initialize both to pid.

- Move back struct irix_share_group from irix_exec.h to irix_prctl.h, it
is more revelant here.

- fix a few typos
2002-08-25 19:03:12 +00:00
enami bb4aeb0e05 Pull changes done in rev. 1.7 of sys/compat/linux/arch/powerpc/linux_exec.h
so that sysctl(8) compiles again.
2002-08-15 06:31:30 +00:00
manu 08b6896ef2 Added a sleep on the parent so that the parent cannot die while the child
needs to access information from it.
2002-08-12 20:11:38 +00:00
mrg 19ad2640ac don't need systm.h here 2002-08-12 07:59:31 +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
manu 652d91cab0 Introduce a shared group structure, and make the sproc implementation
more SMP friendly.
2002-08-02 23:02:51 +00:00
manu 2ce44de983 typo 2002-08-02 22:52:50 +00:00
manu 0e12143ef8 Missing P_ZERO in priority mask 2002-08-02 22:52:36 +00:00
gmcgarry cb7e814f6e Fix inverted pre-processor test. 2002-08-02 08:43:09 +00:00
jdolecek 4be499b52b Convert to use p_opptr rather than p_oppid. Part of fix for
security/14444 by David Sainty.
2002-07-28 18:42:41 +00:00
chs 0724ffc87a restructure the FPU and AltiVEC code so that it works for MP. 2002-07-28 07:38:34 +00:00
jdolecek 02eb342b57 Make sure that the pointer to old parent process for ptraced children
gets reset properly when the old parent exits before the child. A flag
is set in old parent process when the child is reparented in ptrace(2).
If it's set when process is exiting, all running processes have their
'old parent process' pointer checked and reset if appropriate. Also
change to use 'struct proc *' pointer directly, rather than pid_t.
This fixes security/14444 by David Sainty.

Reviewed by Christos Zoulas.
2002-07-25 20:04:02 +00:00
matt c172e4d8e8 Make SVR4_32 work with the sparc32 version of setiathome. This required
fixing the socket syscall and the SIOGIFCONF ioctl code.
2002-07-22 05:31:18 +00:00
scw bef00d4895 m68k syscall rototill:
- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
 - Add systrace glue.
 - Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
   (They were all defined exactly the same anyway, other than a couple
   of the MDP_* flags.)
2002-07-13 08:28:40 +00:00
matt 66eaa16742 Change fpuproc to curcpu()->ci_fpuproc. 2002-07-09 17:41:27 +00:00
fvdl e877145e56 Move netbsd32_sysarch to netbsd32_machdep.c 2002-07-07 23:23:41 +00:00
oki 33e652ebfd Regen. 2002-07-07 18:07:43 +00:00
oki 52bdeef730 PECOFF version of stat13 and lstat13 couldn't look for
alternative path at first.  Fixed it.
2002-07-07 18:06:02 +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
manu 7d2ac48550 Fixed a typo that borke build with DEBUG_IRIX 2002-06-22 13:02:39 +00:00
gmcgarry d6e1e62162 sync to new ktrsyscall() interface. 2002-06-21 05:48:06 +00:00
enami af1c533269 Don't copy from destination to destination. 2002-06-20 04:01:43 +00:00
eeh 84c049f196 Match the Solaris siginfo layout for _LP64. 2002-06-19 17:33:01 +00:00
wrstuden 10d47b4dd3 Updated version of cscope/mkid support. Check libkern and compat lib
for source files. Also include header files in mkid run.
2002-06-18 23:46:52 +00:00
manu 758eb330b4 build without DEBUG_IRIX 2002-06-17 05:01:56 +00:00
manu 0e28620e0f Two forgotten files in last commit for get/setrlimit 2002-06-14 20:33:11 +00:00
eeh 863fc84f4d Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.
2002-06-14 18:28:19 +00:00
manu 022bd85d32 When sproc is used to create a share group with shared memory, there is a
private area called PRDA that remains unshared. We implement this by using
different vmspace for each share group member, and keeping the memory
appings in sync on each mmap/munmap/mprotect/break...

We use irix_saddr_sync_vmcmd and irix_saddr_sync_syscall to apply a
vmcmd or a syscall to all share group member, this makes the job a bit
easier.

Also implements {get|set}rlimit{64}.
2002-06-12 20:33:20 +00:00
fvdl fab373098c Fix wrong psstr computation.
(XXX why is there an entire copy of sys_execve here?)
2002-06-06 10:12:42 +00:00
manu 55dd8b2806 - Introduce irix_check_exec() to check if a given process is an IRIX one
- First implementation of procblk(). THis is supposed to suspend processes.
We emulate this by sending a SIGSTOP, which is not very accurate since
on IRIX, sending a SIGCONT to a process suspended by procblk() will not
resume it.
- support for shared groups
2002-06-05 17:27:11 +00:00
eeh bf3b10f8aa Prototype for probing noteless 32-bit emulation binaries. 2002-06-04 14:49:15 +00:00
manu a808ca7f07 Now support per-signal signal trampolines. 2002-06-02 19:06:02 +00:00
manu a7fd741e36 Emulate PR_SULIMIT, PR_SID and PR_SUMASK for sproc() 2002-06-01 20:26:42 +00:00
manu 658fcb808d Don't use SVR4 code for fcntl(F_GETFL) and fcntl(F_SETFL) because the constant
are not the same.
2002-06-01 16:16:36 +00:00
fvdl b6631fa4ec Make this compile again since the previous change. KNF. 2002-06-01 15:10:43 +00:00
eeh cfa7e7d168 Support chroot-ing to a 32-bit installation. 2002-05-31 00:49:42 +00:00
thorpej 8bf2751b15 Statements must follow labels. 2002-05-30 18:44:30 +00:00
manu 0d78304995 Improved support for polling semaphores: when a polling semaphore is unblocked,
poll will return true until the semaphore is blocked again, but before the
semaphore is blocked, poll returns false.

We do this by maintaining another queue of "released" processes in
struct irix_usema_rec. Unblocking causes the waiting process record to be
moved to the released queue, and poll check for the process in this released
queue.
2002-05-30 05:16:10 +00:00
manu f4e81e0cfb - the signal trampoline address is now copied during a fork(). This avoids
a SIGSEGV when sigaction(2) is used before a fork(2) and a signal is received
in the child.
- we now nearly correctly emulate PR_TERMCHILD in prctl(2). (the perfect
emulation would not send a SIGHUP if the parent is killed)
2002-05-28 21:15:41 +00:00
manu e8f2e051a3 - When requested a semamphore count, the userlands expects the kernel to
return the number of processes waiting on the semaphore. We now maintiain
a count of waiting processes.
- Blocked processes are unblocked "first in, first out". We now have a
queue of waiting processes on a asemaphores, so that we can wakeup the
first blocked process.

Problems:
- We now have a lot of dynamic memory allocation, it may be a bit slow.
- Nothing is SMP safe for now. We need to add locks.
- On close, we forget about a semaphore, which is incorrect. One process
  can close its fd attached on a semaphore, but other processes  would carry
  on using it. Since any process can join a shared arena, this is not an
  easy thing to solve.
- A lot of usema/usync functionnalities are still to be discovered.
2002-05-26 21:37:12 +00:00
manu d72c924447 First implementation of a few usync_cntl commands. 2002-05-22 21:32:21 +00:00
manu 381f22f4de File forgotten in the previous commit. 2002-05-22 05:14:51 +00:00
manu 23f31f2a3a First implementation of IRIX /dev/usemaclone functionnalities. This
successfully emulates a few test program that use poll semaphores,
including the attach-to-file-descriptor-and-select feature.

There are a few issues:
1) at least one ioctl need to set retval. We handle this in irix_sys_ioctl()
by replacing the data argument by a pointer to a strucutre in the stackgap
that carries the real data and retval. The underlying ioctl methods can
therefore retreive both data and retval.

2) usemaclone is a cloning device: each time it is open, it creates a new
context, and ioctl operation on each open file descriptor will lead to
different behavior. This functionnality is available in NetBSD through the
devvp branch. This first implementation does not use devvp yet, but this
should be done later. Currently, we create a new vnode, and we provide our
own vnode operations. Some operation are applied to the cloned vnode, others
are applied to the original vnode. The v_data field is used to hold a
reference to the original vnode so that we can work on it.

3) at least the setattr vnode operation needs some customisation: IRIX
libc relies on the fact that fchmod on /dev/usema will return 0 in case
of failure.
2002-05-22 05:14:00 +00:00
jdolecek ee7012d13e linux_sys_getdents64(): remove the oldcall bug workaround cruft,
it's not needed for this call, and update comment accordingly
2002-05-20 06:45:11 +00:00
jdolecek c118cb14c0 linux_sys_getdents64(): make the d_off member point to next entry, rather
than current one; this is expected (even documented) behaviour of the
new system call
This fixes the endless loop when reading directories on NFS, though
applications won't see all directory entries due to different problem.
Fix by Matthias Scheler and Charles Hannum.
2002-05-20 06:40:37 +00:00
jdolecek aae43707d7 whitespace fixes 2002-05-20 06:26:46 +00:00
jdolecek def25b45fa Fix bug introduced in rev. 1.69 - linux_fakedev() returned always
zero for nontranslated raw devices.
This fixes recently discovered jdb /dev/dsp stdin problem, reported
on current-users by Mark Davies.
2002-05-20 06:22:43 +00:00
jdolecek bfbe50611b On archs with broken linux struct stat64 st_ino, rename linux_stat64's
lst_ino to __lst_ino and lst_ino64 to lst_ino, and define
LINUX_STAT64_HAS_BROKEN_ST_INO. Only assign __lst_ino if this define
is present.

This fixes compile on powerpc archs, and hence port-powerpc/16893.
2002-05-19 18:03:15 +00:00
jdolecek 98a5f2b671 hook in truncate64(2) and ftruncate64(2) 2002-05-19 17:55:42 +00:00
jdolecek 973744c531 add missing linux_file64.c, which is needed now 2002-05-19 17:55:08 +00:00
matt 6456f8fa92 Make COMPAT_LINUX compile again on Alpha. linux_getdents64 moved but
files.linux_alpha wasn't updated.  common/linux_file64.c contains a lot
of syscalls which aren't on Linux/alpha so #ifdef them for alpha.
2002-05-13 05:41:26 +00:00
simonb 75119b46c5 Remove an unreachable "return error;". 2002-05-13 05:37:58 +00:00
simonb 7a0dcaf565 Remove an unreachable "return 0;". 2002-05-13 05:35:47 +00:00
simonb f6efa04293 Remove an unreachable "break" after a return statement. 2002-05-13 05:31:42 +00:00
jschauma 839f90b6f7 Linux does not implement SO_REUSEPORT, but allows reuse of a
host:port pair through SO_REUSEADDR even if the address is not a
multicast-address.  Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.

(Previously erraneously applied to 1.5 branch; approved for
proper location by thorpej)
2002-05-12 18:30:32 +00:00
jdolecek 9e0898063f regen - hook linux_sys_fcntl64() 2002-05-12 15:05:56 +00:00
jdolecek b6168e0ca7 regen - 64 fs syscalls 2002-05-12 15:04:59 +00:00
jdolecek 0197718567 hook in remaining 64bit fs syscalls
make most of stuff in linux_file64.c available unconditionally,
  with exception of fcntl64, which is not present on Linux m68k
2002-05-12 15:04:27 +00:00
jdolecek a757d39f99 regen 2002-05-12 13:57:08 +00:00
jdolecek 187c2394f1 update for newer syscalls (from 2.5.15)
Linux m68k doesn't seem to have fcntl64 syscall - oversight?
2002-05-12 13:55:54 +00:00
tron 1e891c870b Add missing bracket arround macro argument reference. 2002-05-10 17:27:23 +00:00
tron d45825cf63 Remove check for size of field "d_off" in Linux "dirent" structure because
this problem cannot happen with the 64Bit version of the getdents().
2002-05-10 14:51:26 +00:00
tron 352c1fa967 Fix off by one error in check for size of field "d_off" in Linux
"dirent" structure.
2002-05-10 14:49:38 +00:00
tron add83289ca Move implementation of linux_sys_getdents64() to source file for
Linux 64bit filesystem calls.
2002-05-10 14:38:08 +00:00
thorpej 27f38656ef Add missing const. 2002-05-05 08:23:03 +00:00
martin 8ff591e85d Add missing prototype for compat_43_netbsd32_sigsetmask. 2002-05-04 12:54:03 +00:00
manu 83c4aab4e2 bug for bug emulation of IRIX: on some device, including
/dev/usemaclone, fchmod returns 0 on faillure, and libc
depends on that behavior.
2002-05-04 07:45:05 +00:00
eeh 8da818b968 __LP64__ -> _LP64 2002-05-03 01:34:48 +00:00
eeh 89e107d917 Regen. 2002-05-03 00:22:16 +00:00
eeh 9bd29db83b Use #if defined(_LP64) to determine if we're generating 64-bit binaries,
not #if defined(alpha).
2002-05-03 00:20:56 +00:00
manu 494d226a5d Added GETSHMASK command to prctl(). This is incomplete, we do not really
keep track of the shmask yet. (It could go in p->p_emuldata)
2002-05-02 17:17:29 +00:00
manu 27cb16e028 sproc: Correctly interpret NULL stack and stacklen when shared vm space is not
requested
2002-04-29 16:01:12 +00:00
manu 36b681f651 Added a void framework for usync_cntl(), which is another undocumented IRIX
system call.
2002-04-29 14:40:23 +00:00
mrg 86477819ce regenerate. 2002-04-29 09:55:11 +00:00
mrg 0ce90a9fef build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself.  rename the compat_10 functions to
match everything else.  fixes a problem reported by julian coleman.
2002-04-29 09:53:39 +00:00
manu adc1ff6c40 Added pread() and pwrite() 2002-04-28 20:23:21 +00:00
manu fc1efb9ee8 Use stack rlimit for the stack size, and not the current stack size. This
avoids requestion 2*rlimit on second sproc call.
2002-04-28 19:42:13 +00:00
manu c2f72d8d1c Updated PR_GETNSHARE and added PR_TERMCHILD 2002-04-28 17:56:53 +00:00
manu 3568060679 Implements IRIX sproc(2) and friends.
There may be a problem with stack size overflow in this implementation
2002-04-28 17:21:58 +00:00
manu ee5b3b3977 Added a void IRIX /dev/usema and /dev/usemaclone pseudodevice driver.
IRIX uses this for implementing atomics operation on semaphores

This will be filled later.
2002-04-23 05:51:14 +00:00
manu f599dce291 Added fchdir, fchown and fchmod system calls 2002-04-23 05:47:38 +00:00
manu 0e9a3e0d43 - We now use irix_sys_mmap instead of svr4_sys_mmap
- initial support for MAP_AUTOGROW flag. When mapping beyond the end of file is
requested with MAP_AUTOGROW, if pages beyond the end of file are touched, the
file should be resized. We are not able to emulate this yet, so we immediatly
resize the file to fit the whole mapping.
- implements mmap64
2002-04-22 05:58:46 +00:00
manu 4678e0b326 Fixed functions to get the number of CPU in sysmp() and systeminfo(). The
problam was that when hw_sysctl() is used, the result is supposed to be
in userland
2002-04-20 21:25:01 +00:00
manu ded3c31a9c On IRIX, fcntl F_FREESP, F_ALLOCSP, F_FREESP64 and F_ALLOCSP64 commands
ignore the len argument. We now correctly emulate the behavior of these
commands.
2002-04-20 20:38:21 +00:00
manu e67d46d7af Added one more system call: msync 2002-04-20 16:56:28 +00:00
manu 21d2265eea Fixed mistakes in irix_sys_fcntl() (missing breaks in case statement) 2002-04-20 16:20:12 +00:00
manu d5ed80d9c6 The IRIX usinit(3) function expects a page of memory to be available at
address 0x200000 (disasembling usinit shows that this address is hardcoded in
libc). It uses it for locks and semaphres.

We therefore allocate this page of memory, to prevent IRIX process from
faulting when thay call usinit(3).
2002-04-20 16:19:22 +00:00
manu 1f32c2b1c4 One more unsupported feature: SGI_SATCTL 2002-04-20 07:43:35 +00:00
manu 829bfed008 Added missing irix_misc.c 2002-04-20 07:42:32 +00:00
manu 5261d673c9 Added getpgrp/setpgrp.
setpgrp is stolen from compat/sunos. It should probbaly be moved to
/compat/common
2002-04-16 20:15:47 +00:00
manu 08948f97d1 Added sysconf(SC_IP_SECOPTS) 2002-04-16 20:15:03 +00:00
manu 28a3cfe032 Do not restore SR on sigreturn: this could enable the user process to gain
unpropre privileges.
2002-04-15 20:48:12 +00:00
manu f8c12b3107 IRIX provide a signal trampoline in libc, we now use it.
- the signal trampoline address is given to the kernel by a sigaction()
  fourth argument
- we introduce an irix_emuldata structure to keep track of the signal
  trampoline address
- we don't support per-sigaction signal trampolines, we only do per-process
- now that we use the IRIX libc signal trampoline, we do not have to handle
  the errno update from the signal trampoline
- it is possible that IRIX 5 signal delivery works too, since theses binaries
  will come with their own signal trampoline
2002-04-14 21:50:49 +00:00
manu c56e133974 More comments on the new signal frame/trampoline 2002-04-13 10:52:59 +00:00
manu 5ee554064d Reworked IRIX signal delivery so that ucontext is used instead of sigcontext
when SA_SIGINFO is used. The IRIX process will hence find the expected
information using the third argument of the signal handler.

We do not provide code and siginfo yet.
2002-04-12 18:44:57 +00:00
manu 78583a4567 Always define SA_SIGINFO, and keep track of it in SVR4 emulation. This is
needed for IRIX signal delivery.
Approved by Christos.
2002-04-12 17:37:30 +00:00
christos 10ecebd46a implement getdents64; my full java tree builds now. 2002-04-10 18:19:34 +00:00
christos 7e9e73a53c regen 2002-04-10 18:19:04 +00:00
christos db952e86f3 add getdents64 2002-04-10 18:18:26 +00:00
itojun 9998fd3a57 revert previous 2002-04-10 09:53:01 +00:00
itojun 7aef2b4e07 make it compile (missing includes) 2002-04-10 09:37:51 +00:00
christos ca4d90ffa1 Fix compile problem. 2002-04-08 14:51:29 +00:00
christos b10c779726 #ifdef __alpha__ pal functions. 2002-04-08 14:51:18 +00:00
christos bd432c1642 PR/16236: Joachim Koenig-Baltes: Linux emulation connect requires IPV6.
Apparently the sockaddr len fix was only compiled when IPV6 was enabled.
2002-04-08 14:00:31 +00:00
christos 866ad0f73f PR/16231: Ben Harris: m68k does not compile. 2002-04-08 13:27:37 +00:00
manu fb46073720 backed out the irix_siginfo field name change: we need different field names
to avoid collision with svr4_siginfo #define si_signo  _info._signo and
friends.
2002-04-06 22:58:43 +00:00
manu 8e8b498d9c Changed irix_siginfo field names to make them closer to svr4 names (and to
original IRIX names too)
2002-04-06 18:08:31 +00:00
christos e9c4f70b2f use lsi_ like all other linux emulations. 2002-04-04 22:17:29 +00:00
tron d09c25ca9a Set default kernel version of Linux emulation to 2.4.18 on the i386 port.
It has been successfully tested using SuSE 7.3 libraries and binaries with
many applications.
2002-04-04 09:32:11 +00:00
christos cb483bd247 make this compile on archs that don't define linux signals. 2002-04-03 17:18:21 +00:00
christos f28b55d327 provide missing types for arch's that don't have specific linux_types.h 2002-04-03 17:13:32 +00:00
christos aa3369abe2 don't bail out if we don't have an arch/siginfo.h because we are being used
from userland.
2002-04-03 17:02:12 +00:00
tron 9121bc2ec4 Fix a cut and paste error in the emulation of getresgid(2): it returned
the effective user id as effective group id.
2002-04-03 14:28:36 +00:00
fvdl 221107a13b Use shmat1(), and tell it to find removed segments. 2002-04-03 11:54:37 +00:00
fvdl 7fc44e13a8 Allocate the right size for the native gid_t array in setgroups16. 2002-04-03 10:17:01 +00:00
christos fa33d13de9 Don't blow up if we don't have a machine dependend linux_signal.h.
kdump includes linux_signo.c
2002-04-02 23:25:07 +00:00
christos eda21311fd save/restore fs and gs; this should be pulled up. 2002-04-02 22:32:16 +00:00
manu 4bca6e2fd0 Added fsync 2002-04-02 20:29:52 +00:00
jdolecek ee37f0c738 rename sysctl_linux() to linux_sysctl() and hook it into emul_linux 2002-04-02 20:23:43 +00:00
manu 062e23b4e2 Added IRIX fcntl(F_GETBSDLK) and fcntl(F_GETBSDLKW) 2002-04-02 19:58:38 +00:00
manu 456cced40e Removed one debug line that was committed by mistake 2002-04-01 15:45:16 +00:00
manu a98e52cc55 Added code to handle FPU and signal stack for IRIX signal delivery
(copied from the native version, not tested yet)
2002-04-01 13:42:36 +00:00
christos 840887afee bring the reverse signal mapping array into linux_signo.c 2002-03-31 22:40:16 +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 018a4082cc - #undef DPRINTF for files that are included from other files.
- more debugging for socketcalls
- fix sa_len if AF_INET; somehow we get passed 28 instead of 16?
2002-03-29 20:49:40 +00:00
kent dad83731c1 pecoff_misc.c: Remove compat functions.
pecoff_sys*.[ch]: regen
2002-03-29 17:04:46 +00:00
christos c9e808f0ee 1. fill in the ldt.sd_xx field, for total compat with linux.
2. in setregs, use gdt's instead of ldt's because linux wants to play with
   all the ldts. Apparently linuxthreads uses ldt's to allocate space for
   pthread_t's.
2002-03-29 17:01:49 +00:00
kent e6ef08a13e Exclude all compat syscalls. 2002-03-29 17:00:43 +00:00
manu 4a466c8fec Added proper locks when calling uvm_swap_stats() 2002-03-29 09:06:54 +00:00
manu 2dd126f08e Fixed the swap block size problem: the swap block size as used in struct
swapent, or as seen in userland, is dbtob(1), which turns to be 512 for all
arch for now.

In struct swapdev, there is another field for block size. This value is private
to uvm_swap.c and is only used for swap I/O on regular files. It is equal to
the underlying device block size and it is not necessarily 512.
2002-03-28 18:45:28 +00:00
manu 9278164721 - now reports accurate swap object size with swapctl(SWAP_STATS)
- Added two more swapctl commands: GETFREESWAP and GETSWAPVIRT.

There is a problem in the way swap block size are found here. See comment
in get_block_size().
2002-03-28 13:14:42 +00:00
manu 2ad173ef3f Added syssgi(SETSID) 2002-03-28 12:59:35 +00:00
manu 50ac30b510 - now return real values in the rminfo system accounting structure. Theses
are not 100% accurate, but it should be okay for most programs
- fix a bug: we were doing the copyout of the struct on failure, not success
2002-03-28 10:37:46 +00:00
manu 5c37c50788 Use irix_sys_sigprocmask instead of svr4_sys_sigprocmask to make use
of the SETMASK32 command.
2002-03-28 10:36:14 +00:00
manu fff388471d Added the SETMASK32 command for sigprocmask(2). This is equivalent to
SETMASK except that the upper 32 bits are left untouched
2002-03-26 22:59:32 +00:00