1 |
27 |
unneback |
# ====================================================================
|
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 |
|
|
include_dir cyg/memalloc
|
58 |
|
|
compile dlmalloc.cxx memfixed.cxx memvar.cxx \
|
59 |
|
|
sepmeta.cxx
|
60 |
|
|
|
61 |
|
|
# ====================================================================
|
62 |
|
|
|
63 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATORS {
|
64 |
|
|
display "Memory allocator implementations"
|
65 |
|
|
flavor none
|
66 |
|
|
no_define
|
67 |
|
|
description "
|
68 |
|
|
This component contains configuration options related to the
|
69 |
|
|
various memory allocators available."
|
70 |
|
|
|
71 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_FIXED {
|
72 |
|
|
display "Fixed block allocator"
|
73 |
|
|
flavor none
|
74 |
|
|
no_define
|
75 |
|
|
description "
|
76 |
|
|
This component contains configuration options related to the
|
77 |
|
|
fixed block memory allocator."
|
78 |
|
|
|
79 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE {
|
80 |
|
|
display "Make thread safe"
|
81 |
|
|
active_if CYGPKG_KERNEL
|
82 |
|
|
default_value 1
|
83 |
|
|
description "
|
84 |
|
|
With this option enabled, this allocator will be
|
85 |
|
|
made thread-safe. Additionally allocation functions
|
86 |
|
|
are made available that allow a thread to wait
|
87 |
|
|
until memory is available."
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_VARIABLE {
|
92 |
|
|
display "Simple variable block allocator"
|
93 |
|
|
flavor none
|
94 |
|
|
no_define
|
95 |
|
|
description "
|
96 |
|
|
This component contains configuration options related to the
|
97 |
|
|
simple variable block memory allocator. This allocator is not
|
98 |
|
|
very fast, and in particular does not scale well with large
|
99 |
|
|
numbers of allocations. It is however very compact in terms of
|
100 |
|
|
code size and does not have very much overhead per allocation."
|
101 |
|
|
|
102 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE {
|
103 |
|
|
display "Make thread safe"
|
104 |
|
|
active_if CYGPKG_KERNEL
|
105 |
|
|
default_value 1
|
106 |
|
|
description "
|
107 |
|
|
With this option enabled, this allocator will be
|
108 |
|
|
made thread-safe. Additionally allocation functions
|
109 |
|
|
are added that allow a thread to wait until memory
|
110 |
|
|
are made available that allow a thread to wait
|
111 |
|
|
until memory is available."
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE {
|
115 |
|
|
display "Coalesce memory"
|
116 |
|
|
default_value 1
|
117 |
|
|
description "
|
118 |
|
|
The variable-block memory allocator can perform coalescing
|
119 |
|
|
of memory whenever the application code releases memory back
|
120 |
|
|
to the pool. This coalescing reduces the possibility of
|
121 |
|
|
memory fragmentation problems, but involves extra code and
|
122 |
|
|
processor cycles."
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_DLMALLOC {
|
127 |
|
|
display "Doug Lea's malloc"
|
128 |
|
|
flavor none
|
129 |
|
|
description "
|
130 |
|
|
This component contains configuration options related to the
|
131 |
|
|
port of Doug Lea's memory allocator, normally known as
|
132 |
|
|
dlmalloc. dlmalloc has a reputation for being both fast
|
133 |
|
|
and space-conserving, as well as resisting fragmentation well.
|
134 |
|
|
It is a common choice for a general purpose allocator and
|
135 |
|
|
has been used in both newlib and Linux glibc."
|
136 |
|
|
|
137 |
|
|
cdl_option CYGDBG_MEMALLOC_ALLOCATOR_DLMALLOC_DEBUG {
|
138 |
|
|
display "Debug build"
|
139 |
|
|
requires CYGDBG_USE_ASSERTS
|
140 |
|
|
default_value { 0 != CYGDBG_USE_ASSERTS }
|
141 |
|
|
description "
|
142 |
|
|
Doug Lea's malloc implementation has substantial amounts
|
143 |
|
|
of internal checking in order to verify the operation
|
144 |
|
|
and consistency of the allocator. However this imposes
|
145 |
|
|
substantial overhead on each operation. Therefore this
|
146 |
|
|
checking may be individually disabled."
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_THREADAWARE {
|
150 |
|
|
display "Make thread safe"
|
151 |
|
|
active_if CYGPKG_KERNEL
|
152 |
|
|
requires CYGPKG_KERNEL
|
153 |
|
|
default_value 1
|
154 |
|
|
description "
|
155 |
|
|
With this option enabled, this allocator will be
|
156 |
|
|
made thread-safe. Additionally allocation functions
|
157 |
|
|
are made available that allow a thread to wait
|
158 |
|
|
until memory is available."
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_SAFE_MULTIPLE {
|
162 |
|
|
display "Support more than one instance"
|
163 |
|
|
default_value 1
|
164 |
|
|
description "
|
165 |
|
|
Having this option disabled allows important
|
166 |
|
|
implementation structures to be declared as a single
|
167 |
|
|
static instance, allowing faster access. However this
|
168 |
|
|
would fail if there is more than one instance of
|
169 |
|
|
the dlmalloc allocator class. Therefore this option can
|
170 |
|
|
be enabled if multiple instances are required. Note: as
|
171 |
|
|
a special case, if this allocator is used as the
|
172 |
|
|
implementation of malloc, and it can be determined there
|
173 |
|
|
is more than one malloc pool, then this option will be
|
174 |
|
|
silently enabled."
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY {
|
178 |
|
|
display "Use system memcpy() and memset()"
|
179 |
|
|
requires CYGPKG_ISOINFRA
|
180 |
|
|
default_value { 0 != CYGPKG_ISOINFRA }
|
181 |
|
|
description "
|
182 |
|
|
This may be used to control whether memset() and memcpy()
|
183 |
|
|
are used within the implementation. The alternative is
|
184 |
|
|
to use some macro equivalents, which some people report
|
185 |
|
|
are faster in some circumstances."
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_SEPMETA {
|
190 |
|
|
display "Variable block allocator with separate metadata"
|
191 |
|
|
flavor none
|
192 |
|
|
no_define
|
193 |
|
|
description "
|
194 |
|
|
This component contains configuration options related to the
|
195 |
|
|
variable block memory allocator with separate metadata."
|
196 |
|
|
|
197 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_SEPMETA_THREADAWARE {
|
198 |
|
|
display "Make thread safe"
|
199 |
|
|
active_if CYGPKG_KERNEL
|
200 |
|
|
default_value 1
|
201 |
|
|
description "
|
202 |
|
|
With this option enabled, this allocator will be
|
203 |
|
|
made thread-safe. Additionally allocation functions
|
204 |
|
|
are made available that allow a thread to wait
|
205 |
|
|
until memory is available."
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
cdl_option CYGFUN_MEMALLOC_KAPI {
|
211 |
|
|
display "Kernel C API support for memory allocation"
|
212 |
|
|
active_if CYGPKG_KERNEL
|
213 |
|
|
default_value CYGFUN_KERNEL_API_C
|
214 |
|
|
description "
|
215 |
|
|
This option must be enabled to provide the extensions required
|
216 |
|
|
to support integration into the kernel C API."
|
217 |
|
|
compile kapi.cxx
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
cdl_option CYGSEM_MEMALLOC_MALLOC_ZERO_RETURNS_NULL {
|
221 |
|
|
display "malloc(0) returns NULL"
|
222 |
|
|
default_value 0
|
223 |
|
|
description "
|
224 |
|
|
This option controls the behavior of malloc(0) ( or calloc with
|
225 |
|
|
either argument 0 ). It is permitted by the standard to return
|
226 |
|
|
either a NULL pointer or a unique pointer. Enabling this option
|
227 |
|
|
forces a NULL pointer to be returned."
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
cdl_component CYGPKG_MEMALLOC_MALLOC_ALLOCATORS {
|
231 |
|
|
display "malloc() and supporting allocators"
|
232 |
|
|
flavor bool
|
233 |
|
|
active_if CYGPKG_ISOINFRA
|
234 |
|
|
implements CYGINT_ISO_MALLOC
|
235 |
|
|
implements CYGINT_ISO_MALLINFO
|
236 |
|
|
default_value 1
|
237 |
|
|
compile malloc.cxx
|
238 |
|
|
description "
|
239 |
|
|
This component enables support for dynamic memory
|
240 |
|
|
allocation as supplied by the functions malloc(),
|
241 |
|
|
free(), calloc() and realloc(). As these
|
242 |
|
|
functions are often used, but can have quite an
|
243 |
|
|
overhead, disabling them here can ensure they
|
244 |
|
|
cannot even be used accidentally when static
|
245 |
|
|
allocation is preferred. Within this component are
|
246 |
|
|
various allocators that can be selected for use
|
247 |
|
|
as the underlying implementation of the dynamic
|
248 |
|
|
allocation functions."
|
249 |
|
|
|
250 |
|
|
make -priority 50 {
|
251 |
|
|
heapgeninc.tcl : /src/heapgen.cpp
|
252 |
|
|
$(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,heapgen.tmp -E $< -o $@
|
253 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" heapgen.tmp > $(notdir $@).deps
|
254 |
|
|
@rm heapgen.tmp
|
255 |
|
|
}
|
256 |
|
|
|
257 |
|
|
# FIXME this should have a dependency on mlt_headers, but CDL doesn't
|
258 |
|
|
# permit custom build rules depending on phony targets
|
259 |
|
|
# FIXME we workaround an NT cygtclsh80 bug by cd'ing into the
|
260 |
|
|
# correct dir and running heapgen.tcl from there rather than passing
|
261 |
|
|
# an absolute path.
|
262 |
|
|
make -priority 50 {
|
263 |
|
|
heaps.cxx : heapgeninc.tcl /src/heapgen.tcl
|
264 |
|
|
XPWD=`pwd` ; cd $(REPOSITORY)/$(PACKAGE)/src ; sh heapgen.tcl "$(PREFIX)" "$$XPWD"
|
265 |
|
|
@cp heaps.hxx "$(PREFIX)"/include/pkgconf/heaps.hxx
|
266 |
|
|
@chmod u+w "$(PREFIX)"/include/pkgconf/heaps.hxx
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
make_object {
|
270 |
|
|
heaps.o.d : heaps.cxx
|
271 |
|
|
$(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,heaps.tmp -c -o $(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
272 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" heaps.tmp > $@
|
273 |
|
|
@rm heaps.tmp
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
cdl_component CYGBLD_MEMALLOC_MALLOC_EXTERNAL_HEAP_H {
|
277 |
|
|
display "Use external heap definition"
|
278 |
|
|
flavor booldata
|
279 |
|
|
default_value 0
|
280 |
|
|
description "This option allows other components in the
|
281 |
|
|
system to override the default system
|
282 |
|
|
provision of heap memory pools. This should
|
283 |
|
|
be set to a header which provides the equivalent
|
284 |
|
|
definitions to ."
|
285 |
|
|
}
|
286 |
|
|
|
287 |
|
|
cdl_interface CYGINT_MEMALLOC_MALLOC_ALLOCATORS {
|
288 |
|
|
display "malloc() allocator implementations"
|
289 |
|
|
requires { CYGINT_MEMALLOC_MALLOC_ALLOCATORS == 1 }
|
290 |
|
|
no_define
|
291 |
|
|
}
|
292 |
|
|
|
293 |
|
|
cdl_option CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER {
|
294 |
|
|
display "malloc() implementation instantiation data"
|
295 |
|
|
flavor data
|
296 |
|
|
description "
|
297 |
|
|
Memory allocator implementations that are capable of being
|
298 |
|
|
used underneath malloc() must be instantiated. The code
|
299 |
|
|
to do this is set in this option. It is only intended to
|
300 |
|
|
be set by the implementation, not the user."
|
301 |
|
|
# default corresponds to the default allocator
|
302 |
|
|
default_value {""}
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
cdl_option CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE {
|
306 |
|
|
display "Simple variable block implementation"
|
307 |
|
|
description "This causes malloc() to use the simple
|
308 |
|
|
variable block allocator."
|
309 |
|
|
default_value 0
|
310 |
|
|
implements CYGINT_MEMALLOC_MALLOC_ALLOCATORS
|
311 |
|
|
requires { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
|
312 |
|
|
"" }
|
313 |
|
|
requires CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE
|
314 |
|
|
}
|
315 |
|
|
|
316 |
|
|
cdl_option CYGIMP_MEMALLOC_MALLOC_DLMALLOC {
|
317 |
|
|
display "Doug Lea's malloc implementation"
|
318 |
|
|
description "This causes malloc() to use a version of Doug Lea's
|
319 |
|
|
malloc (dlmalloc) as the underlying implementation."
|
320 |
|
|
default_value 1
|
321 |
|
|
implements CYGINT_MEMALLOC_MALLOC_ALLOCATORS
|
322 |
|
|
requires { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
|
323 |
|
|
"" }
|
324 |
|
|
}
|
325 |
|
|
}
|
326 |
|
|
cdl_option CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE {
|
327 |
|
|
display "Size of the fallback dynamic memory pool in bytes"
|
328 |
|
|
flavor data
|
329 |
|
|
legal_values 32 to 0x7fffffff
|
330 |
|
|
default_value 16384
|
331 |
|
|
description "
|
332 |
|
|
If *no* heaps are configured in your memory layout,
|
333 |
|
|
dynamic memory allocation by
|
334 |
|
|
malloc() and calloc() must be from a fixed-size,
|
335 |
|
|
contiguous memory pool (note here that it is the
|
336 |
|
|
pool that is of a fixed size, but malloc() is still
|
337 |
|
|
able to allocate variable sized chunks of memory
|
338 |
|
|
from it). This option is the size
|
339 |
|
|
of that pool, in bytes. Note that not all of
|
340 |
|
|
this is available for programs to
|
341 |
|
|
use - some is needed for internal information
|
342 |
|
|
about memory regions, and some may be lost to
|
343 |
|
|
ensure that memory allocation only returns
|
344 |
|
|
memory aligned on word (or double word)
|
345 |
|
|
boundaries - a very common architecture
|
346 |
|
|
constraint."
|
347 |
|
|
}
|
348 |
|
|
# ====================================================================
|
349 |
|
|
|
350 |
|
|
cdl_component CYGPKG_MEMALLOC_OPTIONS {
|
351 |
|
|
display "Common memory allocator package build options"
|
352 |
|
|
flavor none
|
353 |
|
|
no_define
|
354 |
|
|
description "
|
355 |
|
|
Package specific build options including control over
|
356 |
|
|
compiler flags used only in building this package,
|
357 |
|
|
and details of which tests are built."
|
358 |
|
|
|
359 |
|
|
cdl_option CYGPKG_MEMALLOC_CFLAGS_ADD {
|
360 |
|
|
display "Additional compiler flags"
|
361 |
|
|
flavor data
|
362 |
|
|
no_define
|
363 |
|
|
default_value { "" }
|
364 |
|
|
description "
|
365 |
|
|
This option modifies the set of compiler flags for
|
366 |
|
|
building this package. These flags are used in addition
|
367 |
|
|
to the set of global flags."
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
cdl_option CYGPKG_MEMALLOC_CFLAGS_REMOVE {
|
371 |
|
|
display "Suppressed compiler flags"
|
372 |
|
|
flavor data
|
373 |
|
|
no_define
|
374 |
|
|
default_value { "" }
|
375 |
|
|
description "
|
376 |
|
|
This option modifies the set of compiler flags for
|
377 |
|
|
building this package. These flags are removed from
|
378 |
|
|
the set of global flags if present."
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
cdl_option CYGPKG_MEMALLOC_TESTS {
|
382 |
|
|
display "Tests"
|
383 |
|
|
flavor data
|
384 |
|
|
no_define
|
385 |
|
|
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" }
|
386 |
|
|
description "
|
387 |
|
|
This option specifies the set of tests for this package."
|
388 |
|
|
}
|
389 |
|
|
}
|
390 |
|
|
}
|
391 |
|
|
|
392 |
|
|
# ====================================================================
|
393 |
|
|
# EOF memalloc.cdl
|