From 84b464bb23734b1d2dbaa4eada95d1282ff664ae Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 5 Jul 2010 17:18:11 +0200 Subject: [PATCH] Box: Let 32-/64-bit mode be configurable --- box/Makefile | 7 +++++-- box/box.c | 2 ++ box/mk-syscall-table | 1 + default.cfg | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/box/Makefile b/box/Makefile index b44fe3a..c5d6b2a 100644 --- a/box/Makefile +++ b/box/Makefile @@ -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) diff --git a/box/box.c b/box/box.c index fb62376..0788ac4 100644 --- a/box/box.c +++ b/box/box.c @@ -7,6 +7,8 @@ #define _LARGEFILE64_SOURCE #define _GNU_SOURCE +#include "autoconf.h" + #include #include #include diff --git a/box/mk-syscall-table b/box/mk-syscall-table index ec16571..2439805 100755 --- a/box/mk-syscall-table +++ b/box/mk-syscall-table @@ -3,6 +3,7 @@ set -e echo '/* Syscall table automatically generated by mk-syscall-table */' echo cat < #else diff --git a/default.cfg b/default.cfg index 6e35e17..7df0978 100644 --- a/default.cfg +++ b/default.cfg @@ -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"); -- 2.39.2