Subject: Re: lwp_emuldata
To: Martin Husemann <>
From: Emmanuel Dreyfus <>
List: tech-kern
Date: 12/11/2003 10:27:29
On Thu, Dec 11, 2003 at 09:34:15AM +0100, Martin Husemann wrote:
> But I'd like to understand what's causing this need for per-lwp emuldata,
> just out of curiosity. What emulated entitity are you mapping to LWPs, or how
> are LPWs exposed to the emulated userland?

Each process (task in Mach terminology) has a kernel port. You send 
messages to this port to get any action from the kernel: mapping memory,
creating a new thread, allocating ports...

Once you got a send right to task kernel port from another task, you can
remotely perform any action the task could have done. This is how gdb works
on MacOS X: it takes the traced task kernel port, and then it sends messages 
to it to read memory, for instance.

Within a task, each thread also has a kernel port, which is used to perform
thread specific operations. You can use that to read and write a thread's
register, or to stop and unstop it remotely. gdb makes intesnive use of
that, but a program can also use it internally, for instance to suspend and 
resume a given thread.

Emmanuel Dreyfus