one question about l4_thread_ex_regs flags
adam at os.inf.tu-dresden.de
Tue Aug 25 21:08:06 CEST 2009
On Sun Aug 23, 2009 at 01:24:24 +0800, Guanghui, Cheng wrote:
> About the l4_thread_ex_regs system call there are 2 flags related with
> exception ipc. I only know the thread with these flags could generate the
> exception ipc but i don't know what is the difference between these flags:
> L4_THREAD_EX_REGS_RAISE_EXCEPTION , L4_THREAD_EX_REGS_ALIEN and
> L4_THREAD_EX_REGS_ALIEN | L4_THREAD_EX_REGS_ALIEN.
> So, i write a following program to test the behaviour with different flags :
> void idle(void *data)
> int main()
> l4_threadid_t me = l4_myself();
> l4thread_create(idle, NULL, L4THREAD_CREATE_ASYNC);
> l4_thread_ex_regs_flags(idle_thread, ~0UL, ~0UL,
> &_preempter, &me,
> &o, &o, &o,
> | L4_THREAD_EX_REGS_ALIEN);
> l4_ipc_wait(&src, ...);
> printf("thread :%d:%d\n", src.id.task, src.id.lthread);
> I tried 3 combination about these 2 flags but the output is the same as this:
> exceptio| thread :8:3
> i don't know why there is only one exception ipc. But the idle function
> includes 5 system calls. Additionally, it seems the ALIEN state is
> TEMPORARILY. I set once there is one exception ipc, twice two exception ipc.
> Can you explain me?
The output will always come from the same thread so the output should
always be the same?!
L4_THREAD_EX_REGS_RAISE_EXCEPTION is in effect once,
L4_THREAD_EX_REGS_ALIEN is a permanent state of the thread. If you do
not set it in a following exregs call it's cleared again. If you do a
trigger-exception, you get an exception IPC, if you do it again, you get
the next. But exception IPC is also about sending a reply, so you need
to reply to the receiving IPC to allow the thread to continue.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers