Changeset 04e3d9f in mainline


Ignore:
Timestamp:
2010-07-02T22:37:00Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
97bdb4a
Parents:
fef504a
Message:

remove an overly bold assumption about the validity of CPU
(some interrupts and especially exceptions can occur on the CPU even before the THE→cpu pointer is configured)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/interrupt/interrupt.c

    rfef504a r04e3d9f  
    100100NO_TRACE void exc_dispatch(unsigned int n, istate_t *istate)
    101101{
    102         ASSERT(CPU);
    103        
    104102#if (IVT_ITEMS > 0)
    105103        ASSERT(n < IVT_ITEMS);
     
    114112       
    115113        /* Account CPU usage if it has waked up from sleep */
    116         irq_spinlock_lock(&CPU->lock, false);
    117         if (CPU->idle) {
    118                 uint64_t now = get_cycle();
    119                 CPU->idle_cycles += now - CPU->last_cycle;
    120                 CPU->last_cycle = now;
    121                 CPU->idle = false;
    122         }
    123         irq_spinlock_unlock(&CPU->lock, false);
     114        if (CPU) {
     115                irq_spinlock_lock(&CPU->lock, false);
     116                if (CPU->idle) {
     117                        uint64_t now = get_cycle();
     118                        CPU->idle_cycles += now - CPU->last_cycle;
     119                        CPU->last_cycle = now;
     120                        CPU->idle = false;
     121                }
     122                irq_spinlock_unlock(&CPU->lock, false);
     123        }
    124124       
    125125        uint64_t begin_cycle = get_cycle();
Note: See TracChangeset for help on using the changeset viewer.