summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/watchdogadjust.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-07-18 14:47:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-07-18 14:47:55 +0000
commitfbbe5fde57bdc9d0c7f809931c2addb43bc1bd42 (patch)
tree52468f8511082fc9893f46b9020817d23bf0c398 /cpukit/score/src/watchdogadjust.c
parentFixed formatting so scripts work. (diff)
downloadrtems-fbbe5fde57bdc9d0c7f809931c2addb43bc1bd42.tar.bz2
2003-07-18 Till Straumann <strauman@slac.stanford.edu>
PR 430/rtems * include/rtems/score/watchdog.h: _Watchdog_Ticks_since_boot should be a VOLATILE variable. * src/watchdoginsert.c: 'restart' algorithm needs to enforce reloading the list head in case a TICK interrupt during ISR_Flash() modified the list. This is achieved by a proper VOLATILE cast. Also _Watchdog_Sync_count++ should be protected by _ISR_Disable (prevent corruption in case ISR calls watchdoginsert) * src/watchdogadjust.c: ISR protection added. * src/watchdogtickle.c: ISR protection added. NOTE: PowerPC BSPs using the new exception processing MUST BE UPDATED to maintain _ISR_Nest_level. See also PR288 which provides fixes for the affected BSPs distributed with RTEMS.
Diffstat (limited to 'cpukit/score/src/watchdogadjust.c')
-rw-r--r--cpukit/score/src/watchdogadjust.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpukit/score/src/watchdogadjust.c b/cpukit/score/src/watchdogadjust.c
index 6926743f32..73b85a7eb4 100644
--- a/cpukit/score/src/watchdogadjust.c
+++ b/cpukit/score/src/watchdogadjust.c
@@ -37,6 +37,19 @@ void _Watchdog_Adjust(
Watchdog_Interval units
)
{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+
+ /*
+ * NOTE: It is safe NOT to make 'header' a pointer
+ * to volatile data (contrast this with watchdoginsert.c)
+ * because we call _Watchdog_Tickle() below and
+ * hence the compiler must not assume *header to remain
+ * unmodified across that call.
+ *
+ * Till Straumann, 7/2003
+ */
if ( !_Chain_Is_empty( header ) ) {
switch ( direction ) {
case WATCHDOG_BACKWARD:
@@ -50,7 +63,13 @@ void _Watchdog_Adjust(
} else {
units -= _Watchdog_First( header )->delta_interval;
_Watchdog_First( header )->delta_interval = 1;
+
+ _ISR_Enable( level );
+
_Watchdog_Tickle( header );
+
+ _ISR_Disable( level );
+
if ( _Chain_Is_empty( header ) )
break;
}
@@ -58,5 +77,8 @@ void _Watchdog_Adjust(
break;
}
}
+
+ _ISR_Enable( level );
+
}