comparison packages/services/memalloc/common/current/src/malloc.cxx @ 2887:22da989aafa4

Add support for memalloc heaps in RedBoot. See ChangeLogs for details.
author nickg
date Thu, 25 Jun 2009 10:30:59 +0000
parents 74dbf4c3f2e1
children 087a81b7ea16
comparison
equal deleted inserted replaced
2886:7c9e64d8c436 2887:22da989aafa4
6 // 6 //
7 //======================================================================== 7 //========================================================================
8 // ####ECOSGPLCOPYRIGHTBEGIN#### 8 // ####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2009 Free Software Foundation, Inc.
12 // 12 //
13 // eCos is free software; you can redistribute it and/or modify it under 13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free 14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later 15 // Software Foundation; either version 2 or (at your option) any later
16 // version. 16 // version.
282 282
283 CYG_REPORT_RETURN(); 283 CYG_REPORT_RETURN();
284 return ret; 284 return ret;
285 } // mallinfo() 285 } // mallinfo()
286 286
287
288 inline void *
289 operator new(size_t size, CYGCLS_MEMALLOC_MALLOC_IMPL *ptr)
290 { return (void *)ptr; };
291
292 externC cyg_bool
293 cyg_memalloc_heap_reinit( cyg_uint8 *base, cyg_uint32 size )
294 {
295 #if CYGMEM_HEAP_COUNT == 0
296 CYGCLS_MEMALLOC_MALLOC_IMPL *m = new(&cyg_memalloc_mallocpool)
297 CYGCLS_MEMALLOC_MALLOC_IMPL( base, size );
298 return true;
299 #elif CYGMEM_HEAP_COUNT == 1
300 cygmem_memalloc_heaps[0] = new(cygmem_memalloc_heaps[0])
301 CYGCLS_MEMALLOC_MALLOC_IMPL( base, size );
302 return true;
303 #else
304 return false;
305 #endif
306 }
307
287 #endif // ifdef CYGPKG_MEMALLOC_MALLOC_ALLOCATORS 308 #endif // ifdef CYGPKG_MEMALLOC_MALLOC_ALLOCATORS
288 309
289 // EOF malloc.cxx 310 // EOF malloc.cxx