Chromium Code Reviews| Index: components/nacl/renderer/sandbox_isa.cc |
| diff --git a/components/nacl/renderer/sandbox_isa.cc b/components/nacl/renderer/sandbox_isa.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7cd47a48ae43d078c2dc24e45ceb495e5e8e5eba |
| --- /dev/null |
| +++ b/components/nacl/renderer/sandbox_isa.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2014 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. |
| + |
| +// The list of supported ISA strings for x86. See issue: |
| +// http://code.google.com/p/nativeclient/issues/detail?id=1040 for more |
| +// information. Note that these string are to be case-insensitive compared. |
| + |
| +#include "base/logging.h" |
| +#if defined(OS_WIN) && ARCH_CPU_32_BITS |
| +#include "base/win/windows_version.h" |
| +#endif |
| + |
| +const char* const kNexeArchARM = "arm"; |
| +const char* const kNexeArchMIPS = "mips32"; |
| +const char* const kNexeArchX86_32 = "x86-32"; |
| +const char* const kNexeArchX86_64 = "x86-64"; |
| + |
| +namespace nacl { |
| + |
| +const char* GetSandboxISA() { |
| +#if defined(ARCH_CPU_ARM_FAMILY) |
| + return kNexeArchArm; |
| +#elif defined(ARCH_CPU_MIPS_FAMILY) |
| + return kNexeArchMIPS; |
| +#elif defined(ARCH_CPU_X86_FAMILY) |
| + |
| +#if defined(OS_WIN) && ARCH_CPU_32_BITS |
| + // 32-bit Windows build, so we have to determine the OS architecture. |
| + if (base::win::OSInfo::GetInstance()->architecture() == X64_ARCHITECTURE) |
| + return kNexeArchX86_64; |
| + else |
| + return kNexeArchX86_32; |
| +#else |
| + return kNexeArchX86_64; |
|
dmichael (off chromium)
2014/03/11 19:00:16
That doesn't seem right for Linux 32 and possibly
|
| +#endif // defined(OS_WIN) && ARCH_CPU_32_BITS |
| + |
| +#else |
| +#error Architecture not supported. |
| + NOTREACHED(); |
| + return NULL; |
| +#endif |
| +} |
| + |
| +} // namespace nacl |