Re: Start a process with a specified pager

Adam Lackorzynski <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
Hi,

On Thu Jul 24, 2014 at 02:14:56 -0700, Noah Zentzis wrote:
> I'm trying to launch a new task and run it under a custom pager, but I can't
> seem to figure out how to go about it. I've looked through the Moe and
> libloader source code, but I'm not sure how the task actually ends up
> getting created, only where the ELF image is loaded into memory. Can anyone
> point me towards the documentation for task creation or explain how Moe
> actually ends up turning the executable image into a running task?

Moe/Ned use libloader to start new tasks. Due to the flexibility of
libloader it's probably not easy to clearly see the main steps.
So in-short, the steps are:
  - Create a task (L4::Factory::create_task())
  - Create a thread (L4::Factory::create_thread())
  - Bind thread to task, set pager (L4::Thread::control*())
  - Set initial instruction and stack pointer (L4::Thread::ex_regs())
  - Map some initial capabilities to the task (L4::Task::map())
  - Run the thread (set scheduling params) (L4::Scheduler::run_thread())

Code for that is in the "remote-app-model" in the start_prog function in
libloader. You can also do those steps in you own program.

ELF unpacking can be done by the pager/loader as the pager needs to know
how to react on pagefaults.


Adam
-- 
Adam                 [email protected]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.