Skip to content

Commit

Permalink
Set exit callback for sel4runtime for driver
Browse files Browse the repository at this point in the history
To prevent the tests exiting with a fault, we set an exit callback to
suspend the current thread when the driver exits.

Signed-off-by: Curtis Millar <[email protected]>
  • Loading branch information
xurtis committed Oct 2, 2020
1 parent 24c3369 commit 7b1f1fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/sel4test-driver/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <stdlib.h>
#include <limits.h>

#include <sel4runtime.h>

#include <allocman/bootstrap.h>
#include <allocman/vka.h>

Expand Down Expand Up @@ -591,8 +593,17 @@ static irq_id_t sel4test_timer_irq_register(UNUSED void *cookie, ps_irq_t irq, i
return num_timer_irqs++;
}

/* When the root task exists, it should simply suspend itself */
static void sel4test_exit(int code)
{
seL4_TCB_Suspend(seL4_CapInitThreadTCB);
}

int main(void)
{
/* Set exit handler */
sel4runtime_set_exit(sel4test_exit);

int error;
seL4_BootInfo *info = platsupport_get_bootinfo();

Expand Down

0 comments on commit 7b1f1fc

Please sign in to comment.