summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/cpu/os.c
diff options
context:
space:
mode:
authorMatthias Weisser <weisserm@arcor.de>2011-11-05 11:40:34 +0100
committerMike Frysinger <vapier@gentoo.org>2011-12-10 17:54:04 -0500
commit21899b10850b8ba155b16038fac5dd8d98214842 (patch)
tree704f143e00b60eb3a2f405fb3d8870c59b527425 /arch/sandbox/cpu/os.c
parentc90a4dd79cb17abb46689f27ff9f1c971362d6e2 (diff)
downloadtalos-obmc-uboot-21899b10850b8ba155b16038fac5dd8d98214842.tar.gz
talos-obmc-uboot-21899b10850b8ba155b16038fac5dd8d98214842.zip
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 <sjg@chromium.org> Signed-off-by: Matthias Weisser <weisserm@arcor.de> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r--arch/sandbox/cpu/os.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index f80faac1f5..b7c3bf5f80 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/mman.h>
#include <os.h>
@@ -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);
+}
OpenPOWER on IntegriCloud