diff options
author | jln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 00:13:38 +0000 |
---|---|---|
committer | jln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 00:13:38 +0000 |
commit | 6c4badfb401188419ac8bf3a17729e08c72a2cdf (patch) | |
tree | a65e98724ef117616018a21751e2d3bf4a7d092a /sandbox/linux | |
parent | 1fd555bac29e0c828fe90beda3af9274d60eefa1 (diff) | |
download | chromium_src-6c4badfb401188419ac8bf3a17729e08c72a2cdf.zip chromium_src-6c4badfb401188419ac8bf3a17729e08c72a2cdf.tar.gz chromium_src-6c4badfb401188419ac8bf3a17729e08c72a2cdf.tar.bz2 |
Android make sandbox/linux/seccomp-bpf compile on i386
BUG=166704
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/12025004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux')
-rw-r--r-- | sandbox/linux/sandbox_linux.gypi | 18 | ||||
-rw-r--r-- | sandbox/linux/services/android_arm_ucontext.h | 9 | ||||
-rw-r--r-- | sandbox/linux/services/android_i386_ucontext.h | 79 | ||||
-rw-r--r-- | sandbox/linux/services/android_ucontext.h | 4 | ||||
-rw-r--r-- | sandbox/linux/services/android_x86_ucontext.h | 31 |
5 files changed, 99 insertions, 42 deletions
diff --git a/sandbox/linux/sandbox_linux.gypi b/sandbox/linux/sandbox_linux.gypi index a856ca8..2fac989 100644 --- a/sandbox/linux/sandbox_linux.gypi +++ b/sandbox/linux/sandbox_linux.gypi @@ -10,7 +10,7 @@ }, { 'compile_suid_client': 0, }], - ['((OS=="linux" or (OS=="android" and target_arch=="arm")) and ' + ['((OS=="linux" or OS=="android") and ' '(target_arch=="ia32" or target_arch=="x64" or ' 'target_arch=="arm"))', { 'compile_seccomp_bpf': 1, @@ -127,6 +127,7 @@ ], 'dependencies': [ '../base/base.gyp:base', + 'sandbox_services_headers', ], 'include_dirs': [ '../..', @@ -166,6 +167,21 @@ '..', ], }, + { 'target_name': 'sandbox_services_headers', + 'type': 'none', + 'sources': [ + 'services/android_arm_ucontext.h', + 'services/android_ucontext.h', + 'services/android_i386_ucontext.h', + 'services/arm_linux_syscalls.h', + 'services/linux_syscalls.h', + 'services/x86_32_linux_syscalls.h', + 'services/x86_64_linux_syscalls.h', + ], + 'include_dirs': [ + '..', + ], + }, { # We make this its own target so that it does not interfere # with our tests. diff --git a/sandbox/linux/services/android_arm_ucontext.h b/sandbox/linux/services/android_arm_ucontext.h index c4d748e..d1446c6 100644 --- a/sandbox/linux/services/android_arm_ucontext.h +++ b/sandbox/linux/services/android_arm_ucontext.h @@ -11,13 +11,6 @@ // We also need greg_t for the sandbox, include it in this header as well. typedef unsigned long greg_t; -// sigset_t from arch/arm/include/asm/signal.h in the Linux kernel. -typedef struct { - unsigned long sig[64 / 8 / sizeof(long)]; // Always 64 bits (yes we assume - // 8 bits per char). -} android_header_sigset_t; // Change name to avoid collissions if sigset_t - // gets defined in newer Android headers. - //typedef unsigned long sigset_t; typedef struct ucontext { unsigned long uc_flags; @@ -26,7 +19,7 @@ typedef struct ucontext { struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ - int __not_used[32 - (sizeof (android_header_sigset_t) / sizeof (int))]; + int __not_used[32 - (sizeof (sigset_t) / sizeof (int))]; /* Last for extensibility. Eight byte aligned because some coprocessors require eight byte alignment. */ unsigned long uc_regspace[128] __attribute__((__aligned__(8))); diff --git a/sandbox/linux/services/android_i386_ucontext.h b/sandbox/linux/services/android_i386_ucontext.h new file mode 100644 index 0000000..580ac70 --- /dev/null +++ b/sandbox/linux/services/android_i386_ucontext.h @@ -0,0 +1,79 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ +#define SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ + +// We do something compatible with glibc. Hopefully, at some point Android will +// provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. +// This is mostly copied from breakpad (common/android/include/sys/ucontext.h), +// except we do use sigset_t for uc_sigmask instead of a custom type. + +#if !defined(__BIONIC_HAVE_UCONTEXT_T) +#include <asm/sigcontext.h> + +/* 80-bit floating-point register */ +struct _libc_fpreg { + unsigned short significand[4]; + unsigned short exponent; +}; + +/* Simple floating-point state, see FNSTENV instruction */ +struct _libc_fpstate { + unsigned long cw; + unsigned long sw; + unsigned long tag; + unsigned long ipoff; + unsigned long cssel; + unsigned long dataoff; + unsigned long datasel; + struct _libc_fpreg _st[8]; + unsigned long status; +}; + +typedef uint32_t greg_t; + +typedef struct { + uint32_t gregs[19]; + struct _libc_fpstate* fpregs; + uint32_t oldmask; + uint32_t cr2; +} mcontext_t; + +enum { + REG_GS = 0, + REG_FS, + REG_ES, + REG_DS, + REG_EDI, + REG_ESI, + REG_EBP, + REG_ESP, + REG_EBX, + REG_EDX, + REG_ECX, + REG_EAX, + REG_TRAPNO, + REG_ERR, + REG_EIP, + REG_CS, + REG_EFL, + REG_UESP, + REG_SS, +}; + +typedef struct ucontext { + uint32_t uc_flags; + struct ucontext* uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; +} ucontext_t; + +#else +#include <sys/ucontext.h> +#endif // __BIONIC_HAVE_UCONTEXT_T + +#endif // SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ diff --git a/sandbox/linux/services/android_ucontext.h b/sandbox/linux/services/android_ucontext.h index ac683b4..437bbab 100644 --- a/sandbox/linux/services/android_ucontext.h +++ b/sandbox/linux/services/android_ucontext.h @@ -9,8 +9,8 @@ #if defined(__arm__) #include "sandbox/linux/services/android_arm_ucontext.h" -#elif defined(__i386__) || defined(__x86_64__) -#include "sandbox/linux/services/android_x86_ucontext.h" +#elif defined(__i386__) +#include "sandbox/linux/services/android_i386_ucontext.h" #else #error "No support for your architecture in Android header" #endif diff --git a/sandbox/linux/services/android_x86_ucontext.h b/sandbox/linux/services/android_x86_ucontext.h deleted file mode 100644 index a28cd87..0000000 --- a/sandbox/linux/services/android_x86_ucontext.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SANDBOX_LINUX_SERVICES_ANDROID_X86_UCONTEXT_H_ -#define SANDBOX_LINUX_SERVICES_ANDROID_X86_UCONTEXT_H_ - -// This is basically include/uapi/asm-generic/ucontext.h from the Linux kernel. -// In theory, Android libc's could expand the structure for its own internal -// use, but if the libc provides an API that expects this expanded structure, -// __BIONIC_HAVE_UCONTEXT_T should be defined. - -#if !defined(__BIONIC_HAVE_UCONTEXT_T) -#include <asm/sigcontext.h> - -// We also need greg_t for the sandbox, include it in this header as well. -typedef unsigned long greg_t; - -typedef struct ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ -} ucontext_t; - -#else -#include <sys/ucontext.h> -#endif // __BIONIC_HAVE_UCONTEXT_T - -#endif // SANDBOX_LINUX_SERVICES_ANDROID_X86_UCONTEXT_H_ |