Commit Graph

237 Commits

Author SHA1 Message Date
manu 29638672ea off-by-one error in ary subscript. 2004-01-02 02:09:52 +00:00
manu 996e659ce6 Try to do a better job at Mach port refcount. That's not perfect, though. 2004-01-01 22:48:54 +00:00
manu d1845c906c - Rework the Mach semaphore code to handle threads instead of processes
- Add 2 system calls: semaphore_signal_thread and sempaphore_signal_all (the
latter being untested)
- semaphore_signal_thread arguments list was wrong
2003-12-30 00:15:46 +00:00
manu 1a96ea0da6 In DPRINTF? replace uprintf, so that we get debug output for daemons too. 2003-12-30 00:14:20 +00:00
manu 7ab97b2c76 Added Mach services (no real implementation, just empty shells to make
userland happy)
processor_set_default, host_processor_set_priv, and thread_set_policy
2003-12-29 01:30:27 +00:00
manu 31b3c2a056 Added the semaphore_wait_signal_trap Mach system call (untested) 2003-12-28 23:00:36 +00:00
manu 2c772b20d9 When the catcher of an exception dies before releasing the thread that
raised the exception, don't release the lock, this causes a crash (the lock
shall be released by the process that took it). Wakeup the thread instead,
it will release the lock itself.
2003-12-28 13:28:39 +00:00
manu d0de7398af union without a name does not build on i386... 2003-12-26 16:31:29 +00:00
manu 834aafd284 Rework Mach exception and Darwin's ptrace. gdb is now able to attach a
remote process. This new implementation also passes all the test programs
I've written so far.

- When exceptions come from traps, no UNIX signal should evet be sent.
- Add a lock to ensure a debugger handles only one exception at a time
- Use a structure to hold flavor and behavior in exception ports, instead
  of stuffing the two argument into an int.
- Implement new Mach services: thread_suspend, thread_resume and thread_abort
- Implement Darwin's ptrace PT_ATTACHEXC and PT_THUPDATE commands
- Handle NULL second argument correctly in sigprocmask.
- One mistake in the last commit (darwin_tracesig prototype)
2003-12-24 23:22:22 +00:00
manu ebbd46991b clock_sleep was 10 times too fast because of a wrong constant. 2003-12-21 14:44:43 +00:00
simonb 740725d725 Fix usage of fifth argument to pool_init(). 2003-12-21 07:53:58 +00:00
manu 066436a916 Provide a kernel port for each thread. This makes the emulation of
Mach threads much more accurate: we do not confuse threads and tasks
anymore.
2003-12-20 19:43:17 +00:00
fvdl d99705e941 Put back Emmanuel's sigfilter hooks, as decided by Core. 2003-12-20 19:01:29 +00:00
manu b23b73b953 Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
2003-12-20 18:22:16 +00:00
grant 44ed233ab5 KNF, spelling and english fixes to some comments. remove trailing
whitespace.
2003-12-18 01:10:20 +00:00
manu 780bd92b51 Catch signals in clock_sleep, so that sleeping processes can be interupted. 2003-12-09 22:04:25 +00:00
manu 10f0bf745b Fix various broken sanity checks in iokit emulation.
Add some methods to IOFramebuffer (DARWIN_IOFBSETBOUNDS,
DARWIN_IOFBSETCURSORVISIBLE) and to IOHIDSystem (DARWIN_IOHIDPOSTEVENT),
all are unimplemented empty shells.
2003-12-09 17:13:18 +00:00
manu 98c34875d4 In mach_msg_error, don't display error message when the error
is 0 (no error). This function is often used as a shortcut to
return a short message with retval = 0.

Add error codes to the debug display
2003-12-09 17:10:02 +00:00
manu b50934fc19 Move exception related code to a dedicated file 2003-12-09 12:13:44 +00:00
manu 99ee466dbb Move most of the code involved into message header, trailer, and descriptor
construction to inline functions. This removes a lot of redundent code
from Mach services
2003-12-09 11:29:01 +00:00
manu 98f233296d Factor the code for OOL data movement into mach_ool_copyin and
mach_ool_copyout.

Handle port namespace and address space translations when OOL
data moves between different processes (untested)
2003-12-08 19:27:38 +00:00
manu 9046478856 Use appropriate macro definitions when filling complex messages
descriptor. This changes nothing but it removes a lot of XXX
2003-12-08 12:03:16 +00:00
manu df54a7fcc7 When handling complex messages, uses mach_msg_type_descriptor_t until we
know what type a descriptor really is.
2003-12-08 12:02:24 +00:00
manu 4e9539e452 When a task to task message carries ports, translate the port names into the
receiver namespace.

While we are there, refactor mach_msg_overwrite by splitting it into
several smaller functions. It had grown too big to be easily maintainable.
2003-12-07 23:44:14 +00:00
manu c29e7d5f16 Added SCHED_INFO flavor in host_info 2003-12-07 10:17:09 +00:00
manu dc728f311c Don't allow mappings at address zero in vm_allocate: first page is a
red zone in Darwin, and nothing should be mapped there.
While we are here, ifdef DEBUG_MACH_VM all the VM-related debug messages
2003-12-06 19:34:21 +00:00
manu 0951833f2e Remove the reference to struct proc in kernel and host port once the
process terminate, so that no stale pointer can be used if the port is
still referenced
2003-12-06 17:04:50 +00:00
manu 0105d58e0a Don't send Mach exceptions to dying processes 2003-12-06 15:16:38 +00:00
manu 174b751317 In task_terminate, unstop the process so that we can really terminate it now 2003-12-06 15:16:10 +00:00
manu 8f3ee36470 Fix some panics caused by incorrect Mach exceptions reference counts 2003-12-06 15:15:19 +00:00
jdolecek 0e253cf5f5 back the sigfilter emulation hook change off 2003-12-05 21:12:42 +00:00
manu ac7838e90f In the basic thread info, suspend count is the suspend sempahore. Just return
0 for now. This is plain wrong, but at least it allows gdb to startup a
program.
2003-12-03 22:25:46 +00:00
manu 18e13eee35 Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
2003-12-03 20:24:51 +00:00
manu 7973f2217b Rework Mach exceptions and softignals
Exceptions coming from a trap are generated from darwin_trapsignal()
softsignals are from darwin_sigfilter(), a function that is called
from darwin_trapsignal() and from kpsignal2() [the latter from a
emulation specific hook which is not yet committed]

Make some sanity checks to avoid sending data to a port with no receiver.

See http://mail-index.netbsd.org/tech-kern/2003/12/01/0008.html and
follow-ups for details.
2003-12-03 18:40:07 +00:00
manu 057381d1b4 Move machine dependent definitions to machine dependent headers. 2003-12-03 18:25:44 +00:00
manu 20fbf8c756 Trace data movement with vm_read and vm_write 2003-12-03 18:19:12 +00:00
manu eff089cdc0 More santity checks when sending data to a port: is there someone listening
on the receive end?
2003-12-03 18:18:43 +00:00
manu 437424d5f6 I forgot to commit this file for vm_machine_attribute to build correctly 2003-11-30 20:42:55 +00:00
manu ab8a1b7902 Add task_terminate 2003-11-30 20:42:03 +00:00
manu 540ad6ee85 Fix minor bug in the script that generate Mach services files (the master
fie tag was not copied)
2003-11-30 00:09:59 +00:00
manu 097771219f Implement vm_read, vm_write, and a framework for vm_machine_attribute.
THe machine dependent bit nees to be written.
2003-11-29 23:56:08 +00:00
manu 23a18da8cd To lookup a map entry in vm_map, use uvm_map_lookup, and not uvm_map_findspace,
which will not work on already mapped objects.
2003-11-28 08:03:14 +00:00
manu 8aa5d7b0f3 In Mach_task_suspend, stop the process without awaking its parent, this is
wrong on the semantic front; the spurious wakeup confuses Darwin's gdb.

Allow vm, task and thread operations on remote processes. The code to pick up
the remote process is in mach_sys_msg_trap(), so that any Mach service can
use it.
2003-11-27 23:44:49 +00:00
manu 9f69fbc7dc When sending exception with identity, include right names in the
receiver name space, not the sender one.
2003-11-25 23:17:40 +00:00
christos 5b1f7c5277 lr is uninitialized if we goto out1 2003-11-25 21:59:31 +00:00
manu c5006e8c0c Outch, uninitialized variable. How could that work before? 2003-11-25 17:09:24 +00:00
manu 206a81affc Don't change process' special ports on exec(). If gdb attached the process,
it holds rights to the special ports, and it expects the rights to be valid
even after the process calls exec().
2003-11-25 13:22:38 +00:00
manu ae4ac4f570 Also allow to change special and exception ports from a remote process 2003-11-24 20:30:19 +00:00
manu 2569c624db Don't free a buffer before we finished reading it 2003-11-24 17:20:58 +00:00
manu 1147a0b1e6 Enable tracing of out of line data sent with Mach message 2003-11-24 16:51:33 +00:00