]> mj.ucw.cz Git - eval.git/commitdiff
Box: Let 32-/64-bit mode be configurable
authorMartin Mares <mj@ucw.cz>
Mon, 5 Jul 2010 15:18:11 +0000 (17:18 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 5 Jul 2010 15:18:11 +0000 (17:18 +0200)
box/Makefile
box/box.c
box/mk-syscall-table
default.cfg

index b44fe3a4f034d8213bf9ef137ad9ef62da6b6872..c5d6b2a612402c8388ef9abaa8b9e22ed5963cb5 100644 (file)
@@ -4,7 +4,10 @@
 DIRS+=box
 PROGS+=$(o)/box/box
 
-BOX_CFLAGS=-m64 -DCONFIG_BOX_KERNEL_AMD64 #-DCONFIG_BOX_USER_AMD64
+BOX_CFLAGS=
+ifdef CONFIG_BOX_KERNEL_AMD64
+BOX_CFLAGS += -m64
+endif
 
 $(o)/box/box: $(o)/box/box.o
 $(o)/box/box.o: $(o)/box/syscall-table.h
@@ -13,7 +16,7 @@ $(o)/box/box: LDFLAGS+=$(BOX_CFLAGS)
 $(o)/box/box.o: CFLAGS+=$(BOX_CFLAGS)
 
 $(o)/box/syscall-table.h: $(s)/box/mk-syscall-table
-       sh $^ >$@ $(BOX_CFLAGS)
+       sh $^ >$@ $(CFLAGS) $(BOX_CFLAGS)
 
 box-tests: $(addprefix $(o)/box/test-sys,32-int80 64-int80 32-syscall 64-syscall 32-sysenter 64-sysenter)
 
index fb623763141233a5e7668d2e6b5c81ae579d745d..0788ac4b51ec54b3484b054d5b9ac67bef42e06d 100644 (file)
--- a/box/box.c
+++ b/box/box.c
@@ -7,6 +7,8 @@
 #define _LARGEFILE64_SOURCE
 #define _GNU_SOURCE
 
+#include "autoconf.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
index ec16571a2d2710a9540dc81bc008905e1689a43f..243980525247dfd0cf1885866ed9f3943bbae8ce 100755 (executable)
@@ -3,6 +3,7 @@ set -e
 echo '/* Syscall table automatically generated by mk-syscall-table */'
 echo
 cat <<FOE |
+#include "autoconf.h"
 #if defined(CONFIG_BOX_KERNEL_AMD64) && !defined(CONFIG_BOX_USER_AMD64)
 #include <asm/unistd_32.h>
 #else
index 6e35e176851f4eb2b483339cbc577011a9437d9b..7df097815229b9b3214701b31a64921100917894 100644 (file)
@@ -6,6 +6,11 @@ Set("CONFIG_SUBMIT" => 1);
 # Build MO-P contest environment
 Set("CONFIG_MOP" => 1);
 
+# If you are running a 64-bit Linux kernel, you need to build a 64-bit
+# sandbox and decide whether your userspace is 32- or 64-bit.
+Set("CONFIG_BOX_KERNEL_AMD64" => 1);
+#Set("CONFIG_BOX_USER_AMD64" => 1);
+
 # Settings of libucw
 UnSet("CONFIG_SHARED");
 UnSet("CONFIG_UCW_THREADS");