This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Support for run-time heapsizing and multiple heaps


Hi,

this patch adds support for heaps with arenasize 0. This is useful for platforms which allow run-time heap sizing and have discontinous memory areas.

Cheers,
Dirk


Index: packages/services/memalloc/common/current/ChangeLog
===================================================================
--- packages/services/memalloc/common/current/ChangeLog.orig
+++ packages/services/memalloc/common/current/ChangeLog
               
+2005-05-04  Dirk Eibach  <eibach@gdsys.de>
+
+       * include/memjoin.inl: Support for heaps with arenasize 0. This is
+       useful for platforms which allow run-time heap sizing.
+
 2004-10-04  Oyvind Harboe  <oyvind.harboe@zylin.com>

        * src/dlmalloc.cxx (resize_alloc): No longer invoke

Index: packages/services/memalloc/common/current/include/memjoin.inl
===================================================================
--- packages/services/memalloc/common/current/include/memjoin.inl.orig
+++ packages/services/memalloc/common/current/include/memjoin.inl
                     

     CYG_CHECK_DATA_PTRC( heaps );

-    poolcount = num_heaps;
+    poolcount = 0;

     // allocate internal structures - this should work because we should be
     // the first allocation for this pool; and if there isn't enough space
     // for these teeny bits, what hope is there!
     for (i=0; i<num_heaps; i++) {
+        heaps[i]->get_status( CYG_MEMPOOL_STAT_ARENABASE|
+                              CYG_MEMPOOL_STAT_ARENASIZE,
+                              stat );
+        if ( stat.arenasize <= 0 )
+               continue;
         pools = (struct pooldesc *)
             heaps[i]->try_alloc( num_heaps * sizeof(struct pooldesc) );
         if ( NULL != pools )
                     

     // now set up internal structures
     for (i=0; i<num_heaps; i++) {
-        pools[i].pool = heaps[i];
         heaps[i]->get_status( CYG_MEMPOOL_STAT_ARENABASE|
                               CYG_MEMPOOL_STAT_ARENASIZE,
                               stat );

+        if ( stat.arenasize == 0 )
+               continue;
+
+        pools[poolcount].pool = heaps[i];
         CYG_ASSERT( stat.arenabase != (const cyg_uint8 *)-1,
                     "pool returns valid pool base" );
         CYG_CHECK_DATA_PTR( stat.arenabase, "Bad arena location" );
         CYG_ASSERT( stat.arenasize > 0, "pool returns valid pool size" );

-        pools[i].startaddr = stat.arenabase;
-        pools[i].endaddr = stat.arenabase + stat.arenasize;
+        pools[poolcount].startaddr = stat.arenabase;
+        pools[poolcount].endaddr = stat.arenabase + stat.arenasize;
+        poolcount++;
     } // for

+    CYG_ASSERT( poolcount > 0, "No valid memory pools for heap" );
     CYG_REPORT_RETURN();
 } // Cyg_Mempool_Joined<T>::Cyg_Mempool_Joined()


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]