summaryrefslogtreecommitdiffstats
path: root/arch/sandbox
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-07 12:03:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-07 12:03:13 +0100
commit0ee6847f7b6d396d3756f6ecd0781a00b9cca980 (patch)
tree1f1bed639ac0bbc9091685538c791b4648f4c342 /arch/sandbox
parent61b62f6d33d55c9b89ba8a6fbae84cb9c33e342a (diff)
parent8b3d10265da20b8be6138799cee704d53dee1c63 (diff)
downloadbarebox-0ee6847f7b6d396d3756f6ecd0781a00b9cca980.tar.gz
barebox-0ee6847f7b6d396d3756f6ecd0781a00b9cca980.tar.xz
Merge branch 'next'
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/Makefile13
-rw-r--r--arch/sandbox/board/barebox.lds.S5
-rw-r--r--arch/sandbox/include/asm/elf.h11
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/linux.h2
-rw-r--r--arch/sandbox/os/common.c32
5 files changed, 40 insertions, 23 deletions
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index b88f1f60f8..9fd18a23b5 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -36,19 +36,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/s390x/s390/ -e s/parisc64/parisc/ \
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
-ifeq ($(SUBARCH),x86_64)
-ELF_CLASS := ELFCLASS64
-endif
-ifeq ($(SUBARCH),i386)
-ELF_CLASS := ELFCLASS32
-endif
-ifeq ($(SUBARCH),powerpc)
-ELF_CLASS := ELFCLASS32
-endif
-
-CPPFLAGS += -DELF_CLASS="$(ELF_CLASS)"
-export ELF_CLASS
-
archprepare: maketools
PHONY += maketools
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index 76975eea63..db5b7deb23 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -8,6 +8,11 @@ SECTIONS
__barebox_initcalls_end = .;
. = ALIGN(64);
+ __barebox_magicvar_start = .;
+ .barebox_magicvar : { BAREBOX_MAGICVARS }
+ __barebox_magicvar_end = .;
+
+ . = ALIGN(64);
__barebox_cmd_start = .;
__barebox_cmd : { BAREBOX_CMDS }
__barebox_cmd_end = .;
diff --git a/arch/sandbox/include/asm/elf.h b/arch/sandbox/include/asm/elf.h
index b60d24890c..3939336ccb 100644
--- a/arch/sandbox/include/asm/elf.h
+++ b/arch/sandbox/include/asm/elf.h
@@ -1,2 +1,11 @@
+#ifndef __ASM_SANDBOX_ELF_H__
+#define __ASM_SANDBOX_ELF_H__
-/* nothing yet */
+#if __SIZEOF_POINTER__ == 8
+#define ELF_CLASS ELFCLASS64
+#define CONFIG_PHYS_ADDR_T_64BIT
+#else
+#define ELF_CLASS ELFCLASS32
+#endif
+
+#endif /* __ASM_SANDBOX_ELF_H__ */
diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index 7c2386d247..5917fe93de 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -10,6 +10,8 @@ ssize_t linux_write(int fd, const void *buf, size_t count);
off_t linux_lseek(int fildes, off_t offset);
int linux_tstc(int fd);
+int linux_execve(const char * filename, char *const argv[], char *const envp[]);
+
int barebox_register_console(char *name_template, int stdinfd, int stdoutfd);
struct linux_console_data {
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 5074a06c80..92b7dbb2c7 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -45,6 +45,7 @@
#include <errno.h>
#include <signal.h>
#include <sys/select.h>
+#include <sys/wait.h>
/*
* ...except the ones needed to connect with barebox
*/
@@ -124,14 +125,6 @@ void __attribute__((noreturn)) reset_cpu(unsigned long addr)
exit(0);
}
-void enable_interrupts(void)
-{
-}
-
-void disable_interrupt(void)
-{
-}
-
int linux_read(int fd, void *buf, size_t count)
{
ssize_t ret;
@@ -193,6 +186,27 @@ off_t linux_lseek(int fd, off_t offset)
return lseek(fd, offset, SEEK_SET);
}
+int linux_execve(const char * filename, char *const argv[], char *const envp[])
+{
+ pid_t pid, tpid;
+ int execve_status;
+
+ pid = fork();
+
+ if (pid == -1) {
+ perror("linux_execve");
+ return pid;
+ } else if (pid == 0) {
+ exit(execve(filename, argv, envp));
+ } else {
+ do {
+ tpid = wait(&execve_status);
+ } while(tpid != pid);
+
+ return execve_status;
+ }
+}
+
extern void start_barebox(void);
extern void mem_malloc_init(void *start, void *end);
@@ -270,7 +284,7 @@ int main(int argc, char *argv[])
printf("unable to get malloc space\n");
exit(1);
}
- mem_malloc_init(ram, ram + malloc_size);
+ mem_malloc_init(ram, ram + malloc_size - 1);
while (1) {
int option_index = 0;