l4_thread_ex_regs and suspending thread

Valery V. Sedletski _valerius at mail.ru
Mon Jul 18 06:01:53 CEST 2016


Adam Lackorzynski wrote:
> Hi,
>
> So I'm looking at the late v2 version of Fiasco and I'm reading the code
> such that ~0 means "don't change this value". The current/old value is
> delivered back in any case. Regarding the L4_INVALID_ID, I'm reading the
> code such that the pager will not be set when the target ID does not
> exist, which includes L4_INVALID_ID, i.e. the thread's pager should not
> be changed.
>   
but strange that it got a pagefault in case ~0 or L4_INVALID_ID is 
specified, but does not change the registers or/and pager/preempter if I 
specify 0 for eip/esp or l4_threadid_t initialized with zeros instead of 
L4_INVALID_ID
>> So, is it possible anyhow to suspend/resume the running thread from another
>> thread? I know, that the thread can be suspended if entering unconditional
>> l4_ipc_wait(), but this is from the inside that thread. How could it be done
>> from an outside thread?
> One way is to set the thread on such a loop via ex_regs (and paying
> attention to the register contents which basically means there's some
> assembly code involved). Another way is to do
> ex_regs(id, ~0, ~0, L4_THREAD_EX_REGS_RAISE_EXCEPTION) which will
> trigger an artificial exception in the thread and have it send an
> exception IPC to its pager. The pager should then just not reply to have
> the thread suspended, and then reply when you want to have the thread go
> on later. What makes this a bit tricky is when L4 IPC is involves which
> you will cancel with ex_regs, or not, if you use the
> L4_THREAD_EX_REGS_NO_CANCEL flag.
>
I tried the 1st way -- set eip to the address of IPC wait loop, so it 
does suspend here, but resume doesn't work. -- You said that I'll need 
to set some registers via assember, but I wonder which ones -- the 
changed one is eip only. esp and eflags are only read, but didn't 
changed, others seems to be not altered with ex_regs...
>
>
> Adam




More information about the l4-hackers mailing list