Commit Graph

33 Commits

Author SHA1 Message Date
jdolecek 6826135dbc make LKM friendlier by only including opt_* #ifdef _KERNEL_OPT 2002-11-30 12:28:26 +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 2001eb6db2 Added SGI_RUSAGE command to syssgi (this is a BSD rusage) 2002-10-12 08:53:46 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +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
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
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 1f32c2b1c4 One more unsupported feature: SGI_SATCTL 2002-04-20 07:43:35 +00:00
manu 08948f97d1 Added sysconf(SC_IP_SECOPTS) 2002-04-16 20:15:03 +00:00
manu 2ad173ef3f Added syssgi(SETSID) 2002-03-28 12:59:35 +00:00
manu 76084f5561 Added syssgi(PATHCONF), which implements pathconf(2), and syssgi(SETPGID)
which implements setpgid(2).
2002-03-25 20:42:50 +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
manu eb3041b4dc I finnally identified syssgi(SGI_FDHI) as the implementation of the
getdtablehi(3) library call. Updated comments and removed the paranoid
diagnostics about this mysterious syssgixi() request.
2002-03-13 20:33:41 +00:00
manu 25f8840ca4 Implements syssgi(FDHI), which seems (it's not documented) to return the
higher open file descriptor plus one. This makes IRIX's find able to work.
2002-03-13 07:54:18 +00:00
manu b2ce645507 Added syssgi(GETGROUPS) and syssgi(SETGROUPS) 2002-03-10 22:36:28 +00:00
manu 6a48d31676 Fix a bug in the way syssgi(MAPELF) handles relocation: we are supposed to
look for a block of free virtual memory big enough to hold all sections. The
blocks starts at the beginning of the first section and ends at the end of
the last section. In the previous version the block ended at the beginning
of the last section, hence creating situations where there was not enough
free space to map the section.
2002-03-10 19:03:08 +00:00
manu d2e60e82f8 Fixed various sysconf() commands 2002-02-23 22:35:15 +00:00
manu 853adfc30b - implement SGI_GETSID command for syssgi()
- reworked SGI_GETPGID implementation to use the getpgid() system call instead
  of duplicating it.
2002-02-17 20:44:17 +00:00
manu 5b436803dd Removed the hack in mapelf to get libX11 loading. The new version assumes
that the load addresses in the section array are increasing, and that no
section in the array overlap with each other. IRIX proably makes the same
assumptions, but this has not been tested.

The key point with relocation is to always use the same offset for each
section. Because userland gets only the load address off the first section, it
has to assume that all the remaining sections kept the same offset with
respect to the first section. By using fixed offset instead of finding
some free space for each section, we can eliminate the libX11 load hack.
2002-02-03 17:28:19 +00:00
manu 4aa2e3fde7 Fixed the X11 load bug. dynamic linking now seems to be fully functionnal,
even for program with a DSO using overlapping load virtual addresses.

The fix is a mean hack, see the comments in irix_syssgi.c. It would be nice to
get uvm_map_findspace() to return the page we suggest instead of the page which
is 16384 bytes away.
2002-02-02 19:27:18 +00:00
manu 5e54c68a88 Fixed a bug introduced in the previous fix to mapelf:
we used load_psection, then ran each vmcmd and tried to relocate the failing
ones. This fails if there is two vmcmd for one section, and the second is
not a mapping (for instance a map_pagedvn and a map_zero), because the first
one gets relocated, but not the second one.

Additionnaly, it was not necessary to update the userlevel psection array:
libc stubs seems to do the job themselves.
2002-01-21 21:51:31 +00:00
manu ddd039179b Fixes the problem with libX11.so mapping by syssgi(MAPELF): the load address
for the text section of libx11.so was overlapping with other ELF sections
aloready loaded, and this resulted into an ENOMEM error.

syssgi(MAPELF) uses elf32_load_psection() from syssrc/sys/kern/exec_subr.c
The problem was never experienced with load_psection() because it only has
to load one section, hence the requested address are not already allocated.

The fix is done when the initial mapping at the default address fails by
finding a free location in the VM space using uvm_map_findspace(), and then
retrying to load the section.

Other details:
- once the ELF section has been relocated, the ELF program header must be
updated with the new address and copied back to userland. For now we always
do it, maybe we could copy it only when it was modified.
- We are able to emulate the exact address where IRIX loads libX11.so instead
of the default location
2002-01-19 14:56:02 +00:00
manu a965f74abe getpgid implemented 2001-12-27 09:31:09 +00:00
manu 2faf78e180 Reworked irix_syssgi_mapelf. It now uses elf_load_psection, and this
remove the odd bug which caused INSANE_DEBUG_IRIX to be mandatory in
order to avoid a panic when mapping libraries.
2001-12-26 22:18:25 +00:00
manu ae9b01a907 Added getcontext/setcontext. This has not been fully tested, but it seems to
work enough for binaries that use it (eg: telnet).
Problems:
- what should we do with uc_filler?
- how to handle FP regs?
2001-12-25 19:04:18 +00:00
manu 7b2952c16e More TrustedIRIX stuff (not emulated, but we don't return EINVAL anymore) 2001-12-22 09:35:11 +00:00
manu cebd826075 more sysconf... 2001-12-08 19:29:03 +00:00
manu e3824c6c59 Added IRIX signal delivery 2001-12-08 11:17:37 +00:00
manu 427b57c20e Added SGI_USE_FP_BCOPY and SGI_TOSSTSAVE commands that are also needed
for dynamic linking
2001-12-02 09:22:39 +00:00
manu 0e18d4c1b0 Fixed a typo 2001-12-01 22:19:38 +00:00
manu 11ea5b82d7 Fixed a bug in vmcmdset reuse. IRIX binaries seems to pass syssgi(ELFMAP)
without crashing now.
2001-12-01 22:14:15 +00:00
manu cde20c2503 First implementation of syssgi(SGI_ELFMAP). 2001-11-30 21:56:03 +00:00
manu 7839e13a9c On IRIX, the first 88 system calls are quite plain SVR4, and the 137
remaining are IRIX specific. We know use SVR4 emulation for the first 88
system calls.
2001-11-28 12:00:53 +00:00