Commit Graph

108 Commits

Author SHA1 Message Date
manu 2e73bb80fe More IOKit basics. Also introduced a mach_port flag to get a precise idea
of what port is sending a message to the kernel.
2003-02-05 23:58:09 +00:00
manu 357afc4e2f Some bits of the first iokit call 2003-02-04 22:47:41 +00:00
manu 2cd19ab0b2 - WindowServer wants io_master_port? Give it a port!
- introduce mach_port_destroy (badly emulated for now)
- on fork/exec, don't set l_private, as the process might be not mature
enough to survive a proc_representative_lwp call (-> kernel panic)

Once we give WindowServer the io_master_port, it sends a message to it:

   305 WindowServer MMSG  id 2804 [0x1310009 -> 0x131000e] -12016 bytes, flags 0
x1513
   0x0000  0x00001513 0xffffd110 0x0131000e 0x01310009   .........1...1..
   0x0010  0xffffcfd0 0x00000af4 0x00000000 0x00000000   ................
   0x0020  0xffffcf60 0x00000052 0x3c646963 0x74204944   ...`...R<dict ID
   0x0030  0x3d223022 0x3e3c6b65 0x793e494f 0x50726f76   ="0"><key>IOProv
   0x0040  0x69646572 0x436c6173 0x733c2f6b 0x65793e3c   iderClass</key><
   0x0050  0x73747269 0x6e672049 0x443d2231 0x223e494f   string ID="1">IO
   0x0060  0x48494453 0x79737465 0x6d3c2f73 0x7472696e   HIDSystem</strin
   0x0070  0x673e3c2f 0x64696374 0x3e0047cc              g></dict>.G.

Did you ever dreamt about system call arguments in XML?
2003-02-02 19:06:31 +00:00
manu 34a458238c For cproc_t, use a per thread value instead of a per process value. ifdef
out l_emuldata in struct lwp until we actually use it.
2003-01-30 19:14:18 +00:00
manu 7e15e89c0a Fixed dumb bug 2003-01-26 19:32:04 +00:00
manu ce8bd172b2 For thread creation, make the newly created thread runnable. Mach threads
are now functionnal again.
2003-01-26 19:02:14 +00:00
manu 55215e5266 Remove right duplication on thread creation, which became useless now we
are using lwp.
Enable kill -9 to kill parent thread waiting for its child.
Use upcallret instead of child_return for the newly created lwp.
Add debug messages for thread creation.

Thread creation are still broken...
2003-01-26 12:39:32 +00:00
manu 82a9c6faf0 Use per process emuldata for the thread id for now, but this will change
shortly. This makes hello world working again.
2003-01-24 22:35:43 +00:00
manu cb771e3c64 Make the beast build again (but it is still probably broken) 2003-01-24 21:37:01 +00:00
matt b03d17694a Do a preliminary switchover of the mach code to lwp's. It compiles now
but probably doesn't work.   That's for someone who understand this code
better.
2003-01-21 04:06:06 +00:00
matt de92ce633f Regen. 2003-01-21 04:02:37 +00:00
matt d8ad92c6b6 Add <sys/sa.h> 2003-01-21 04:02:10 +00:00
matt 312dfd8487 Adapt to the LWP world. 2003-01-21 04:01:09 +00:00
matt e093b867e9 Regen. 2003-01-21 04:00:02 +00:00
matt 6d793da904 Add <sys/sa.h> 2003-01-21 03:59:27 +00:00
thorpej d88bc9c3a2 Regen for correct RCS ID. 2003-01-18 23:36:48 +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
simonb 775343ebae Fix a tyop. 2003-01-08 00:39:44 +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 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 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 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 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 360f1c3ebe Cosmetic changes, added a debug printf 2002-12-22 21:51:56 +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
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