Changeset cfc257fc in rtems
- Timestamp:
- Jul 18, 2003, 2:47:36 PM (18 years ago)
- Children:
- 367a0e2
- Parents:
- 8f51fa52
- Location:
- cpukit/score
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/score/ChangeLog
r8f51fa52 rcfc257fc 1 2003-07-18 Till Straumann <strauman@slac.stanford.edu> 2 3 PR 430/rtems 4 * include/rtems/score/watchdog.h: _Watchdog_Ticks_since_boot should 5 be a VOLATILE variable. 6 * src/watchdoginsert.c: 'restart' algorithm needs to enforce 7 reloading the list head in case a TICK interrupt during ISR_Flash() 8 modified the list. This is achieved by a proper VOLATILE cast. 9 Also _Watchdog_Sync_count++ should be protected by _ISR_Disable 10 (prevent corruption in case ISR calls watchdoginsert) 11 * src/watchdogadjust.c: ISR protection added. 12 * src/watchdogtickle.c: ISR protection added. 13 NOTE: PowerPC BSPs using the new exception processing MUST BE UPDATED 14 to maintain _ISR_Nest_level. See also PR288 which provides fixes 15 for the affected BSPs distributed with RTEMS. 16 1 17 2003-07-07 Joel Sherrill <joel@OARcorp.com> 2 18 -
cpukit/score/include/rtems/score/watchdog.h
r8f51fa52 rcfc257fc 104 104 */ 105 105 106 SCORE_EXTERN Watchdog_Interval _Watchdog_Ticks_since_boot;106 SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot; 107 107 108 108 /* -
cpukit/score/src/watchdogadjust.c
r8f51fa52 rcfc257fc 38 38 ) 39 39 { 40 ISR_Level level; 41 42 _ISR_Disable( level ); 43 44 /* 45 * NOTE: It is safe NOT to make 'header' a pointer 46 * to volatile data (contrast this with watchdoginsert.c) 47 * because we call _Watchdog_Tickle() below and 48 * hence the compiler must not assume *header to remain 49 * unmodified across that call. 50 * 51 * Till Straumann, 7/2003 52 */ 40 53 if ( !_Chain_Is_empty( header ) ) { 41 54 switch ( direction ) { … … 51 64 units -= _Watchdog_First( header )->delta_interval; 52 65 _Watchdog_First( header )->delta_interval = 1; 66 67 _ISR_Enable( level ); 68 53 69 _Watchdog_Tickle( header ); 70 71 _ISR_Disable( level ); 72 54 73 if ( _Chain_Is_empty( header ) ) 55 74 break; … … 59 78 } 60 79 } 80 81 _ISR_Enable( level ); 82 61 83 } 62 84 -
cpukit/score/src/watchdoginsert.c
r8f51fa52 rcfc257fc 39 39 the_watchdog->state = WATCHDOG_BEING_INSERTED; 40 40 41 _ISR_Disable( level ); 42 41 43 _Watchdog_Sync_count++; 44 42 45 restart: 43 46 delta_interval = the_watchdog->initial; 44 47 45 _ISR_Disable( level ); 46 47 for ( after = _Watchdog_First( header ) ; 48 /* 49 * We CANT use _Watchdog_First() here, because a TICK interrupt 50 * could modify the chain during the _ISR_Flash() below. Hence, 51 * the header is pointing to volatile data. The _Watchdog_First() 52 * INLINE routine (but not the macro - note the subtle difference) 53 * casts away the 'volatile'... 54 * 55 * Also, this is only necessary because we call no other routine 56 * from this piece of code, hence the compiler thinks it's safe to 57 * cache *header!! 58 * 59 * Till Straumann, 7/2003 (gcc-3.2.2 -O4 on powerpc) 60 * 61 */ 62 for ( after = (Watchdog_Control *) ((volatile Chain_Control *)header)->first ; 48 63 ; 49 64 after = _Watchdog_Next( after ) ) { … … 76 91 if ( _Watchdog_Sync_level > insert_isr_nest_level ) { 77 92 _Watchdog_Sync_level = insert_isr_nest_level; 78 _ISR_Enable( level );79 93 goto restart; 80 94 } -
cpukit/score/src/watchdogtickle.c
r8f51fa52 rcfc257fc 34 34 ) 35 35 { 36 ISR_Level level; 36 37 Watchdog_Control *the_watchdog; 38 Watchdog_States watchdog_state; 39 40 /* 41 * See the comment in watchdoginsert.c and watchdogadjust.c 42 * about why it's safe not to declare header a pointer to 43 * volatile data - till, 2003/7 44 */ 45 46 _ISR_Disable( level ); 37 47 38 48 if ( _Chain_Is_empty( header ) ) 39 return;49 goto leave; 40 50 41 51 the_watchdog = _Watchdog_First( header ); 42 52 the_watchdog->delta_interval--; 43 53 if ( the_watchdog->delta_interval != 0 ) 44 return;54 goto leave; 45 55 46 56 do { 47 switch( _Watchdog_Remove( the_watchdog ) ) { 57 watchdog_state = _Watchdog_Remove( the_watchdog ); 58 59 _ISR_Enable( level ); 60 61 switch( watchdog_state ) { 48 62 case WATCHDOG_ACTIVE: 49 63 (*the_watchdog->routine)( … … 72 86 break; 73 87 } 88 89 _ISR_Disable( level ); 90 74 91 the_watchdog = _Watchdog_First( header ); 75 92 } while ( !_Chain_Is_empty( header ) && 76 93 (the_watchdog->delta_interval == 0) ); 94 95 leave: 96 _ISR_Enable(level); 77 97 }
Note: See TracChangeset
for help on using the changeset viewer.