/* Creates a new thread for an IRQ server */ struct irq_server_thread* irq_server_thread_new(vspace_t* vspace, vka_t* vka, seL4_CPtr cspace, seL4_Word priority, simple_t *simple, seL4_Word label, seL4_CPtr sep) { struct irq_server_thread* st; int err; /* Allocate memory for the structure */ st = (struct irq_server_thread*)malloc(sizeof(*st)); if (st == NULL) { return NULL; } st->node = irq_server_node_new(0, MASK(NIRQS_PER_NODE)); if (st->node == NULL) { free(st); return NULL; } /* Initialise structure */ st->delivery_sep = sep; st->label = label; st->next = NULL; /* Create an endpoint to listen on */ err = vka_alloc_notification(vka, &st->notification); if (err) { ZF_LOGE("Failed to allocate IRQ notification endpoint for IRQ server thread\n"); return NULL; } st->node->notification = st->notification.cptr; /* Create the IRQ thread */ err = sel4utils_configure_thread(vka, vspace, vspace, seL4_CapNull, priority, cspace, seL4_NilData, &st->thread); if (err) { ZF_LOGE("Failed to configure IRQ server thread\n"); return NULL; } /* Start the thread */ err = sel4utils_start_thread(&st->thread, (void*)_irq_thread_entry, st, NULL, 1); if (err) { ZF_LOGE("Failed to start IRQ server thread\n"); return NULL; } return st; }
void init_timer(env_t env, test_init_data_t *init_data) { /* minimal simple implementation to get the platform * default timer off the ground */ env->simple.arch_simple.irq = get_irq; env->simple.data = (void *) init_data; env->simple.arch_simple.data = (void *) init_data; UNUSED int error; arch_init_simple(&env->simple); error = vka_alloc_notification(&env->vka, &env->timer_notification); if (error != 0) { ZF_LOGF("Failed to allocate notification object"); } env->timer = sel4platsupport_get_default_timer(&env->vka, &env->vspace, &env->simple, env->timer_notification.cptr); if (env->timer == NULL) { ZF_LOGF("Failed to initialise default timer"); } }