From 21899b10850b8ba155b16038fac5dd8d98214842 Mon Sep 17 00:00:00 2001 From: Matthias Weisser Date: Sat, 5 Nov 2011 11:40:34 +0100 Subject: sandbox: Add improved RAM simulation Using mmap to allocate memory from the OS for RAM simulation we can use u-boot own malloc implementation. Tested-by: Simon Glass Signed-off-by: Matthias Weisser Signed-off-by: Mike Frysinger --- arch/sandbox/cpu/os.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/sandbox/cpu') diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index f80faac..b7c3bf5 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -87,3 +88,9 @@ void os_tty_raw(int fd) atexit(os_fd_restore); } + +void *os_malloc(size_t length) +{ + return mmap(NULL, length, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +} -- cgit v1.1