Changeset 6a10709 in rtems


Ignore:
Timestamp:
Mar 31, 1999, 10:33:14 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
f470989
Parents:
5c95996
Message:

Patch from Chris Johns <ccj@…>:

joel@… wrote:

Chris,

sp09 fails on the rtems_port_delete(0) call. This is supposed to give an
invalid id error. I can't find any changes other than the unlimited
objects patch which would have tripped this so would appreciate it if you
could look into it. I suspect that this is a side-effect of the unlimited
objects patch.

It is me.

Basically, there are 0 ports configured in sp09. The test ends up
dereferecing NULL in local_table[0] and comes up with a non-NULL invalid
pointer.

The issue is not actually allocating a local_table for an object type
which has a maximum value of 0. I cannot remember the exact workings of
the id values and the local_table. I might have changed the nature from
the pre-unlimited change. As you know the id's are an interesting game
where performance is most important.

I know the problem could be solved by adding a check for index == 0. But
I hate to slow this path down. I think you may have changed the way the
object information structure gets initialized.


This change lets the unlimited and sp09 tests run on the posix Linux
BSP. A static local variable `null_local_table' has been added. This
variable is always set to NULL. The `local_table' element of the
information structure is set to point to this variable earily in the
initialisation. If the object type has more than 0 elements the
`local_table' element is updated. All object types which have 0 elements
reference `null_local_table'. This change fixes the problem sp09 found
yet does not add any extra processing to the critical
`_Objects_Get_local_object' function.


Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/src/object.c

    r5c95996 r6a10709  
    9696
    9797  minimum_index = _Objects_Get_index( information->minimum_id );
    98   index_base = minimum_index;
    99   block = 0;
    100  
    101   if (information->maximum < minimum_index)
     98  index_base    = minimum_index;
     99  block         = 0;
     100 
     101  if ( information->maximum < minimum_index )
    102102    block_count = 0;
    103103  else {
     
    440440)
    441441{
     442  static Objects_Control *null_local_table = NULL;
     443 
    442444  unsigned32       minimum_index;
    443445  unsigned32       index;
     
    472474
    473475  information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
    474   maximum &= ~OBJECTS_UNLIMITED_OBJECTS;
     476  maximum                 &= ~OBJECTS_UNLIMITED_OBJECTS;
    475477 
    476478  /*
     
    479481
    480482  information->allocation_size = maximum;
     483
     484  /*
     485   *  Provide a null local table entry for the case of any empty table.
     486   */
     487
     488  information->local_table = &null_local_table;
    481489
    482490  /*
     
    496504  name_length = maximum_name_length;
    497505
    498   if (name_length & (OBJECTS_NAME_ALIGNMENT-1))
     506  if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
    499507    name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
    500508                  ~(OBJECTS_NAME_ALIGNMENT-1);
  • cpukit/score/src/object.c

    r5c95996 r6a10709  
    9696
    9797  minimum_index = _Objects_Get_index( information->minimum_id );
    98   index_base = minimum_index;
    99   block = 0;
    100  
    101   if (information->maximum < minimum_index)
     98  index_base    = minimum_index;
     99  block         = 0;
     100 
     101  if ( information->maximum < minimum_index )
    102102    block_count = 0;
    103103  else {
     
    440440)
    441441{
     442  static Objects_Control *null_local_table = NULL;
     443 
    442444  unsigned32       minimum_index;
    443445  unsigned32       index;
     
    472474
    473475  information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
    474   maximum &= ~OBJECTS_UNLIMITED_OBJECTS;
     476  maximum                 &= ~OBJECTS_UNLIMITED_OBJECTS;
    475477 
    476478  /*
     
    479481
    480482  information->allocation_size = maximum;
     483
     484  /*
     485   *  Provide a null local table entry for the case of any empty table.
     486   */
     487
     488  information->local_table = &null_local_table;
    481489
    482490  /*
     
    496504  name_length = maximum_name_length;
    497505
    498   if (name_length & (OBJECTS_NAME_ALIGNMENT-1))
     506  if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
    499507    name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
    500508                  ~(OBJECTS_NAME_ALIGNMENT-1);
Note: See TracChangeset for help on using the changeset viewer.