public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/9] Add a pre-relocation malloc() implementation
@ 2014-07-07 23:19 Simon Glass
  2014-07-07 23:19 ` [U-Boot] [PATCH v2 1/9] Remove form-feeds from dlmalloc.c Simon Glass
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Simon Glass @ 2014-07-07 23:19 UTC (permalink / raw)
  To: u-boot

There has been talk on and off of a pre-relocation malloc() implementation.
Driver model needs this so that it can work before relocation.

A previous implementation was sent in a v1 series.

This implementation works by allocating space on the stack. The benefit is
that boards do not need to specify the address of the malloc() area, only
the size. The down-side is that due to the way board_init_f() is called,
architecture-specific code needs to be used to allocate the space.

No clever algorithms are used to allocate space, free() is a nop and
realloc() is not supported. This fits well with the desire to avoid wasting
space on bucket tables and the hassle of supporting BSS data before
relocation. We don't expect 'churn' in the pre-relocation case - we just
want to allocate small amounts of memory temporarily.

After relocation a new malloc() pool is created and the old one is lost,
although pointers into it will survive the immediate process of relocation.

Implementations are provided for sandbox and arm.

A related change is made to the early init for each arch to make this work.

Changes in v2:
- Tidy up commit message typo

Simon Glass (9):
  Remove form-feeds from dlmalloc.c
  arm: Set up global data before board_init_f()
  sandbox: Set up global data before board_init_f()
  Add a simple malloc() implementation for pre-relocation
  arm: Support pre-relocation malloc()
  exynos: Enable pre-relocation malloc()
  sandbox: Support pre-relocation malloc()
  sandbox: config: Enable pre-relocation malloc()
  sandbox: Always enable malloc debug

 README                            | 16 ++++++++
 arch/arm/include/asm/config.h     |  2 -
 arch/arm/lib/crt0.S               | 11 +++++
 arch/sandbox/cpu/start.c          |  8 ++++
 arch/sandbox/include/asm/config.h |  1 -
 common/board_f.c                  | 12 ++++++
 common/board_r.c                  |  4 ++
 common/dlmalloc.c                 | 85 ++++++++++++++++++++++++++++-----------
 include/asm-generic/global_data.h |  5 +++
 include/configs/exynos5-dt.h      |  4 +-
 include/configs/sandbox.h         |  5 ++-
 lib/asm-offsets.c                 |  3 ++
 12 files changed, 127 insertions(+), 29 deletions(-)

-- 
2.0.0.526.g5318336

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-07-15  3:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 23:19 [U-Boot] [PATCH v2 0/9] Add a pre-relocation malloc() implementation Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 1/9] Remove form-feeds from dlmalloc.c Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 2/9] arm: Set up global data before board_init_f() Simon Glass
2014-07-08 17:13   ` Jeroen Hofstee
2014-07-08 18:41     ` Simon Glass
2014-07-08 20:00       ` Jeroen Hofstee
2014-07-11  4:16         ` Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 3/9] sandbox: " Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 4/9] Add a simple malloc() implementation for pre-relocation Simon Glass
2014-07-15  3:08   ` Graeme Russ
2014-07-07 23:19 ` [U-Boot] [PATCH v2 5/9] arm: Support pre-relocation malloc() Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 6/9] exynos: Enable " Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 7/9] sandbox: Support " Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 8/9] sandbox: config: Enable " Simon Glass
2014-07-07 23:19 ` [U-Boot] [PATCH v2 9/9] sandbox: Always enable malloc debug Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox