Commit Graph

82 Commits

Author SHA1 Message Date
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
manu 58537aa4d9 Fixed a typo in DEBUG_IRIX code 2002-03-26 16:58:56 +00:00
manu a4085df772 - Uses p->p_stats->p_ru instead of p->P_ru to get ressource usage, since
p->p_ru sometime happens to be equal to 0xdeadbeef.

- added more debug output.
2002-03-26 16:38:12 +00:00
manu a0fa2e7fa5 Added support for sysmp system accounting structures. Only real memory info
is defined yet, but it returns zeroes (will be fixed later).
2002-03-26 10:54:40 +00:00
manu 2ccdf1d7ec Added truncate(2), ftruncate(2), truncate64() and ftruncate64(), the two latter
being untested yet.
2002-03-26 10:52:52 +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
manu 0e9d73c741 Added support for IRIX kernel var emulation in kmem (not functionnal yet) 2002-03-25 18:43:59 +00:00
manu af187fe983 Added swapctl SC_ADD, SC_REMOVE and SC_SGIADD commands. 2002-03-18 20:34:54 +00:00
manu a8db9077cd Uses the recently introduced uvm_swap_stats() instead of
sys_swapctl(SWAP_STATS). This enable the use of a kernel based
buffer instead of using some temporary memory in the stackgap,
whereas we cannot make sure that the size os the struct swapent array
will fit in it. (it is not known at build time, but the stackgap len
is set at build time).
2002-03-18 17:21:24 +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 431e4d2b95 Added enough of swaptcl() command emulation to get swap -l working. This
is needed by acad (it exec's swap -l to check if swap is enabled)
2002-03-16 13:29:42 +00:00
manu cdab2861e2 Added the IRIX /dev/kmem emulation pseudodevice driver 2002-03-15 17:21:26 +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 911cceb1b7 Added statvfs/fstatvfs 2002-03-10 21:56:24 +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 339682e5f4 Fixed a problem in getmountid emulation: we use the address of a kernel
structure for the mountid, but it is 32/64 bits long only, whereas
mountid is 128 bits long. Because we did not initialize the unused bits to
zero, the mountid was not always unique within a filesystem.

This makes autocad 1.3 able to start up.
2002-03-09 16:05:21 +00:00
manu de4ff85b32 Fixed a bug in getdents64 emulation: we used a struct irix_dirent to hold
the result instead of a strruct irix_dirent64.
2002-03-09 13:32:12 +00:00
manu d77463efde Fixed typo 2002-03-09 13:13:09 +00:00
manu 3523a539eb Attempt to provide support to programs digging the load average out of
/dev/kmem (probably broken at the moment)
2002-03-09 10:52:21 +00:00
manu 28cae7e6d6 Added setreuid/setregid 2002-03-04 22:19:02 +00:00
manu cb99a5f48e Implements SIOCNREAD ioctl (some kind of FIONREAD for sockets only). This
makes X11 binaries able to actually work: most of them were previously hang
in infinite loop wiaiting for data from the X server because SIOCNREAD
reported that some data where to be read whereas the X server had nothing
to say.

Tested (and works): xlogo, xterm, ghostview (IRIX build). Things are getting
interesting...
2002-03-03 20:12:17 +00:00
manu 63b308a593 FIxed typo 2002-02-23 22:43:56 +00:00
manu d2e60e82f8 Fixed various sysconf() commands 2002-02-23 22:35:15 +00:00
manu a9c374ed26 Added munmap() and mprotect() 2002-02-21 22:15:28 +00:00
manu 89e46d8a99 Reworked the o32/n32 matching scheme. IRIX uses some e_flags in the ELF
header to distinguish between o32, n32 and n64 ABIs. We now use this.
This suppress the need of the mips_option test, which had some fake positive.
This also removes the mandatory ordering of n32 vs o32 in the exec switch
(exec_conf.c)
2002-02-21 21:53:00 +00:00
manu 9d16e4d12b Added gethostid/sethostid and the HOSTID command to systeminfo() 2002-02-21 11:09:43 +00:00
manu 25e8963ed3 Fixed typo 2002-02-20 21:18:18 +00:00
manu 457750dabf Implemented irix_sys_systeminfo() 2002-02-17 22:49:53 +00:00
manu d383f72720 reworked signal handling:
- do not save/and restore registers that should not be saved and restore
- do give an accurate sigcontext pointer to the signal handler
- do use the struct sigreturna from IRIX.
This eliminates panics and hangs in certain circonstances

Also some cosmetic changes with tabs usage
2002-02-17 20:50:06 +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 5ad92b8294 Fixed irix_blkcnt_t size (was 64 bit, changed to 32). This caused alignment
troubles in struct stat, hence giving wrong st_blocks, st_blksize and st_size
values.
2002-02-12 23:11:58 +00:00
manu bd184209e6 Correctly translate the st_rdev field in struct stat 2002-02-12 07:17:18 +00:00
manu b778bba3d3 Added system calls: getdents64/ngetdents64 2002-02-04 20:26:34 +00:00
manu 26aff33a7d Typo fix 2002-02-03 17:41:03 +00:00
manu 5c72031257 Added system calls: gettimeofday, getitimer, setitimer 2002-02-03 17:39:54 +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 98f3287e7d Added some system calls: gethostname, sethostname, getdomainname,
setdomainname, alarm
2002-02-03 01:21:47 +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 c8d430d60d missing include 2002-01-07 23:12:30 +00:00
manu 0b98511d4a Added code to match and launch n32 binaries (there is no N32 support in the
kernel yet)
2002-01-07 22:05:03 +00:00
manu 3b176652b8 Fixed wrong file name. 2002-01-06 21:43:10 +00:00