]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/services/memalloc/common/v2_0/cdl/memalloc.cdl
5ecf1ea978aa04c6371eae8b06afaff31166c478
[karo-tx-redboot.git] / packages / services / memalloc / common / v2_0 / cdl / memalloc.cdl
1 # ====================================================================
2 #
3 #      memalloc.cdl
4 #
5 #      Dynamic memory allocator services configuration data
6 #
7 # ====================================================================
8 #####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 ##
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
15 ## Software Foundation; either version 2 or (at your option) any later version.
16 ##
17 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 ## for more details.
21 ##
22 ## You should have received a copy of the GNU General Public License along
23 ## with eCos; if not, write to the Free Software Foundation, Inc.,
24 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 ##
26 ## As a special exception, if other files instantiate templates or use macros
27 ## or inline functions from this file, or you compile this file and link it
28 ## with other works to produce a work based on this file, this file does not
29 ## by itself cause the resulting work to be covered by the GNU General Public
30 ## License. However the source code for this file must still be made available
31 ## in accordance with section (3) of the GNU General Public License.
32 ##
33 ## This exception does not invalidate any other reasons why a work based on
34 ## this file might be covered by the GNU General Public License.
35 ##
36 ## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 ## at http://sources.redhat.com/ecos/ecos-license/
38 ## -------------------------------------------
39 #####ECOSGPLCOPYRIGHTEND####
40 # ====================================================================
41 ######DESCRIPTIONBEGIN####
42 #
43 # Author(s):      jlarmour
44 # Contributors:
45 # Date:           2000-06-02
46 #
47 #####DESCRIPTIONEND####
48 #
49 # ====================================================================
50
51 cdl_package CYGPKG_MEMALLOC {
52     display       "Dynamic memory allocation"
53     description   "
54         This package provides memory allocator infrastructure required for
55         dynamic memory allocators, including the ISO standard malloc
56         interface. It also contains some sample implementations."
57     doc           ref/memalloc.html
58     include_dir   cyg/memalloc
59     compile       dlmalloc.cxx memfixed.cxx memvar.cxx \
60                   sepmeta.cxx debug.c
61
62 # ====================================================================
63
64     cdl_component CYGPKG_MEMALLOC_ALLOCATORS {
65         display       "Memory allocator implementations"
66         flavor        none
67         no_define
68         description   "
69             This component contains configuration options related to the 
70             various memory allocators available."
71
72         cdl_component CYGPKG_MEMALLOC_ALLOCATOR_FIXED {
73             display       "Fixed block allocator"
74             flavor        none
75             no_define
76             description   "
77                 This component contains configuration options related to the 
78                 fixed block memory allocator."
79
80             cdl_option CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE {
81                 display        "Make thread safe"
82                 active_if      CYGPKG_KERNEL
83                 default_value  1
84                 description    "
85                     With this option enabled, this allocator will be
86                     made thread-safe. Additionally allocation functions
87                     are made available that allow a thread to wait
88                     until memory is available."
89             }
90         }
91
92         cdl_component CYGPKG_MEMALLOC_ALLOCATOR_VARIABLE {
93             display       "Simple variable block allocator"
94             flavor        none
95             no_define
96             description   "
97                 This component contains configuration options related to the 
98                 simple variable block memory allocator. This allocator is not
99                 very fast, and in particular does not scale well with large
100                 numbers of allocations. It is however very compact in terms of
101                 code size and does not have very much overhead per allocation."
102
103             cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE {
104                 display        "Make thread safe"
105                 active_if      CYGPKG_KERNEL
106                 default_value  1
107                 description    "
108                     With this option enabled, this allocator will be
109                     made thread-safe. Additionally allocation functions
110                     are added that allow a thread to wait until memory
111                     are made available that allow a thread to wait
112                     until memory is available."
113             }
114
115             cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE {
116                 display       "Coalesce memory"
117                 default_value 1
118                 description   "
119                     The variable-block memory allocator can perform coalescing
120                     of memory whenever the application code releases memory back
121                     to the pool. This coalescing reduces the possibility of
122                     memory fragmentation problems, but involves extra code and
123                     processor cycles."
124             }
125         }
126
127         cdl_component CYGPKG_MEMALLOC_ALLOCATOR_DLMALLOC {
128             display       "Doug Lea's malloc"
129             flavor        none
130             description   "
131                 This component contains configuration options related to the 
132                 port of Doug Lea's memory allocator, normally known as
133                 dlmalloc. dlmalloc has a reputation for being both fast
134                 and space-conserving, as well as resisting fragmentation well.
135                 It is a common choice for a general purpose allocator and
136                 has been used in both newlib and Linux glibc."
137
138             cdl_option CYGDBG_MEMALLOC_ALLOCATOR_DLMALLOC_DEBUG {
139                 display       "Debug build"
140                 requires      CYGDBG_USE_ASSERTS
141                 default_value { 0 != CYGDBG_USE_ASSERTS }
142                 description   "
143                     Doug Lea's malloc implementation has substantial amounts
144                     of internal checking in order to verify the operation
145                     and consistency of the allocator. However this imposes
146                     substantial overhead on each operation. Therefore this
147                     checking may be individually disabled."
148             }
149
150             cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_THREADAWARE {
151                 display       "Make thread safe"
152                 active_if     CYGPKG_KERNEL
153                 requires      CYGPKG_KERNEL
154                 default_value 1
155                 description   "
156                     With this option enabled, this allocator will be
157                     made thread-safe. Additionally allocation functions
158                     are made available that allow a thread to wait
159                     until memory is available."
160             }
161         
162             cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_SAFE_MULTIPLE {
163                 display       "Support more than one instance"
164                 default_value 1
165                 description   "
166                     Having this option disabled allows important
167                     implementation structures to be declared as a single
168                     static instance, allowing faster access. However this
169                     would fail if there is more than one instance of
170                     the dlmalloc allocator class. Therefore this option can
171                     be enabled if multiple instances are required. Note: as
172                     a special case, if this allocator is used as the
173                     implementation of malloc, and it can be determined there
174                     is more than one malloc pool, then this option will be
175                     silently enabled."
176             }
177
178            cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY {
179                 display       "Use system memcpy() and memset()"
180                 requires      CYGPKG_ISOINFRA
181                 default_value { 0 != CYGPKG_ISOINFRA }
182                 description   "
183                     This may be used to control whether memset() and memcpy()
184                     are used within the implementation. The alternative is
185                     to use some macro equivalents, which some people report
186                     are faster in some circumstances."
187            }
188
189            cdl_option CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT {
190                 display       "Minimum alignment of allocated blocks"
191                 flavor        data
192                 legal_values  3 to 10
193                 default_value 3
194                 description   "
195                     This option controls the minimum alignment that the
196                     allocated memory blocks are aligned on, specified as
197                     2^N. Note that using large mininum alignments can lead
198                     to excessive memory wastage."
199            }
200         }
201
202         cdl_component CYGPKG_MEMALLOC_ALLOCATOR_SEPMETA {
203             display       "Variable block allocator with separate metadata"
204             flavor        none
205             no_define
206             description   "
207                 This component contains configuration options related to the 
208                 variable block memory allocator with separate metadata."
209
210             cdl_option CYGSEM_MEMALLOC_ALLOCATOR_SEPMETA_THREADAWARE {
211                 display        "Make thread safe"
212                 active_if      CYGPKG_KERNEL
213                 default_value  1
214                 description    "
215                     With this option enabled, this allocator will be
216                     made thread-safe. Additionally allocation functions
217                     are made available that allow a thread to wait
218                     until memory is available."
219             }
220         }
221     }
222
223     cdl_option CYGFUN_MEMALLOC_KAPI {
224         display       "Kernel C API support for memory allocation"
225         active_if     CYGPKG_KERNEL
226         default_value CYGFUN_KERNEL_API_C
227         description   "
228             This option must be enabled to provide the extensions required
229             to support integration into the kernel C API."
230         compile       kapi.cxx
231     }       
232
233     cdl_option CYGSEM_MEMALLOC_MALLOC_ZERO_RETURNS_NULL {
234         display       "malloc(0) returns NULL"
235         default_value 0
236         description   "
237             This option controls the behavior of malloc(0) ( or calloc with
238             either argument 0 ). It is permitted by the standard to return
239             either a NULL pointer or a unique pointer. Enabling this option
240             forces a NULL pointer to be returned."
241     }       
242
243     cdl_option CYGSEM_MEMALLOC_INVOKE_OUT_OF_MEMORY {
244         display       "Breakpoint site when running out of memory"
245         default_value 0
246         description   "
247             Whenever the system runs out of memory, it invokes this function
248             before either going to sleep waiting for memory to become 
249             available or returning failure."
250     }       
251
252     cdl_component CYGPKG_MEMALLOC_MALLOC_ALLOCATORS {
253         display      "malloc() and supporting allocators"
254         flavor        bool
255         active_if     CYGPKG_ISOINFRA
256         implements    CYGINT_ISO_MALLOC
257         implements    CYGINT_ISO_MALLINFO
258         default_value 1
259         compile       malloc.cxx
260         description   "
261             This component enables support for dynamic memory
262             allocation as supplied by the functions malloc(),
263             free(), calloc() and realloc(). As these
264             functions are often used, but can have quite an
265             overhead, disabling them here can ensure they
266             cannot even be used accidentally when static
267             allocation is preferred. Within this component are
268             various allocators that can be selected for use
269             as the underlying implementation of the dynamic
270             allocation functions."
271
272         make -priority 50 {
273             heapgeninc.tcl : <PACKAGE>/src/heapgen.cpp
274             $(CC) $(ACTUAL_CXXFLAGS) $(INCLUDE_PATH) -Wp,-MD,heapgen.tmp -E $< -o $@
275             @sed -e '/^ *\\/d' -e "s#.*: #$@: #" heapgen.tmp > $(notdir $@).deps
276             @rm heapgen.tmp
277         }
278     
279         # FIXME this should have a dependency on mlt_headers, but CDL doesn't
280         # permit custom build rules depending on phony targets
281         # FIXME we workaround an NT cygtclsh80 bug by cd'ing into the
282         # correct dir and running heapgen.tcl from there rather than passing
283         # an absolute path.
284         make -priority 50 {
285             heaps.cxx : heapgeninc.tcl <PACKAGE>/src/heapgen.tcl
286             XPWD=`pwd` ; cd $(REPOSITORY)/$(PACKAGE)/src ; sh heapgen.tcl "$(PREFIX)" "$$XPWD"
287             @cp heaps.hxx "$(PREFIX)"/include/pkgconf/heaps.hxx
288             @chmod u+w "$(PREFIX)"/include/pkgconf/heaps.hxx
289         }
290
291         make_object {
292             heaps.o.d : heaps.cxx
293             $(CC) $(ACTUAL_CXXFLAGS) $(INCLUDE_PATH) -Wp,-MD,heaps.tmp -c -o $(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
294             @sed -e '/^ *\\/d' -e "s#.*: #$@: #" heaps.tmp > $@
295             @rm heaps.tmp
296         }
297
298         cdl_component CYGBLD_MEMALLOC_MALLOC_EXTERNAL_HEAP_H {
299             display       "Use external heap definition"
300             flavor        booldata
301             default_value 0
302             description   "This option allows other components in the
303                            system to override the default system
304                            provision of heap memory pools. This should
305                            be set to a header which provides the equivalent
306                            definitions to <pkgconf/heaps.hxx>."
307         }
308
309         cdl_interface CYGINT_MEMALLOC_MALLOC_ALLOCATORS {
310             display       "malloc() allocator implementations"
311             requires      { CYGINT_MEMALLOC_MALLOC_ALLOCATORS == 1 }
312             no_define
313         }
314
315         cdl_option CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER {
316             display       "malloc() implementation instantiation data"
317             flavor        data
318             description   "
319                 Memory allocator implementations that are capable of being
320                 used underneath malloc() must be instantiated. The code
321                 to do this is set in this option. It is only intended to
322                 be set by the implementation, not the user."
323             # default corresponds to the default allocator
324             default_value {"<cyg/memalloc/dlmalloc.hxx>"}
325         }
326
327         cdl_option CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE {
328             display       "Simple variable block implementation"
329             description   "This causes malloc() to use the simple
330                            variable block allocator."
331             default_value 0
332             implements    CYGINT_MEMALLOC_MALLOC_ALLOCATORS
333             requires      { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
334                             "<cyg/memalloc/memvar.hxx>" }
335             requires      CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE
336         }
337
338         cdl_option CYGIMP_MEMALLOC_MALLOC_DLMALLOC {
339             display       "Doug Lea's malloc implementation"
340             description   "This causes malloc() to use a version of Doug Lea's
341                            malloc (dlmalloc) as the underlying implementation."
342             default_value 1
343             implements    CYGINT_MEMALLOC_MALLOC_ALLOCATORS
344             requires      { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
345                             "<cyg/memalloc/dlmalloc.hxx>" }
346         }
347     }
348     cdl_option CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE {
349         display       "Size of the fallback dynamic memory pool in bytes"
350         flavor        data
351         legal_values  32 to 0x7fffffff
352         default_value 16384
353         description   "
354             If *no* heaps are configured in your memory layout,
355             dynamic memory allocation by
356             malloc() and calloc() must be from a fixed-size,
357             contiguous memory pool (note here that it is the
358             pool that is of a fixed size, but malloc() is still
359             able to allocate variable sized chunks of memory
360             from it). This option is the size
361             of that pool, in bytes. Note that not all of
362             this is available for programs to
363             use - some is needed for internal information
364             about memory regions, and some may be lost to
365             ensure that memory allocation only returns
366             memory aligned on word (or double word)
367             boundaries - a very common architecture
368             constraint."
369     }
370 # ====================================================================
371
372     cdl_component CYGPKG_MEMALLOC_OPTIONS {
373         display "Common memory allocator package build options"
374         flavor  none
375         no_define
376         description   "
377             Package specific build options including control over
378             compiler flags used only in building this package,
379             and details of which tests are built."
380
381         cdl_option CYGPKG_MEMALLOC_CFLAGS_ADD {
382             display "Additional compiler flags"
383             flavor  data
384             no_define
385             default_value { "" }
386             description   "
387                 This option modifies the set of compiler flags for
388                 building this package. These flags are used in addition
389                 to the set of global flags."
390         }
391
392         cdl_option CYGPKG_MEMALLOC_CFLAGS_REMOVE {
393             display "Suppressed compiler flags"
394             flavor  data
395             no_define
396             default_value { "" }
397             description   "
398                 This option modifies the set of compiler flags for
399                 building this package. These flags are removed from
400                 the set of global flags if present."
401         }
402
403         cdl_option CYGPKG_MEMALLOC_TESTS {
404             display "Tests"
405             flavor  data
406             no_define
407             calculated { "tests/dlmalloc1 tests/dlmalloc2 tests/heaptest tests/kmemfix1 tests/kmemvar1 tests/malloc1 tests/malloc2 tests/malloc3 tests/malloc4 tests/memfix1 tests/memfix2 tests/memvar1 tests/memvar2 tests/realloc tests/sepmeta1 tests/sepmeta2" }
408             description   "
409                 This option specifies the set of tests for this package."
410         }
411     }
412 }
413
414 # ====================================================================
415 # EOF memalloc.cdl