Start a process with a specified pager

Adam Lackorzynski adam at os.inf.tu-dresden.de
Thu Jul 24 23:44:46 CEST 2014


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                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list