From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 05/18] Add a simple version of memalign()
Date: Tue, 12 May 2015 14:55:06 -0600 [thread overview]
Message-ID: <1431464119-21574-6-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1431464119-21574-1-git-send-email-sjg@chromium.org>
This is used when the full malloc() is not available.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Add a new patch for memalign_simple()
common/malloc_simple.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index d445199..9811ab6 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -26,6 +26,20 @@ void *malloc_simple(size_t bytes)
return ptr;
}
+void *memalign_simple(size_t align, size_t bytes)
+{
+ ulong addr, new_ptr;
+ void *ptr;
+
+ addr = ALIGN(gd->malloc_base + gd->malloc_ptr, bytes);
+ new_ptr = addr + bytes;
+ if (new_ptr > gd->malloc_limit)
+ return NULL;
+ ptr = map_sysmem(addr, bytes);
+ gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
+ return ptr;
+}
+
#ifdef CONFIG_SYS_MALLOC_SIMPLE
void *calloc(size_t nmemb, size_t elem_size)
{
--
2.2.0.rc0.207.ga3a616c
next prev parent reply other threads:[~2015-05-12 20:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 20:55 [U-Boot] [PATCH v2 00/18] dm: Introduce device tree support in SPL (for Rockchip) Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 01/18] dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver model Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 02/18] fdt: arm: Drop device tree padding Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 03/18] dts: Disable device tree for SPL on all boards Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 04/18] dm: serial: Don't support CONFIG_CONS_INDEX with device tree Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-05-12 20:55 ` Simon Glass [this message]
2015-06-11 20:19 ` [U-Boot] [PATCH v2 05/18] Add a simple version of memalign() Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 06/18] Remove SPL undefine of CONFIG_OF_CONTROL Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 07/18] mkimage: Display a better list of available image types Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 08/18] fdt: Add a function to remove unused strings from a device tree Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 09/18] fdt: Add fdt_first/next_region() functions Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 10/18] fdt: Add fdtgrep tool Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 11/18] dm: Reduce SPL device tree size Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 12/18] dm: rockchip: Add serial support Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 13/18] rockchip: Bring in RK3288 device tree file includes and bindings Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 14/18] rockchip: Add base SoC files Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 15/18] rockchip: Add basic support for firefly-rk3288 Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 16/18] rockchip: Add the beginnings of an image tool Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 17/18] rockchip: Add a simple README Simon Glass
2015-05-12 20:55 ` [U-Boot] [PATCH v2 18/18] rockchip: Add basic support for jerry Simon Glass
2015-06-04 23:48 ` [U-Boot] [PATCH v2 00/18] dm: Introduce device tree support in SPL (for Rockchip) Simon Glass
2015-06-11 2:50 ` Simon Glass
2015-06-11 12:15 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431464119-21574-6-git-send-email-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox