Ignore:
Timestamp:
2007-02-03T21:26:54Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cf5ddf6
Parents:
80bcaed
Message:

When clock() is called by an external interrupt dispatched by the IRQ dispatcher,
no spinlock can be held or the kernel will not be preemptive. This fixes Ticket #24.

Formating and indentation fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/drivers/i8254.c

    r80bcaed rf619ec11  
    6969static void i8254_irq_handler(irq_t *irq, void *arg, ...)
    7070{
     71        /*
     72         * This IRQ is responsible for kernel preemption.
     73         * Nevertheless, we are now holding a spinlock which prevents
     74         * preemption. For this particular IRQ, we don't need the
     75         * lock. We just release it, call clock() and then reacquire it again.
     76         */
     77        spinlock_unlock(&irq->lock);
    7178        clock();
     79        spinlock_lock(&irq->lock);
    7280}
    7381
     
    137145        o2 |= inb(CLK_PORT1) << 8;
    138146
    139         CPU->delay_loop_const = ((MAGIC_NUMBER*LOOPS)/1000) / ((t1-t2)-(o1-o2)) + (((MAGIC_NUMBER*LOOPS)/1000) % ((t1-t2)-(o1-o2)) ? 1 : 0);
     147        CPU->delay_loop_const =
     148            ((MAGIC_NUMBER * LOOPS) / 1000) / ((t1 - t2) - (o1 - o2)) +
     149            (((MAGIC_NUMBER * LOOPS) / 1000) % ((t1 - t2) - (o1 - o2)) ? 1 : 0);
    140150
    141151        clk1 = get_cycle();
Note: See TracChangeset for help on using the changeset viewer.