22 #if defined( CONFIG_CONSERVE_MEMORY )
23 #define OBJECT_TABLE_ALLOCSIZE 128
24 #define INITIAL_LFSRPOLY 0x83
25 #elif defined( CONFIG_NO_OBJECTS )
26 #define OBJECT_TABLE_ALLOCSIZE CONFIG_NO_OBJECTS
27 #if CONFIG_NO_OBJECTS == 512
28 #define INITIAL_LFSRPOLY 0x211
29 #elif CONFIG_NO_OBJECTS == 1024
30 #define INITIAL_LFSRPOLY 0x409
31 #elif CONFIG_NO_OBJECTS == 2048
32 #define INITIAL_LFSRPOLY 0x805
33 #elif CONFIG_NO_OBJECTS == 4096
34 #define INITIAL_LFSRPOLY 0x1053
35 #elif CONFIG_NO_OBJECTS == 8192
36 #define INITIAL_LFSRPOLY 0x201B
37 #elif CONFIG_NO_OBJECTS == 16384
38 #define INITIAL_LFSRPOLY 0x402B
40 #error CONFIG_NO_OBJECTS must be 512, 1K, 2K, 4K, 8K, or 16K
43 #define OBJECT_TABLE_ALLOCSIZE 1024
44 #define INITIAL_LFSRPOLY 0x409
107 "Object table param" );
109 "Object table param" );
111 "Object table param" );
113 "Object table param" );
115 "Object table param" );
118 "Object table param" );
120 "Object table param" );
122 "Object table param" );
124 "Object table param" );
126 "Object table param" );
128 "Object table param" );
130 "Object table param" );
132 "Object table param" );
134 "Object table param" );
137 krnlData = krnlDataPtr;
141 clAlloc(
"initObjectTable",
168 FORALL( i, 0, OBJECT_TABLE_ALLOCSIZE, \
211 objectInfoPtr = &krnlData->
objectTable[ objectHandle ];
221 status = krnlMemfree( &objectInfoPtr->
objectPtr );
230 krnlData->
objectTable[ objectHandle ] = OBJECT_INFO_TEMPLATE;
239 static
int destroyObject(
IN_HANDLE const int objectHandle )
247 objectInfoPtr = &krnlData->
objectTable[ objectHandle ];
252 if( messageFunction == NULL )
254 krnlData->
objectTable[ objectHandle ] = OBJECT_INFO_TEMPLATE;
280 static
int destroySelectedObjects(
IN_RANGE( 1, 3 )
const int currentDepth )
286 REQUIRES( currentDepth >= 1 && currentDepth <= 3 );
293 const int dependentObject = \
294 objectTable[ objectHandle ].dependentObject;
298 if( objectTable[ objectHandle ].
objectPtr == NULL )
306 if(
isValidObject( objectTable[ dependentObject ].dependentObject ) )
310 if(
isValidObject( objectTable[ dependentObject ].dependentDevice ) )
316 if(
isValidObject( objectTable[ objectHandle ].dependentDevice ) )
329 if( depth >= currentDepth )
339 ENSURES( objectHandle < MAX_OBJECTS );
349 int depth, objectHandle, localStatus, status =
DUMMY_INIT;
384 status = destroyObject( objectHandle );
391 !memcmp( &krnlData->
objectTable[ i ], &OBJECT_INFO_TEMPLATE, \
404 for( depth = 3; depth > 0; depth-- )
406 localStatus = destroySelectedObjects( depth );
408 status = localStatus;
414 !memcmp( &krnlData->
objectTable[ i ], &OBJECT_INFO_TEMPLATE, \
496 static
int findFreeResource(
int value )
512 ENSURES( iterations < krnlData->objectTableSize );
532 ENSURES( iterations < MAX_OBJECTS );
554 static
int expandObjectTable(
void )
556 static const long FAR_BSS lfsrPolyTable[] = \
557 { 0x83, 0x11D, 0x211, 0x409,
558 0x805, 0x1053, 0x201B, 0x402B,
559 0x8003L, 0x1002DL, 0x20009L, 0x40027L,
560 0x80027L, 0x100009L, 0x200005L, 0x400003L,
581 if( newTable == NULL )
589 i < krnlData->objectTableSize * 2 && i < MAX_OBJECTS; i++ )
590 newTable[ i ] = OBJECT_INFO_TEMPLATE;
600 for( i = 0; i < 16; i++ )
620 return( objectHandle );
629 IN_FLAGS( CREATEOBJECT )
const int createObjectFlags,
631 IN_FLAGS( ACTION )
const int actionFlags,
637 int localObjectHandle;
646 REQUIRES( objectDataSize > 16 && objectDataSize < 16384 );
652 REQUIRES( ( ( bitCount + ( bitCount >> 3 ) ) & 030707070707L ) % 63 == 1 );
658 REQUIRES( messageFunction != NULL );
662 *objectDataPtr = NULL;
671 DEBUG_DIAG((
"Can't create new objects during a shutdown" ));
682 int status = krnlMemalloc( objectDataPtr, objectDataSize );
688 if( ( *objectDataPtr =
clAlloc(
"krnlCreateObject", \
689 objectDataSize ) ) == NULL )
692 memset( *objectDataPtr, 0, objectDataSize );
693 objectInfo = OBJECT_INFO_TEMPLATE;
696 if( createObjectFlags & CREATEOBJECT_FLAG_SECUREMALLOC )
731 localObjectHandle == objectStateInfo->
objectHandle + 1 );
738 localObjectHandle = findFreeResource( localObjectHandle );
744 localObjectHandle = expandObjectTable();
753 int status = krnlMemfree( &objectInfo.
objectPtr );
761 return( localObjectHandle );
770 krnlData->
objectTable[ localObjectHandle ] = objectInfo;
788 ( int ) theTime & ( objectStateInfo->
lfsrMask - 1 );
819 *objectHandle = localObjectHandle;