Changeset c93e805 in mainline for generic/src/time/clock.c


Ignore:
Timestamp:
2006-05-28T11:29:23Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74fbedb
Parents:
6212095
Message:

Add missed_clock_ticks to CPU structure so that clock() can detect missed timer interrupts.
Architectures are required to support this in order to make time keeping accurate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/time/clock.c

    r6212095 rc93e805  
    6363        timeout_handler_t f;
    6464        void *arg;
     65        int i;
    6566
    6667        /*
     
    6869         * run all expired timeouts as you visit them.
    6970         */
    70         spinlock_lock(&CPU->timeoutlock);
    71         while ((l = CPU->timeout_active_head.next) != &CPU->timeout_active_head) {
    72                 h = list_get_instance(l, timeout_t, link);
    73                 spinlock_lock(&h->lock);
    74                 if (h->ticks-- != 0) {
    75                         spinlock_unlock(&h->lock);
    76                         break;
     71        for (i = 0; i < CPU->missed_clock_ticks; i++) {
     72                spinlock_lock(&CPU->timeoutlock);
     73                while ((l = CPU->timeout_active_head.next) != &CPU->timeout_active_head) {
     74                        h = list_get_instance(l, timeout_t, link);
     75                        spinlock_lock(&h->lock);
     76                        if (h->ticks-- != 0) {
     77                                spinlock_unlock(&h->lock);
     78                                break;
     79                        }
     80                        list_remove(l);
     81                        f = h->handler;
     82                        arg = h->arg;
     83                        timeout_reinitialize(h);
     84                        spinlock_unlock(&h->lock);     
     85                        spinlock_unlock(&CPU->timeoutlock);
     86
     87                        f(arg);
     88
     89                        spinlock_lock(&CPU->timeoutlock);
    7790                }
    78                 list_remove(l);
    79                 f = h->handler;
    80                 arg = h->arg;
    81                 timeout_reinitialize(h);
    82                 spinlock_unlock(&h->lock);     
    8391                spinlock_unlock(&CPU->timeoutlock);
    84 
    85                 f(arg);
    86 
    87                 spinlock_lock(&CPU->timeoutlock);
    8892        }
    89         spinlock_unlock(&CPU->timeoutlock);
     93        CPU->missed_clock_ticks = 0;
    9094
    9195        /*
Note: See TracChangeset for help on using the changeset viewer.