Esempio n. 1
0
void
chooseThread(void)
{
    word_t prio;
    word_t dom;
    tcb_t *thread;

    if (CONFIG_NUM_DOMAINS > 1) {
        dom = ksCurDomain;
    } else {
        dom = 0;
    }

    if (likely(ksReadyQueuesL1Bitmap[dom])) {
        word_t l1index = (wordBits - 1) - clzl(ksReadyQueuesL1Bitmap[dom]);
        word_t l2index = (wordBits - 1) - clzl(ksReadyQueuesL2Bitmap[dom][l1index]);
        prio = l1index_to_prio(l1index) | l2index;
        thread = ksReadyQueues[ready_queues_index(dom, prio)].head;
        assert(thread);
        assert(isRunnable(thread));
        switchToThread(thread);
    } else {
        switchToIdleThread();
    }
}
Esempio n. 2
0
void
chooseThread(void)
{
    word_t prio;
    word_t dom;
    tcb_t *thread;

    if (CONFIG_NUM_DOMAINS > 1) {
        dom = ksCurDomain;
    } else {
        dom = 0;
    }

    //printf("\n====In chooseThread=====\n");
    //printf("domain is %d\n", dom);

    if (likely(ksReadyQueuesL1Bitmap[dom])) {
        uint32_t l1index = (wordBits - 1) - CLZ(ksReadyQueuesL1Bitmap[dom]);
        uint32_t l2index = (wordBits - 1) - CLZ(ksReadyQueuesL2Bitmap[dom][l1index]);
        prio = l1index_to_prio(l1index) | l2index;
        thread = ksReadyQueues[ready_queues_index(dom, prio)].head;
        assert(thread);
        assert(isRunnable(thread));
        
        //printf("will call switchToThread(%p)\n", thread);
        //printf("its prio is %d\n", thread->tcbPriority);
        
        switchToThread(thread);
        return;
    }

    //printf("       IDLE THREAD\n");
    switchToIdleThread();

}
Esempio n. 3
0
void
chooseThread(void)
{
    int p;
    tcb_t *thread;

    for (p = seL4_MaxPrio; p != -1; p--) {
        unsigned int domprio = ksCurDomain * CONFIG_NUM_PRIORITIES + p;
        thread = ksReadyQueues[domprio].head;
        if (thread != NULL) {
            assert(isRunnable(thread));
            switchToThread(thread);
            return;
        }
    }

    switchToIdleThread();
}