Commit Graph

2780 Commits

Author SHA1 Message Date
thorpej 41978f782e Merge the nathanw_sa branch. 2003-01-18 21:21:28 +00:00
thorpej 8c0ee6a16b Merge the nathanw_sa branch. 2003-01-18 17:31:06 +00:00
thorpej 6576211dc0 Regen: Merge the nathanw_sa branch. 2003-01-18 08:49:59 +00:00
thorpej 71f181a907 Merge the nathanw_sa branch. 2003-01-18 08:49:22 +00:00
thorpej 6881e93b29 Regen: Merge the nathanw_sa branch. 2003-01-18 08:45:04 +00:00
thorpej 9b46ebe0bd Merge the nathanw_sa branch. 2003-01-18 08:44:26 +00:00
thorpej 84797271c2 Regen: Merge the nathanw_sa branch. 2003-01-18 08:38:50 +00:00
thorpej 540ba7bda5 Merge the nathanw_sa branch. 2003-01-18 08:38:14 +00:00
thorpej afdb47f3fb Regen: Merge the nathanw_sa branch. 2003-01-18 08:36:45 +00:00
thorpej fc54d21534 Merge the nathanw_sa branch. 2003-01-18 08:36:15 +00:00
thorpej 8cb74219bb Regen: Merge the nathanw_sa branch. 2003-01-18 08:35:00 +00:00
thorpej ca3240e089 Merge the nathanw_sa branch. 2003-01-18 08:33:08 +00:00
thorpej 34d5235cfa Regen: Merge the nathanw_sa branch. 2003-01-18 08:32:33 +00:00
thorpej df6b501dd4 Merge the nathanw_sa branch. 2003-01-18 08:32:04 +00:00
thorpej 27bb1001b7 Regen: Merge the nathanw_sa branch. 2003-01-18 08:29:08 +00:00
thorpej 6acc60d22d Merge the nathanw_sa branch. 2003-01-18 08:28:25 +00:00
thorpej 53e750d150 Regen: Merge the nathanw_sa branch. 2003-01-18 08:19:32 +00:00
thorpej 7024ec54cc Merge the nathanw_sa branch. 2003-01-18 08:18:50 +00:00
thorpej 9653eab062 Regen: Merge the nathanw_sa branch. 2003-01-18 08:07:52 +00:00
thorpej 3d60b73d4f Merge the nathanw_sa branch. 2003-01-18 08:06:20 +00:00
thorpej 42f134e02f Regen: Merge the nathanw_sa branch. 2003-01-18 08:05:32 +00:00
thorpej 46141a3135 Merge the nathanw_sa branch. 2003-01-18 08:02:46 +00:00
thorpej 16311b53c0 Regen: Merge the nathanw_sa branch. 2003-01-18 07:45:34 +00:00
thorpej 064d091d71 Merge the nathanw_sa branch. 2003-01-18 07:44:50 +00:00
thorpej 062c115a84 Regen: Merge the nathanw_sa branch. 2003-01-18 07:41:34 +00:00
thorpej a9d45e7ce9 Merge the nathanw_sa branch. 2003-01-18 07:40:44 +00:00
thorpej 790d584247 Regen: Merge the nathanw_sa branch. 2003-01-18 07:37:32 +00:00
thorpej f12607ba9f Merge the nathanw_sa branch. 2003-01-18 07:36:56 +00:00
thorpej acac9c96bb Regen: Merge the nathanw_sa branch. 2003-01-18 07:33:52 +00:00
thorpej 6762b37e5a Merge the nathanw_sa branch. 2003-01-18 07:28:34 +00:00
thorpej a83ddff873 Regen: Merge the nathanw_sa branch. 2003-01-18 07:21:52 +00:00
thorpej 179f14e286 Merge the nathanw_sa branch. 2003-01-18 07:21:14 +00:00
thorpej 85cf298c95 Regen: Merge the nathanw_sa branch. 2003-01-18 07:18:30 +00:00
thorpej d2275d51e1 Merge the nathanw_sa branch. 2003-01-18 06:55:21 +00:00
jdolecek 98cb17d023 add support for SNDCTL_DSP_SETDUPLEX ioctl to ossaudio emulation code
code provided by Andreas Wrede in PR kern/19793
2003-01-12 08:20:05 +00:00
oki 1b09272dff Use text size in COFF header instead of size of section header
marked as COFF_STYP_TEXT.
2003-01-08 17:43:51 +00:00
oki 31789669fa Use uprintf for debug print. 2003-01-08 12:29:44 +00:00
simonb 775343ebae Fix a tyop. 2003-01-08 00:39:44 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz c053751628 compatibility, not compatiblity. 2003-01-06 13:26:24 +00:00
wiz 617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
manu f656d621e7 Here we enter the land of IOKit where the shadows lie.
There are two new mach traps:
mach_vm_make_memory_entry, mach_host_get_io_master. Now we need to find
the documentation to understand what they are supposed to do.
2003-01-04 15:15:01 +00:00
manu 4b219b054a I don't know where I saw this 8 bit shift for the inherit argument of
vm_inherit, but it's not usefull (it's even harmful), so remove it.
WindowServer still crashes but later.
2003-01-04 13:17:07 +00:00
manu 7f468ee029 Bug fixes for the fake pid hack.
WindowServer is now able to talk with mach_init to exchange bootstrap
information.
2003-01-03 14:47:27 +00:00
manu 80d406d8fe FIxed the way rights are recycled: the refcount makes only sense for
send, send once, and dead names, not for port sets and receive rights.
This make vi and telnet able to work again.

Also removed the all process right list and its lock, which got useless. The
all process lock is replaced by a per process lock, located in struct
mach_emuldata.

Also one bug fix: we did not correctly called Mach hooks for struct emuldata
initialization and release for Darwin processes.
2003-01-03 13:40:04 +00:00
manu 2c04ce0604 A better implementation of right carried by messages. We now correctly create
the right in the destination process.

This is a small step backward for functionnality: vi does not work anymore
because our right checks cause some spurious errors, but this will be fixed
later.
2003-01-02 12:46:06 +00:00
manu 0d5c4544d1 The first int on the stack is not the page size, it's the address of the
mach-O header. This is a guess based on what we have on Darwin, we need
to check other Mach systems to see if this value is Darwin specific or not.
Also updated copyright and removed useless debug
2003-01-01 15:18:25 +00:00
manu f3e11e72e9 Introduce port names, deallocate mach ressources at Darwin process exit 2002-12-31 15:47:37 +00:00
manu 6f978415df When the kernel transmits a message to a processs, remote and local port
are swapped. Also added some debug.
2002-12-31 13:09:38 +00:00
manu 48ad3f41b6 Remove some debug and make it build again wihout DEBUG_MACH 2002-12-31 09:32:03 +00:00
manu 1d1b901b90 bug fix: in debug functions, the port set right and the port set members
wer mixed up
2002-12-30 19:32:15 +00:00
manu d9f2a8dbcd - When mach_init saves the bootstrap port, make it the default bootstrap port
for any program we will launch later. This is a hack to avoid the need
of launching any Darwin binary as a child of mach_init
- More and more debug
2002-12-30 18:44:33 +00:00
manu f449715c66 When allocating a receive right on a port, don't forget to change
the reciever.
2002-12-30 12:46:19 +00:00
manu 27427542f4 When the right is not a port set, set the port set head to the right
itself. That way when we want to wakeup a receiver, we just have to
wakeup the port set head, it will work either for port set and for non
port sets.
2002-12-30 12:41:52 +00:00
manu 459d0be3a4 More hacks to make Darwin's /sbin/init happy with its pid. 2002-12-28 00:15:23 +00:00
manu 874517b438 - When MACH_MSG_RCV_LARGE is set, we must return a message with just a header
and a body.
- If mach_init is not availabkle for boostrap requests, try to handle them
in the kernel (we don't really handle them, we just try to avoid hanging there)
- minor tweaks.
2002-12-27 19:57:47 +00:00
manu 3b815ab820 We must also return pid 2 when mach_init asks for its pid after it forked init. 2002-12-27 19:54:54 +00:00
manu f464631d66 Several things:
1) rights should be shared by the threads within a process. While it would
be easier to handle this with the struct proc/struct lwp split, we attempt to
do this now by sharing the right lists. Because each right holds a reference
to struct proc, this might cause some problems later.
2) in pthread_exit, really exit the thread. Also reintialize the righ tlist to
make sure we will not destroy the parent's right list
3) rights can hold multiple permissions on a port (ie: send and receive). Fix th
is.
4) first attempt on right carried by messages. We still have to do rights carrie
d in the message body (complex messages).
2002-12-27 09:59:24 +00:00
manu 20fca78f89 regen 2002-12-26 14:41:34 +00:00
manu bab8693bba Added the mysterious system call 331 (it does not seems to be in the
header files anywhere). This is pthread_exit.
2002-12-26 14:41:05 +00:00
manu 2894c4a53f Handle the kernel clock service by the kernel. 2002-12-26 13:45:17 +00:00
manu f4d5ba5dbd Queue and dequeue message replies from kernel servers. This is less efficient,
but it sticks closer to the actual Mach semantics: the reply is queued at the
end of the queue. Also add more debug messages on port operations.
2002-12-26 11:41:46 +00:00
manu dc403d4519 Bootstrap messages are not for the kernel, they are for mach_init. 2002-12-24 16:40:46 +00:00
manu b2a7ace594 Better error reporting in mach_msg_trap: this system call does not use the
standard error codes.
2002-12-24 15:54:26 +00:00
manu 4d3d28af57 cosmetic 2002-12-24 15:53:46 +00:00
manu 93b65fbd1d regen 2002-12-24 12:29:28 +00:00
manu 185383e0a7 Typo 2002-12-24 12:29:06 +00:00
manu 41bfbd28fe On Darwin, mach_init is the system bootstrap process. It is responsible
for forking the traditional UNIX init(8) and it does the Mach port naming
service. We need mach_init for the naming service, but unfortunately, it
will only act as such if its PID is 1. We introduce a sysctl
(emul.darwin.init_pid) to fool a given process into thinking its PID is 1.
That way we can get mach_init into behaving as the name server.

Typical use:
/sbin/sysctl -w emul.darwin.init_pid=$$ ; exec /emul/darwin/sbin/mach_init
2002-12-24 12:15:45 +00:00
manu c075c4d7f5 Get less debug output 2002-12-24 12:13:15 +00:00
gmcgarry 6b5b61b136 Update for revised ktrsyscall() prototype.
Perhaps this file should be changed to use trace_enter() so that
systrace works for aliased syscalls?  Leave that for someone familiar
with the systrace system.
2002-12-23 01:08:45 +00:00
manu 360f1c3ebe Cosmetic changes, added a debug printf 2002-12-22 21:51:56 +00:00
mrg 131dc6aa08 catch up with changes in sparc64/autoconf.c. 2002-12-22 02:54:34 +00:00
gmcgarry 66c19fc50c Add stubs for scheduler syscalls. 2002-12-22 00:05:59 +00:00
gmcgarry 87aecbbd2c Add scheduler syscalls. 2002-12-22 00:04:29 +00:00
gmcgarry 53bdf646b5 Use yield() for voluntary context switches. 2002-12-22 00:00:22 +00:00
gmcgarry c4b66baf3f We do want yield() for voluntary context switches. Update comment. 2002-12-21 23:57:57 +00:00
manu 8958b6f9ba Handle receive operations on port sets 2002-12-21 23:50:47 +00:00
manu ccd9e9a24d Fix plain bugs that prevented insert_right and move_member from working correctly. 2002-12-21 23:50:00 +00:00
manu 3ee2623baa Make it build again 2002-12-21 23:48:47 +00:00
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
gmcgarry 16f1be1856 Flag a context switch using need_resched() rather than invoking yield().
Matches the linux compat approach.
2002-12-20 04:58:44 +00:00
manu 3b71b464b2 First attempt on mach ports sets. Also maitian only one list of rights
per process, as segregating recv, send and send_once did not buy anything.
2002-12-19 22:23:06 +00:00
manu f037b240d0 Instead of keeping track of the receiving process in struct mach_port,
keep track of the receive right for the port. There can be only one, and
the receive right references struct proc should we need it.

This makes easier to find the receive right associated with the port.
2002-12-17 22:48:33 +00:00
manu 391c8a71fc In mach_ports_lookup, allow the out of band data mapping anywhere we have
some free space
2002-12-17 22:47:07 +00:00
manu 5ba396cfb3 Added support for exchange of Mach messages between processes.
This does not buy us new functionnality for now, because we still have to
discover how mach_init (which acts as a name server, enabling processes to
discover each other's ports) is able to receive messages from other processes
(this is a bootstrap problem, and the bootstrap port might be the place to
search).

While we are there:
- removed a lot of debug which is now available using ktrace.
- reworked message handling to avoid mutliple copyin/copyout of the
same data. ktrace of Mach message now uses the in-kernel copy of the
message instead of copying it from userland.
- packed mach trap handlers arguments into a structure to avoid modifying
everything next time we have to add an argument.
2002-12-17 18:42:54 +00:00
simonb 4ec8d15e0d Use the already-filled-in-but-not-used native syscall args in
linux_sys_mknod().
2002-12-17 11:48:02 +00:00
tron ad9b98744f Include "uvm/uvm_param.h" to get definition of PAGE_MASK required for
last change.
2002-12-17 10:42:02 +00:00
christos c0bc51eec5 Don't allow non-page-aligned offsets! So dumb. From Jason Ish, thanks. 2002-12-16 19:37:03 +00:00
manu b8a9df5e21 FIrst attempt at mach ports and rights, which are needed if we ever want
to implement messages between kernel and userland.
While we are there, cleanup some debug messages.
2002-12-15 00:40:24 +00:00
manu 530e1a6b60 Added thread_switch and some bits of Mach semaphores 2002-12-12 23:18:20 +00:00
manu 66a29c52af Added a few Mach traps: mach_boostrap_register, mach_port_set_attributes,
mach_port_move_member, mach_port_set_attributes, mach_task_set_special_port,
(none do anything)
Added mach_thread_create_running, which creates a new Mach thread. It
provides the register context of the new thread. We use it in a child
function provided to fork1(). The child function is machine dependent and
is not yet implemented for i386.

The new thread crashes quickly, but at least it starts.
2002-12-12 00:29:23 +00:00
manu 39e39a5b0f Added vm_inherit mach trap. 2002-12-11 21:23:37 +00:00
jdolecek 0c7b52a284 linux_sys_mknod(): if creating device file (i.e. !fifo case), mask
the passed device number to only contain lower 16 bits; older glibc
appears to pass some junk in upper bits sometimes, resulting in incorrect
device entries being created

Problem initially analyzed by Thor Lancelot Simon.
2002-12-11 19:30:39 +00:00
manu 8d921b897b Added a few traps: port_type, port_set_attributes, port_insert_member,
and vm_protect.

This makes Darwin's /usr/bin/telnet working
2002-12-10 21:36:45 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
thorpej 78ea2dd367 Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
2002-12-10 05:14:24 +00:00
manu 1e050715ea Stupid (but harmful) copy/paste mistake. 2002-12-09 22:28:16 +00:00
manu 9e08cf7d46 Remove debug printf (now ktrace does the job) 2002-12-09 21:53:28 +00:00
manu 6492e2171f Added support for dumping mach messages in ktrace/kdump. While we are
there, KNFify a few functions.
2002-12-09 21:29:20 +00:00
manu 4386631757 regen 2002-12-08 21:53:57 +00:00
manu 9f6565f2bd A working fork/vfork implementation. Darwin fork differs from our fork by
two ways:
- the child gets its pid as retval[0] (userland stub will turn it into a 0),
retval[1] is 1 and it is 0 in the parent.
- in the child, the fork syscall is successful, hence we must skip the next
instruction.
2002-12-08 21:53:10 +00:00
junyoung 81ed087074 - Rename struct linux_ctx to linux_fpctx.
- KNF.
2002-12-08 11:20:22 +00:00
manu 3bc2c4cf57 Now it uses BSD system calls with alternate path checks in compat/common,
Darwin does not need freebsd_file.c anymore.
2002-12-08 00:52:04 +00:00
manu daccb0339c regen 2002-12-08 00:51:24 +00:00
manu 3b0f6d78ed Introduce BSD system calls with alternate patch checking (in /emul) in
compat/common, so that they can be shared by several emulations, and use
them for Darwin.

This removes the ugly dependance on FreeBSD freebsd_file.c for COMPAT_DARWIN
2002-12-08 00:50:23 +00:00
manu cafe31204f Try to emulate port_type and bootstrap_look_up (I have no idea of what I am
doing with this one!)
2002-12-07 21:23:03 +00:00
manu db18a73b3d Added vm_wire (unused yet) 2002-12-07 19:06:33 +00:00
manu 74a1ce8272 regen 2002-12-07 19:05:30 +00:00
manu e03fbf9432 The fp_status fasttrap is called processor_facilities_used in userland, and
we discovered the flags it was to collect. Now we need to emulate them, but
it is another story.

load_msr seems only used from kernel code.
2002-12-07 19:05:11 +00:00
manu bb8dabd15a regen 2002-12-07 15:33:36 +00:00
manu 9b84721494 Added implementation for cthread_self() and cthread_set_self(). Theses are
used to get and set the thread user value, which is an opaque pointer to
a per thread structure stored in userland. cthread_self() is used by Darwin
as an implementation for pthread_self(), which return the thread id.

We use the p_emuldata field of struct proc in order to keep track of the
thread user value. For now the value is per-process, but we will make it
per-thread when we will take care of threading.

While we are there, do some KNF
2002-12-07 15:33:01 +00:00
scw dc63c50793 After a discussion with various folks, fix the strict-alias warning
by ditching 'void *rt' and passing retval directly to sys_mmap().
2002-12-06 12:00:57 +00:00
tron 96ece1f13e Fix namespace collision caused by recent change to "linux_machdep.h". 2002-12-06 10:51:27 +00:00
scw f88b19a600 Avoid strict-alias warnings. 2002-12-06 09:57:58 +00:00
junyoung 9104ddf809 Fix compile error. 2002-12-06 03:37:19 +00:00
christos ef042d8e23 add a linux_rt_sigframe to support SA_SIGINFO, and use it when SA_SIGINFO
is requested. This appears to be how linuxthreads decides which signal handler
to use.
2002-12-06 00:02:59 +00:00
manu f0332ec923 In load_shared_file, do zero-fill uninitialized data segments that
explicitely request to be zero filled.
2002-12-05 22:48:53 +00:00
manu 56b9df9869 Improved mach_vm_map emulation: take into account proection, alignement,
and improve debug messages.
2002-12-04 22:55:11 +00:00
agc 35a5ff86d4 Make this compile in the presence of -Werror 2002-12-01 11:02:11 +00:00
jdolecek e1e0ff678b move ELF-specific items from irix_exec.c to irix_exec_elf32.c
merge the two emul_irix structures; the only difference was
  setregs function, which can be handled by exec-specific setregs hook
rename setregs_n32() to irix_n32_setregs(), and make it suitable
  as the exec-specific setregs hook
make irix_check_exec() a macro now that just single compare
2002-11-30 13:18:13 +00:00
jdolecek 6826135dbc make LKM friendlier by only including opt_* #ifdef _KERNEL_OPT 2002-11-30 12:28:26 +00:00
jdolecek c9710a72e0 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.

XXX sligh code rearrangement was necessary, change not tested
2002-11-29 19:40:14 +00:00
jdolecek da2945cc37 add comment why this doesn't need to use emul_find_interp() 2002-11-29 19:35:25 +00:00
jdolecek 1bf46cc0f0 use emul_find_interp(), rathern than calling emul_find() second time
with prefix set to "/"
XXX not tested
2002-11-29 19:15:15 +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
manu ae748e840c Implement timebase_info. We don't know exactly what it should do yet... 2002-11-29 17:08:16 +00:00
jdolecek 302af6f02e add emul_find_interp() function: the function looks for interpreter
in alternative emul tree first, and updates interpreter pathname
if found there; if not found in alternative emul tree, pathname
without the emul prefix is checked, and error returned if the file
doesn't exist
2002-11-29 17:08:06 +00:00
jdolecek b99fe89374 de-__P() 2002-11-29 16:32:50 +00:00
fvdl 6df30bca4f Patch that actually works for previous, from Jaromir Dolecek. 2002-11-29 14:32:27 +00:00
manu f47b85037b Added a few kern sysctl which are the same on Darwin and NetBSD. 2002-11-29 13:18:09 +00:00
manu 65adabf7aa Filter the flag bits we get from Darwin's sigaction when giving them to
our native sigaction beacause unknown bits cause sigaction to fail with EINVAL.
2002-11-29 13:17:22 +00:00
itojun 02185dab0f setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
review: fvdl/christos
XXX interactions with net.inet6.ip6.v6only?
2002-11-29 01:34:55 +00:00
itojun e2a7bfda88 minor KNF (indent) 2002-11-28 23:46:15 +00:00
manu de5d0b9706 Remove __P 2002-11-28 21:23:54 +00:00
manu 0f239dc026 Check for alternate receive buffer for mach_msg_overwrite_trap
Check for target buffer length, and fail if it is too short
Move mach_msg_trap and mach_msg_overwrite_trap to their own file
Remove some useless debug messages now we have ktrace
Remove __P()
2002-11-28 21:21:32 +00:00
jdolecek b3b1ed9f7d back previous off, it makes the probe function mistaken some linux
binaries as freebsd
problem reported in thread 'installing suse_base on current
i386 sets time to 1970' on current-users
2002-11-28 15:08:36 +00:00
atatat 7caa308c63 Complete the rename: s/sa_/<compat>_sa_/g
Also tweak the darwin siginfo stuff to avoid the same type of collision.
2002-11-27 16:44:01 +00:00
tron 7ef75ab314 Fix namespace clash caused by addition of sigaction(2). 2002-11-27 14:36:12 +00:00
manu dfa96ff4b3 Add signal delivery for the PowerPC. Everything is implemented except siginfo.
The stack layout is observed from stack dumps on Darwin, so it should be
very accurate.
2002-11-26 23:54:09 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
christos 116bcb05d0 rename: s/sa_/<compat>sa/g 2002-11-26 18:43:20 +00:00
christos daa59d8957 rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
2002-11-26 18:42:38 +00:00
manu 6ce9cf3a84 regen 2002-11-26 08:10:58 +00:00
manu 11aa9ca2f6 Add thread_policy and clock_get_time mach traps. Implement
mach_sys_clock_sleep_trap. This makes sleep(3) emulation working.
2002-11-26 08:10:14 +00:00
manu bd9d3fb902 There are functions to convert between sigaction and sigaction13. Use them. 2002-11-26 00:05:41 +00:00
manu 29a7621173 regen 2002-11-25 22:26:21 +00:00
manu 53356d6169 Added an empty shell for signal delivery. Now we just have to fill the
machine dependant bits.
2002-11-25 22:25:12 +00:00
schmonz aee43321d1 Report ourselves as Linux 2.4.18 on powerpc, too. 2002-11-25 10:34:34 +00:00
thorpej d32a923263 Avoid strict-alias warnings. 2002-11-25 02:31:14 +00:00
thorpej c8f5c657b5 Add ULL to a 64-bit integer constant. 2002-11-25 02:11:23 +00:00