Extending l4sys by reading/writing register values of a preempted thread
Denis Huber
huber.denis at mytum.de
Thu Mar 16 13:33:18 CET 2017
Hello Ludwig,
> Why not use ex_regs() on the thread to trigger an exception. That way, the
> attached userland exception handler can introspect the thread's complete
> register set. It can also alter the registers, so that the thread continues to
> run with the modified register set.
>
> Is there anything more you need?
I already tried ex_regs(). The problem with this function is, that it
does not return all registers, if the thread is in a syscall. It only
returns the PC and SP registers.
> A thread's userland registers are stored on every entry to the kernel. The
> class in Fiasco is called Entry_frame.
>
> The userland exception handler mentioned above modifies that Entry_frame.
Where does the kernel store the Entry_frame object for each thread? Is
it the location where Context::regs() points to?
> When the scheduler selects a thread, its userland state (Entry_frame) is
> restored on exit from kernel mode.
Can you point to the function that executes this code?
> Yes, that PC line is the userland program counter. the USP is the userland
> stack pointer. All userland registers are located at the top of kernel stack
> for a particular thread.
> In short mode, press 's' for a list of all tasks. Select the task in question
> and the press 'o' to see the capability space for that task.
> Hope that helps,
>
>
> - Christian
>
Thanks for your answer.
Kind regards,
Denis
More information about the l4-hackers
mailing list