Changeset 88d594a in rtems for cpukit/score


Ignore:
Timestamp:
May 24, 1995, 9:39:42 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5b9d6ddf
Parents:
bf61e45c
Message:

Fully tested on all in-house targets

Location:
cpukit/score
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/hppa1.1/cpu.c

    rbf61e45c r88d594a  
    1515 *      suitability of this software for any purpose.
    1616 *
    17  *  $Id$
     17 *  cpu.c,v 1.2 1995/05/09 20:11:35 joel Exp
    1818 */
    1919
  • cpukit/score/cpu/i386/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i386.h>
     34#include <rtems/i386.h>
    3535
    3636/*
  • cpukit/score/cpu/i386/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i386.h>
     34#include <rtems/i386.h>
    3535
    3636/*
  • cpukit/score/cpu/i960/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i960.h>
     34#include <rtems/i960.h>
    3535
    3636/*
  • cpukit/score/cpu/m68k/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <m68k.h>
     34#include <rtems/m68k.h>
    3535
    3636/*
  • cpukit/score/cpu/m68k/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <m68k.h>
     34#include <rtems/m68k.h>
    3535
    3636/*
  • cpukit/score/cpu/no_cpu/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <no_cpu.h>
     34#include <rtems/no_cpu.h>
    3535
    3636/*
  • cpukit/score/cpu/no_cpu/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <no_cpu.h>
     34#include <rtems/no_cpu.h>
    3535
    3636/*
  • cpukit/score/cpu/unix/cpu.c

    rbf61e45c r88d594a  
    3636#include <stdlib.h>
    3737#include <unistd.h>
    38 #include <string.h>
    3938#include <signal.h>
    4039#include <time.h>
     
    226225  unsigned32        _size,
    227226  unsigned32        _new_level,
    228   proc_ptr         *_entry_point
     227  void             *_entry_point
    229228)
    230229{
    231230    unsigned32  *addr;
    232231    unsigned32   jmp_addr;
    233     unsigned32   _stack;
     232    unsigned32   _stack_low;   /* lowest "stack aligned" address */
     233    unsigned32   _stack_high;  /* highest "stack aligned" address */
    234234    unsigned32   _the_size;
    235235
    236236    jmp_addr = (unsigned32) _entry_point;
    237237
    238     _stack = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
    239     _stack &= ~(CPU_STACK_ALIGNMENT - 1);
     238    /*
     239     *  On CPUs with stacks which grow down, we build the stack
     240     *  based on the _stack_high address.  On CPUs with stacks which
     241     *  grow up, we build the stack based on the _stack_low address. 
     242     */
     243
     244    _stack_low = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
     245    _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
     246
     247    _stack_high = ((unsigned32)(_stack_base) + _size);
     248    _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
    240249
    241250    _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1);
     
    251260#if defined(hppa1_1)
    252261    *(addr + RP_OFF) = jmp_addr;
    253     *(addr + SP_OFF) = (unsigned32)(_stack + CPU_FRAME_SIZE);
     262    *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
    254263
    255264    /*
     
    275284
    276285    *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
    277     *(addr + SP_OFF) = (unsigned32)(_stack +_the_size - CPU_FRAME_SIZE);
    278     *(addr + FP_OFF) = (unsigned32)(_stack +_the_size);
     286    *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
     287    *(addr + FP_OFF) = (unsigned32)(_stack_high);
    279288#else
    280289#error "UNKNOWN CPU!!!"
  • cpukit/score/include/rtems/score/watchdog.h

    rbf61e45c r88d594a  
    101101
    102102/*
    103  *  The following type is used for synchronization purposes
     103 *  The following are used for synchronization purposes
    104104 *  during an insert on a watchdog delta chain.
    105  *
    106  *  NOTE:  Watchdog_Pointer is only used to insure that
    107  *         Watchdog_Synchronization_pointer is a pointer
    108  *         which is volatile rather than a pointer to a
    109  *         volatile block of memory.
    110  */
    111 
    112 typedef Watchdog_Control          *Watchdog_Pointer;
    113 typedef volatile Watchdog_Pointer  Watchdog_Synchronization_pointer;
     105 */
     106
     107volatile unsigned32  _Watchdog_Sync_level;
     108volatile unsigned32  _Watchdog_Sync_count;
    114109
    115110/*
     
    120115EXTERN Chain_Control _Watchdog_Ticks_chain;
    121116EXTERN Chain_Control _Watchdog_Seconds_chain;
    122 
    123 /*
    124  *  The following defines the synchronization variable used to
    125  *  allow interrupts to be enabled while inserting a watchdog
    126  *  on a watchdog chain.
    127  */
    128 
    129 EXTERN Watchdog_Synchronization_pointer _Watchdog_Sync;
    130117
    131118/*
     
    377364
    378365/*
    379  *
    380  *  _Watchdog_Get_sync
    381  *
    382  *  DESCRIPTION:
    383  *
    384  *  This routine returns the current synchronization timer.  This
    385  *  routine is used so that interrupts can be enabled while a
    386  *  watchdog timer is being inserted into a watchdog chain.
    387  */
    388 
    389 STATIC INLINE Watchdog_Control *_Watchdog_Get_sync( void );
    390 
    391 /*
    392  *
    393  *  _Watchdog_Set_sync
    394  *
    395  *  DESCRIPTION:
    396  *
    397  *  This routine sets the current synchronization timer.  This
    398  *  routine is used so that interrupts can be enabled while a
    399  *  watchdog timer is being inserted into a watchdog chain.
    400  */
    401 
    402 STATIC INLINE void _Watchdog_Set_sync(
    403   Watchdog_Control *the_watchdog
    404 );
    405 
    406 /*
    407  *
    408  *  _Watchdog_Clear_sync
    409  *
    410  *  DESCRIPTION:
    411  *
    412  *  This routine will set the watchdog synchronization flag to a
    413  *  NULL address indicating synchronization is unnecessary.
    414  */
    415 
    416 STATIC INLINE void _Watchdog_Clear_sync( void );
    417 
    418 /*
    419366 *  _Watchdog_Adjust
    420367 *
     
    428375  Chain_Control              *header,
    429376  Watchdog_Adjust_directions  direction,
    430   rtems_interval           units
     377  rtems_interval              units
    431378);
    432379
  • cpukit/score/inline/rtems/score/watchdog.inl

    rbf61e45c r88d594a  
    258258}
    259259
    260 /*PAGE
    261  *
    262  *  _Watchdog_Get_sync
    263  *
    264  */
    265 
    266 STATIC INLINE Watchdog_Control *_Watchdog_Get_sync( void )
    267 {
    268   return (Watchdog_Control *) _Watchdog_Sync;
    269 }
    270 
    271 /*PAGE
    272  *
    273  *  _Watchdog_Set_sync
    274  *
    275  */
    276 
    277 STATIC INLINE void _Watchdog_Set_sync(
    278   Watchdog_Control *the_watchdog
    279 )
    280 {
    281   _Watchdog_Sync = (Watchdog_Synchronization_pointer) the_watchdog;
    282 }
    283 
    284 /*PAGE
    285  *
    286  *  _Watchdog_Clear_sync
    287  *
    288  */
    289 
    290 STATIC INLINE void _Watchdog_Clear_sync( void )
    291 {
    292   _Watchdog_Sync = NULL;
    293 }
    294 
    295260#endif
    296261/* end of include file */
  • cpukit/score/macros/rtems/score/watchdog.inl

    rbf61e45c r88d594a  
    172172  ((Watchdog_Control *) (_header)->last)
    173173
    174 /*PAGE
    175  *
    176  *  _Watchdog_Get_sync
    177  *
    178  */
    179 
    180 #define _Watchdog_Get_sync() \
    181    ((Watchdog_Control *) _Watchdog_Sync)
    182 
    183 /*PAGE
    184  *
    185  *  _Watchdog_Set_sync
    186  *
    187  */
    188 
    189 #define _Watchdog_Set_sync( _the_watchdog ) \
    190   _Watchdog_Sync = (Watchdog_Synchronization_pointer) (_the_watchdog)
    191 
    192 /*PAGE
    193  *
    194  *  _Watchdog_Clear_sync
    195  *
    196  */
    197 
    198 #define _Watchdog_Clear_sync() \
    199   _Watchdog_Sync = NULL;
    200 
    201174#endif
    202175/* end of include file */
  • cpukit/score/src/heap.c

    rbf61e45c r88d594a  
    117117{
    118118  Heap_Block        *the_block;
    119   Heap_Block        *next_block;
    120   Heap_Block        *previous_block;
     119 
     120  /*
     121   *  The overhead was taken from the original heap memory.
     122   */
     123
     124  Heap_Block  *old_final;
     125  Heap_Block  *new_final;
    121126
    122127  /*
     
    151156  /*
    152157   *  Currently only case 4 should make it to this point.
    153    */
    154 
    155   *amount_extended = size - HEAP_BLOCK_USED_OVERHEAD;
    156 
    157   previous_block = the_heap->last;
    158 
    159   the_block              = (Heap_Block *) starting_address;
    160   the_block->front_flag  = size;
    161   the_block->next        = previous_block->next;
    162   the_block->previous    = previous_block;
    163 
    164   previous_block->next   = the_block;
    165   the_heap->last         = the_block;
    166 
    167   next_block             = _Heap_Next_block( the_block );
    168   next_block->back_flag  = size;
    169   next_block->front_flag = HEAP_DUMMY_FLAG;
    170   the_heap->final        = next_block;
     158   *  The basic trick is to make the extend area look like a used
     159   *  block and free it.
     160   */
     161
     162  *amount_extended = size;
     163
     164  old_final = the_heap->final;
     165  new_final = _Addresses_Add_offset( old_final, size );
     166  /* SAME AS: _Addresses_Add_offset( starting_address, size-HEAP_OVERHEAD ); */
     167
     168  the_heap->final = new_final;
     169
     170  old_final->front_flag =
     171  new_final->back_flag  = _Heap_Build_flag( size, HEAP_BLOCK_USED );
     172  new_final->front_flag = HEAP_DUMMY_FLAG;
     173
     174  /*
     175   *  Must pass in address of "user" area
     176   */
     177
     178  _Heap_Free( the_heap, &old_final->next );
    171179
    172180  return HEAP_EXTEND_SUCCESSFUL;
     
    393401)
    394402{
    395   Heap_Block *the_block;
    396   Heap_Block *next_block;
     403  Heap_Block *the_block  = 0;  /* avoid warnings */
     404  Heap_Block *next_block = 0;  /* avoid warnings */
    397405  int         notdone = 1;
    398406
  • cpukit/score/src/watchdog.c

    rbf61e45c r88d594a  
    3131void _Watchdog_Handler_initialization( void )
    3232{
    33   _Watchdog_Clear_sync();
     33  _Watchdog_Sync_count = 0;
     34  _Watchdog_Sync_level = 0;
    3435  _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
    3536  _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
     
    5758    case WATCHDOG_INACTIVE:
    5859      break;
     60
     61    case WATCHDOG_REINSERT: 
     62   
     63      /*
     64       *  It is not actually on the chain so just change the state and
     65       *  the Insert operation we interrupted will be aborted.
     66       */
     67      the_watchdog->state = WATCHDOG_INACTIVE;
     68      break;
     69
    5970    case WATCHDOG_ACTIVE:
    60     case WATCHDOG_REINSERT:
    6171    case WATCHDOG_REMOVE_IT:
    6272
     
    6777        next_watchdog->delta_interval += the_watchdog->delta_interval;
    6878
    69       if ( the_watchdog == _Watchdog_Sync )
    70         _Watchdog_Sync = _Watchdog_Previous( the_watchdog );
     79      if ( _Watchdog_Sync_count )
     80        _Watchdog_Sync_level = _ISR_Nest_level;
    7181
    7282      _Chain_Extract_unprotected( &the_watchdog->Node );
     
    95105  Chain_Control               *header,
    96106  Watchdog_Adjust_directions   direction,
    97   rtems_interval            units
     107  rtems_interval               units
    98108)
    99109{
     
    137147  ISR_Level         level;
    138148  Watchdog_Control *after;
    139 
    140   the_watchdog->state          = WATCHDOG_REINSERT;
    141   the_watchdog->delta_interval = the_watchdog->initial;
     149  unsigned32        insert_isr_nest_level;
     150  rtems_interval    delta_interval;
     151 
     152
     153  insert_isr_nest_level   = _ISR_Nest_level;
     154  the_watchdog->state = WATCHDOG_REINSERT;
     155
     156  _Watchdog_Sync_count++;
     157restart:
     158  delta_interval = the_watchdog->initial;
    142159
    143160  _ISR_Disable( level );
     
    145162  for ( after = _Watchdog_First( header ) ;
    146163        ;
    147         after = _Watchdog_Next( _Watchdog_Get_sync() ) ) {
    148 
    149      if ( the_watchdog->delta_interval == 0 || !_Watchdog_Next( after ) )
     164        after = _Watchdog_Next( after ) ) {
     165
     166     if ( delta_interval == 0 || !_Watchdog_Next( after ) )
    150167       break;
    151168
    152      if ( the_watchdog->delta_interval < after->delta_interval ) {
    153        after->delta_interval -= the_watchdog->delta_interval;
     169     if ( delta_interval < after->delta_interval ) {
     170       after->delta_interval -= delta_interval;
    154171       break;
    155172     }
    156173
    157      the_watchdog->delta_interval -= after->delta_interval;
    158      _Watchdog_Set_sync( after );
     174     delta_interval -= after->delta_interval;
    159175
    160176     /*
    161       *  If you experience problems comment out the _ISR_Flash line.  Under
    162       *  certain circumstances, this flash allows interrupts to execute
    163       *  which violate the design assumptions.  The critical section
    164       *  mechanism used here must be redesigned to address this.
     177      *  If you experience problems comment out the _ISR_Flash line.  This
     178      *  (3.2.0) is the first release with this critical section redesigned.
     179      *  Under certain circumstances, the PREVIOUS critical section algorithm
     180      *  used around this flash point allows interrupts to execute
     181      *  which violated the design assumptions.  The critical section
     182      *  mechanism used here WAS redesigned to address this.
    165183      */
    166184
    167185     _ISR_Flash( level );
     186
     187     if ( the_watchdog->state != WATCHDOG_REINSERT ) {
     188       goto exit_insert;
     189     }
     190
     191     if ( _Watchdog_Sync_level > insert_isr_nest_level ) {
     192       _Watchdog_Sync_level = insert_isr_nest_level;
     193       _ISR_Enable( level );
     194       goto restart;
     195     }
    168196  }
    169197
     
    171199    _Watchdog_Activate( the_watchdog );
    172200
     201  the_watchdog->delta_interval = delta_interval;
     202
    173203  _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node );
    174204
    175   _Watchdog_Clear_sync();
    176 
    177   _ISR_Enable(  level );
     205exit_insert:
     206  _Watchdog_Sync_level = insert_isr_nest_level;
     207  _Watchdog_Sync_count--;
     208  _ISR_Enable( level );
    178209}
    179210
Note: See TracChangeset for help on using the changeset viewer.