mirror of
https://github.com/drasko/codezero.git
synced 2026-11-21 16:33:53 +01:00
exit() almost there.
- Implemented reasonable way to suspend task.
- A task that has a pending suspend would be interrupted
from its sleep via the suspender task.
- If suspend was raised and right after, task became about to sleep,
then scheduler wakes it up.
- If suspend was raised when task was in user mode, then an irq suspends it.
- Also suspends are checked at the end of a syscall so that if suspend was
raised because of a syscall from the task, the task is suspended before it
goes back to user mode.
- This mechanism is very similar to signals, and it may lead as a base for
implementing signal handling.
- Implemented common vma dropping for shadow vm object dropping and task exiting.
This commit is contained in:
@@ -5,20 +5,22 @@
|
||||
#include <unistd.h>
|
||||
#include <l4/macros.h>
|
||||
|
||||
static inline void l4_exit(int status)
|
||||
static inline void __attribute__ ((noreturn)) l4_exit(int status)
|
||||
{
|
||||
int err;
|
||||
int ret;
|
||||
|
||||
write_mr(L4SYS_ARG0, status);
|
||||
|
||||
/* Call pager with exit() request. */
|
||||
err = l4_send(PAGER_TID, L4_IPC_TAG_EXIT);
|
||||
printf("%s: L4 IPC Error: %d.\n", __FUNCTION__, err);
|
||||
/* Call pager with exit() request and block on its receive phase */
|
||||
ret = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_EXIT);
|
||||
|
||||
/* This call should not fail or return */
|
||||
printf("%s: L4 IPC returned: %d.\n", __FUNCTION__, ret);
|
||||
BUG();
|
||||
}
|
||||
|
||||
void exit(int status)
|
||||
void __attribute__ ((noreturn)) _exit(int status)
|
||||
{
|
||||
l4_exit(status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user