Hello: 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) { l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); } 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_RAISE_EXCEPTION | L4_THREAD_EX_REGS_ALIEN); while(1) { 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? Thanks. Cheng Guanghui
Hi,
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) { l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); l4_sleep(1000); } 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_RAISE_EXCEPTION | L4_THREAD_EX_REGS_ALIEN); while(1) { 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
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.
L4_THREAD_EX_REGS_RAISE_EXCEPTION flag needs to bet set every time. But L4_THREAD_EX_REGS_ALIEN doesn't need. My test program could run as what i want to do. But what is the difference between L4_THREAD_EX_REGS_ALIEN and L4_THREAD_EX_REGS_RAISE_EXCEPTION|L4_THREAD_EX_REGS_ALIEN? In the L4Linux i found you use L4_THREAD_EX_REGS_RAISE_EXCEPTION| L4_THREAD_EX_REGS_ALIEN but not only L4_THREAD_EX_REGS_ALIEN? What considerations do you have? Thanks a lot. cheng guanghui
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
But what is the difference between L4_THREAD_EX_REGS_ALIEN and L4_THREAD_EX_REGS_RAISE_EXCEPTION|L4_THREAD_EX_REGS_ALIEN?
L4_THREAD_EX_REGS_ALIEN := raise an exception whenever the task executes an L4 system call. This can be used to selectively allow/deny system calls. --> In L4Linux you want this to always maintain control over Linux applications by prohibiting them to do L4 system calls. There are special cases (hybrid apps) where you want to allow this, but still you need the alien state so that the L4Linux kernel always gets notified about applications doing calls into the L4 world.
L4_THREAD_EX_REGS_RAISE_EXCEPTION := make the thread raise an exception immediately after modifying its state and before continuing execution at the IP you set during l4_thread_ex_regs(). --> This is used as a synchronisation mechanism in L4Linux. You create a new L4 task for the new Linux task and make it raise an exception as the first thing to do. Then you can modify its state by replying to this exception.
Hth, Bjoern
On Wednesday 26 August 2009 06:51:42 pm Björn Döbel wrote:
Hi,
But what is the difference between L4_THREAD_EX_REGS_ALIEN and L4_THREAD_EX_REGS_RAISE_EXCEPTION|L4_THREAD_EX_REGS_ALIEN?
L4_THREAD_EX_REGS_ALIEN := raise an exception whenever the task executes an L4 system call. This can be used to selectively allow/deny system calls. --> In L4Linux you want this to always maintain control over Linux applications by prohibiting them to do L4 system calls. There are special cases (hybrid apps) where you want to allow this, but still you need the alien state so that the L4Linux kernel always gets notified about applications doing calls into the L4 world.
L4_THREAD_EX_REGS_RAISE_EXCEPTION := make the thread raise an exception immediately after modifying its state and before continuing execution at the IP you set during l4_thread_ex_regs(). --> This is used as a synchronisation mechanism in L4Linux. You create a new L4 task for the new Linux task and make it raise an exception as the first thing to do. Then you can modify its state by replying to this exception.
Thanks a lot to Bjoern. It is a really perfect explaination about these 2 flags. I could understand. Cheng Guanghui
l4-hackers@os.inf.tu-dresden.de