summaryrefslogtreecommitdiffstats
path: root/common/malloc_simple.c
Commit message (Collapse)AuthorAgeFilesLines
* malloc_simple: Add a little more debuggingSimon Glass2016-03-171-2/+5
| | | | | | | | Output the pointer returned by each call to malloc(). This can be useful when debugging memory problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* Merge git://git.denx.de/u-boot-x86Tom Rini2015-10-211-0/+4
|\
| * malloc_simple: Add debug() informationSimon Glass2015-10-211-0/+4
| | | | | | | | | | | | | | | | | | It's useful to get a a trace of memory allocations in early init. Add a debug() call to provide that. It can be enabled by adding '#define DEBUG' to the top of the file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | malloc_simple: Add Kconfig option for using only malloc_simple in the SPLHans de Goede2015-10-201-1/+1
|/ | | | | | | | | | | | | | | | | common/dlmalloc.c is quite big, both in .text and .data usage, therefor on some boards the SPL is build to use only malloc_simple.c and not the dlmalloc.c code. This is done in various include/configs/foo.h with the following construct: #ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_MALLOC_SIMPLE #endif This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows selecting this functionality through Kconfig instead. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* malloc_simple: fix malloc_ptr calculationPhilipp Rosenberger2015-09-281-1/+1
| | | | | | | | | The gd->malloc_ptr and the gd->malloc_limit are offsets to gd->malloc_base. But the addr variable contains the absolute address. The new_ptr must be: addr + bytes - gd->malloc_base. Signed-off-by: Philipp Rosenberger <ilu@linutronix.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* malloc_simple: Correct the alignment logic in memalign_simple()Simon Glass2015-08-281-1/+1
| | | | | | | | This should use the align parameter, not bytes. Natural alignment is one use case but should not be the only one supported by this function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* Add a simple version of memalign()Simon Glass2015-06-101-0/+14
| | | | | | This is used when the full malloc() is not available. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Make sure arch-specific map_sysmem() is definedJoe Hershberger2015-04-181-0/+1
| | | | | | | | | | | In the case where the arch defines a custom map_sysmem(), make sure that including just mapmem.h is sufficient to have these functions as they are when the arch does not override it. Also split the non-arch specific functions out of common.h Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* malloc_simple: Return NULL on malloc failure rather then calling panic()Hans de Goede2015-02-121-1/+1
| | | | | | | | | | | | | | | All callers of malloc should already do error checking, and may even be able to continue without the alloc succeeding. Moreover, common/malloc_simple.c is the only user of .rodata.str1.1 in common/built-in.o when building the SPL, triggering this gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303 Causing .rodata to grow with e.g. 0xc21 bytes, nullifying all benefits of using malloc_simple in the first place. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: Split the simple malloc() implementation into its own fileSimon Glass2014-11-211-0/+39
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 <trini@ti.com> Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud