source: rtems/cpukit/score/src/watchdogadjusttochain.c @ e3f6d35

4.10
Last change on this file since e3f6d35 was 073e3e10, checked in by Sebastian Huber <sebastian.huber@…>, on 12/05/12 at 16:56:19

score: Critical fix for timer server

Under certain conditions it is possible that a call to
_Watchdog_Adjust_to_chain() happens with a unit parameter value of zero
(for example sptests/spintrcritical17). Remove superfluous checks that
prevent an adjust to a chain of a watchdog chain which first element has
a delta zero value.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 *  @file watchdogadjusttochain.c
3 *
4 *  This is used by the Timer Server task.
5 */
6
7/*  COPYRIGHT (c) 1989-2009.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/watchdog.h>
24
25void _Watchdog_Adjust_to_chain(
26  Chain_Control               *header,
27  Watchdog_Interval            units_arg,
28  Chain_Control               *to_fire
29
30)
31{
32  Watchdog_Interval  units = units_arg;
33  ISR_Level          level;
34  Watchdog_Control  *first;
35
36  _ISR_Disable( level );
37
38  while ( 1 ) {
39    if ( _Chain_Is_empty( header ) ) {
40      break;
41    }
42    first = _Watchdog_First( header );
43
44    /*
45     *  If it is longer than "units" until the first element on the chain
46     *  fires, then bump it and quit.
47     */
48    if ( units < first->delta_interval ) {
49      first->delta_interval -= units;
50      break;
51    }
52
53    /*
54     *  The first set happens in less than units, so take all of them
55     *  off the chain and adjust units to reflect this.
56     */
57    units -= first->delta_interval;
58    first->delta_interval = 0;
59
60    while ( 1 ) {
61      _Chain_Extract_unprotected( &first->Node );
62      _Chain_Append_unprotected( to_fire, &first->Node );
63
64      _ISR_Flash( level );
65
66      if ( _Chain_Is_empty( header ) )
67        break;
68      first = _Watchdog_First( header );
69      if ( first->delta_interval != 0 )
70        break;
71    }
72  }
73
74  _ISR_Enable( level );
75}
76
Note: See TracBrowser for help on using the repository browser.