<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/common/dlmalloc.c, branch v2016.01-rc4</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>Move initf_malloc() to a common place</title>
<updated>2015-04-23T15:05:53+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2015-02-28T05:06:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=fb5cf7f16be725aec7ab0016268b3b4e26460bee'/>
<id>fb5cf7f16be725aec7ab0016268b3b4e26460bee</id>
<content type='text'>
To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dlmalloc: do memset in malloc init as new default config</title>
<updated>2015-03-09T15:13:28+00:00</updated>
<author>
<name>Przemyslaw Marczak</name>
<email>p.marczak@samsung.com</email>
</author>
<published>2015-03-04T13:01:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0aa8a4ad99954ba48c46c31276ec0f6a5f15211d'/>
<id>0aa8a4ad99954ba48c46c31276ec0f6a5f15211d</id>
<content type='text'>
This commit introduces new config: CONFIG_SYS_MALLOC_CLEAR_ON_INIT.

This config is an expert option and is enabled by default.

The all amount of memory reserved for the malloc, is by default set
to zero in mem_malloc_init(). When the malloc reserved memory exceeds
few MiB, then the boot process can slow down.

So disabling this config, is an expert option to reduce the boot time,
and can be disabled by Kconfig.

Note:
After disable this option, only calloc() will return the pointer
to the zeroed memory area. Previously, without this option,
the memory pointed to untouched malloc memory region, was filled
with zeros. So it means, that code with malloc() calls should
be reexamined.

Signed-off-by: Przemyslaw Marczak &lt;p.marczak@samsung.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit introduces new config: CONFIG_SYS_MALLOC_CLEAR_ON_INIT.

This config is an expert option and is enabled by default.

The all amount of memory reserved for the malloc, is by default set
to zero in mem_malloc_init(). When the malloc reserved memory exceeds
few MiB, then the boot process can slow down.

So disabling this config, is an expert option to reduce the boot time,
and can be disabled by Kconfig.

Note:
After disable this option, only calloc() will return the pointer
to the zeroed memory area. Previously, without this option,
the memory pointed to untouched malloc memory region, was filled
with zeros. So it means, that code with malloc() calls should
be reexamined.

Signed-off-by: Przemyslaw Marczak &lt;p.marczak@samsung.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: Split the simple malloc() implementation into its own file</title>
<updated>2014-11-21T07:12:28+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-11-11T00:16:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c9356be30741b5192c79038fa4f8a2ac5b5f35c1'/>
<id>c9356be30741b5192c79038fa4f8a2ac5b5f35c1</id>
<content type='text'>
The simple malloc() implementation is used when memory is tight. It provides
a simple buffer with an incrementing pointer.

At present the implementation is inside dlmalloc. Move it into its own file
so that it is easier to find.

Rather than using relocation as a signal that the full malloc() is
available, add a special GD_FLG_FULL_MALLOC_INIT flag. This signals that the
simple malloc() should no longer be used.

In some cases, such as SPL, even the code space used by the full malloc() is
wasteful. Add a CONFIG_SYS_MALLOC_SIMPLE option to provide only the simple
malloc. In this case the full malloc is not available at all. It saves about
1KB of code space and about 0.5KB of data on Thumb 2.

Acked-by: Tom Rini &lt;trini@ti.com&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The simple malloc() implementation is used when memory is tight. It provides
a simple buffer with an incrementing pointer.

At present the implementation is inside dlmalloc. Move it into its own file
so that it is easier to find.

Rather than using relocation as a signal that the full malloc() is
available, add a special GD_FLG_FULL_MALLOC_INIT flag. This signals that the
simple malloc() should no longer be used.

In some cases, such as SPL, even the code space used by the full malloc() is
wasteful. Add a CONFIG_SYS_MALLOC_SIMPLE option to provide only the simple
malloc. In this case the full malloc is not available at all. It saves about
1KB of code space and about 0.5KB of data on Thumb 2.

Acked-by: Tom Rini &lt;trini@ti.com&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>malloc: Output region when debugging</title>
<updated>2014-11-12T06:25:42+00:00</updated>
<author>
<name>Thierry Reding</name>
<email>treding@nvidia.com</email>
</author>
<published>2014-08-26T15:34:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=868de51ddee75d65f3ca4235f97900410f424def'/>
<id>868de51ddee75d65f3ca4235f97900410f424def</id>
<content type='text'>
When DEBUG is set, output memory region used for malloc().

Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When DEBUG is set, output memory region used for malloc().

Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dlmalloc: ensure gd is set for early alloc</title>
<updated>2014-11-07T21:27:05+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2014-10-29T22:21:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=854d2b9753e464b7c1add062702565ebdb464119'/>
<id>854d2b9753e464b7c1add062702565ebdb464119</id>
<content type='text'>
Attempting to run the sandbox leads to a segfault, because some dynamic
libraries (outside of u-boot) attempt to use malloc() to allocate memory
before u-boot's gd variable is initialized.

Check for gd not being NULL in the SYS_MALLOC_F_LEN handling, so that
malloc() doesn't crash when called at this point.

 $ gdb -q --args ./u-boot
 (gdb) r
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000412b9b in malloc (bytes=bytes@entry=37) at common/dlmalloc.c:2184
 2184		if (!(gd-&gt;flags &amp; GD_FLG_RELOC)) {
 (gdb) p gd
 $1 = (gd_t *) 0x0
 (gdb) bt
 #0  0x0000000000412b9b in malloc (bytes=bytes@entry=37) at common/dlmalloc.c:2184
 #1  0x00007ffff75bf8e1 in set_binding_values (domainname=0x7ffff11f4f12 "libgpg-error", dirnamep=0x7fffffffe168, codesetp=0x0)
     at bindtextdom.c:228
 #2  0x00007ffff75bfb4c in set_binding_values (codesetp=0x0, dirnamep=0x7fffffffe168, domainname=&lt;optimized out&gt;) at bindtextdom.c:350
 #3  __bindtextdomain (domainname=&lt;optimized out&gt;, dirname=0x7ffff11f4f00 "/usr/share/locale") at bindtextdom.c:348
 #4  0x00007ffff11eca17 in ?? () from /lib/x86_64-linux-gnu/libgpg-error.so.0
 #5  0x00007ffff7dea9fa in call_init (l=&lt;optimized out&gt;, argc=argc@entry=1, argv=argv@entry=0x7fffffffe208,
     env=env@entry=0x7fffffffe218) at dl-init.c:78
 #6  0x00007ffff7deaae3 in call_init (env=0x7fffffffe218, argv=0x7fffffffe208, argc=1, l=&lt;optimized out&gt;) at dl-init.c:36
 #7  _dl_init (main_map=0x7ffff7ffe1a8, argc=1, argv=0x7fffffffe208, env=0x7fffffffe218) at dl-init.c:126
 #8  0x00007ffff7ddd1ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Attempting to run the sandbox leads to a segfault, because some dynamic
libraries (outside of u-boot) attempt to use malloc() to allocate memory
before u-boot's gd variable is initialized.

Check for gd not being NULL in the SYS_MALLOC_F_LEN handling, so that
malloc() doesn't crash when called at this point.

 $ gdb -q --args ./u-boot
 (gdb) r
 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000412b9b in malloc (bytes=bytes@entry=37) at common/dlmalloc.c:2184
 2184		if (!(gd-&gt;flags &amp; GD_FLG_RELOC)) {
 (gdb) p gd
 $1 = (gd_t *) 0x0
 (gdb) bt
 #0  0x0000000000412b9b in malloc (bytes=bytes@entry=37) at common/dlmalloc.c:2184
 #1  0x00007ffff75bf8e1 in set_binding_values (domainname=0x7ffff11f4f12 "libgpg-error", dirnamep=0x7fffffffe168, codesetp=0x0)
     at bindtextdom.c:228
 #2  0x00007ffff75bfb4c in set_binding_values (codesetp=0x0, dirnamep=0x7fffffffe168, domainname=&lt;optimized out&gt;) at bindtextdom.c:350
 #3  __bindtextdomain (domainname=&lt;optimized out&gt;, dirname=0x7ffff11f4f00 "/usr/share/locale") at bindtextdom.c:348
 #4  0x00007ffff11eca17 in ?? () from /lib/x86_64-linux-gnu/libgpg-error.so.0
 #5  0x00007ffff7dea9fa in call_init (l=&lt;optimized out&gt;, argc=argc@entry=1, argv=argv@entry=0x7fffffffe208,
     env=env@entry=0x7fffffffe218) at dl-init.c:78
 #6  0x00007ffff7deaae3 in call_init (env=0x7fffffffe218, argv=0x7fffffffe208, argc=1, l=&lt;optimized out&gt;) at dl-init.c:36
 #7  _dl_init (main_map=0x7ffff7ffe1a8, argc=1, argv=0x7fffffffe208, env=0x7fffffffe218) at dl-init.c:126
 #8  0x00007ffff7ddd1ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sandbox: Always enable malloc debug</title>
<updated>2014-07-23T13:06:17+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-07-11T04:23:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=6d7601e74437f3c915667a829ab722ba5174ec72'/>
<id>6d7601e74437f3c915667a829ab722ba5174ec72</id>
<content type='text'>
Tun on DEBUG in malloc(). This adds code space and slows things down but
for sandbox this is acceptable. We gain the ability to check for memory
leaks in tests.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tun on DEBUG in malloc(). This adds code space and slows things down but
for sandbox this is acceptable. We gain the ability to check for memory
leaks in tests.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a simple malloc() implementation for pre-relocation</title>
<updated>2014-07-23T13:05:40+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-07-11T04:23:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d59476b6446799c21e64147d86483140154c1886'/>
<id>d59476b6446799c21e64147d86483140154c1886</id>
<content type='text'>
If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove form-feeds from dlmalloc.c</title>
<updated>2014-07-23T13:02:58+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-07-11T04:23:25+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d93041a4ca0e421dd2a5683563de10e4694e6394'/>
<id>d93041a4ca0e421dd2a5683563de10e4694e6394</id>
<content type='text'>
These don't really serve any purpose in the modern age. On the other hand
they show up as annoying control characters in my editor, which then happily
removes them.

I believe we can drop these characters from the file.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These don't really serve any purpose in the modern age. On the other hand
they show up as annoying control characters in my editor, which then happily
removes them.

I believe we can drop these characters from the file.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Consolidate bool type</title>
<updated>2013-04-01T20:33:52+00:00</updated>
<author>
<name>York Sun</name>
<email>yorksun@freescale.com</email>
</author>
<published>2013-04-01T18:29:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=472d546054dadacca91530bad42ad06f6408124e'/>
<id>472d546054dadacca91530bad42ad06f6408124e</id>
<content type='text'>
'bool' is defined in random places. This patch consolidates them into a
single header file include/linux/types.h, using stdbool.h introduced in C99.

All other #define, typedef and enum are removed. They are all consistent with
true = 1, false = 0.

Replace FALSE, False with false. Replace TRUE, True with true.
Skip *.py, *.php, lib/* files.

Signed-off-by: York Sun &lt;yorksun@freescale.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
'bool' is defined in random places. This patch consolidates them into a
single header file include/linux/types.h, using stdbool.h introduced in C99.

All other #define, typedef and enum are removed. They are all consistent with
true = 1, false = 0.

Replace FALSE, False with false. Replace TRUE, True with true.
Skip *.py, *.php, lib/* files.

Signed-off-by: York Sun &lt;yorksun@freescale.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>malloc: make malloc_bin_reloc static</title>
<updated>2013-02-19T22:01:26+00:00</updated>
<author>
<name>Gabor Juhos</name>
<email>juhosg@openwrt.org</email>
</author>
<published>2013-01-21T21:10:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7b395232da84ae59bd32985bf944a0a9f417a543'/>
<id>7b395232da84ae59bd32985bf944a0a9f417a543</id>
<content type='text'>
On architectures where manual relocation
is needed, the 'malloc_bin_reloc' function
must be called after 'mem_malloc_init'.

Make the 'malloc_bin_reloc' function static
and call it directly from 'mem_malloc_init'
instead of calling that from board_init_{r,f}
functions of the affected architectures.

Signed-off-by: Gabor Juhos &lt;juhosg@openwrt.org&gt;
Cc: Wolfgang Denk &lt;wd@denx.de&gt;
Cc: Andreas Bießmann &lt;andreas.devel@gmail.com&gt;
Cc: Jason Jin &lt;Jason.jin@freescale.com&gt;
Cc: Macpaul Lin &lt;macpaul@andestech.com&gt;
Cc: Daniel Hellstrom &lt;daniel@gaisler.com&gt;
Cc: Daniel Schwierzeck &lt;daniel.schwierzeck@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On architectures where manual relocation
is needed, the 'malloc_bin_reloc' function
must be called after 'mem_malloc_init'.

Make the 'malloc_bin_reloc' function static
and call it directly from 'mem_malloc_init'
instead of calling that from board_init_{r,f}
functions of the affected architectures.

Signed-off-by: Gabor Juhos &lt;juhosg@openwrt.org&gt;
Cc: Wolfgang Denk &lt;wd@denx.de&gt;
Cc: Andreas Bießmann &lt;andreas.devel@gmail.com&gt;
Cc: Jason Jin &lt;Jason.jin@freescale.com&gt;
Cc: Macpaul Lin &lt;macpaul@andestech.com&gt;
Cc: Daniel Hellstrom &lt;daniel@gaisler.com&gt;
Cc: Daniel Schwierzeck &lt;daniel.schwierzeck@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
