예제 #1
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
void
apic_bcast_deinit_iipi (struct apic_dev * apic)
{
    uint8_t flags = irq_disable_save();
    apic_write(apic, APIC_REG_ICR, APIC_IPI_OTHERS | ICR_TRIG_MODE_LEVEL | ICR_DEL_MODE_INIT);
    irq_enable_restore(flags);
}
예제 #2
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
void
apic_bcast_sipi (struct apic_dev * apic, uint8_t target)
{
    uint8_t flags = irq_disable_save();
    apic_write(apic, APIC_REG_ICR, APIC_IPI_OTHERS | ICR_DEL_MODE_STARTUP | target);
    irq_enable_restore(flags);
}
예제 #3
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
void
apic_self_ipi (struct apic_dev * apic, uint_t vector)
{
    uint8_t flags = irq_disable_save();
    apic_write(apic, APIC_IPI_SELF, vector);
    irq_enable_restore(flags);
}
예제 #4
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
void
apic_send_sipi (struct apic_dev * apic, uint32_t remote_id, uint8_t target)
{
    uint8_t flags = irq_disable_save();
    apic_write(apic, APIC_REG_ICR2, remote_id << APIC_ICR2_DST_SHIFT);
    apic_write(apic, APIC_REG_ICR, ICR_DEL_MODE_STARTUP | target);
    irq_enable_restore(flags);
}
예제 #5
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
void
apic_deinit_iipi (struct apic_dev * apic, uint32_t remote_id)
{
    uint8_t flags = irq_disable_save();
    apic_write(apic, APIC_REG_ICR2, remote_id << APIC_ICR2_DST_SHIFT);
    apic_write(apic, APIC_REG_ICR, ICR_TRIG_MODE_LEVEL| ICR_DEL_MODE_INIT);
    irq_enable_restore(flags);
}
예제 #6
0
파일: apic.c 프로젝트: bradylee/nautilus_fs
static void
apic_sw_disable (struct apic_dev * apic)
{
    uint32_t val;
    uint8_t flags = irq_disable_save();
    val = apic_read(apic, APIC_REG_SPIV);
    apic_write(apic, APIC_REG_SPIV, val & ~APIC_SPIV_SW_ENABLE);
    irq_enable_restore(flags);
}
예제 #7
0
/*
 * nk_join
 *
 * join (wait) on the given thread
 *
 * t: the thread to wait on
 * retval: where the waited-on thread should 
 *         put its output
 *
 * returns  -EINVAL on error, 0 on success
 *
 */
int
nk_join (nk_thread_id_t t, void ** retval)
#ifndef NAUT_CONFIG_USE_RT_SCHEDULER
{
    nk_thread_t *thethread = (nk_thread_t*)t;
    uint8_t flags;

    ASSERT(thethread->parent == get_cur_thread());

    flags = irq_disable_save();

    while (__sync_lock_test_and_set(&thethread->lock, 1));

    if (thethread->status == NK_THR_EXITED) {
        if (thethread->output) {
            *retval = thethread->output;
        }
        goto out;
    } else {
        while (*(volatile int*)&thethread->status != NK_THR_EXITED) {
            __sync_lock_release(&thethread->lock);
            cli();
            nk_wait(t);
            sti();
            while (__sync_lock_test_and_set(&thethread->lock, 1));
        }
    }

    if (retval) {
        *retval = thethread->output;
    }

out:
    __sync_lock_release(&thethread->lock);
    thread_detach(thethread);
    irq_enable_restore(flags);
    return 0;
}