Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // The list of supported ISA strings for x86. See issue: | |
|
Mark Seaborn
2014/03/12 18:24:14
Drop "for x86"?
| |
| 6 // http://code.google.com/p/nativeclient/issues/detail?id=1040 for more | |
| 7 // information. Note that these string are to be case-insensitive compared. | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #if defined(OS_WIN) | |
| 11 #include "base/win/windows_version.h" | |
| 12 #endif | |
| 13 | |
| 14 const char* const kNexeArchARM = "arm"; | |
|
Mark Seaborn
2014/03/12 18:24:14
Better to write:
static const char kFoo[] = "...";
| |
| 15 const char* const kNexeArchMIPS = "mips32"; | |
| 16 const char* const kNexeArchX86_32 = "x86-32"; | |
| 17 const char* const kNexeArchX86_64 = "x86-64"; | |
| 18 | |
| 19 namespace nacl { | |
| 20 | |
| 21 const char* GetSandboxISA() { | |
| 22 #if defined(ARCH_CPU_ARM_FAMILY) | |
| 23 return kNexeArchArm; | |
| 24 #elif defined(ARCH_CPU_MIPS_FAMILY) | |
| 25 return kNexeArchMIPS; | |
| 26 #elif defined(ARCH_CPU_X86_FAMILY) | |
| 27 | |
| 28 #if defined(OS_WIN) | |
| 29 // We have to check the host architecture on Windows. | |
| 30 // See sandbox_isa.h for an explanation why. | |
| 31 if (base::win::OSInfo::GetInstance()->architecture() == X64_ARCHITECTURE) | |
| 32 return kNexeArchX86_64; | |
| 33 else | |
| 34 return kNexeArchX86_32; | |
| 35 #elif ARCH_CPU_64_BITS | |
| 36 return kNexeArchX86_64; | |
|
Mark Seaborn
2014/03/12 18:24:14
Reduce indentation by 2
| |
| 37 #else | |
| 38 return kNexeArchX86_32; | |
|
Mark Seaborn
2014/03/12 18:24:14
ditto
| |
| 39 #endif // defined(OS_WIN) | |
| 40 | |
| 41 #else | |
| 42 #error Architecture not supported. | |
| 43 NOTREACHED(); | |
|
Mark Seaborn
2014/03/12 18:24:14
This won't be compiled if you've just #error'd, so
| |
| 44 return NULL; | |
| 45 #endif | |
| 46 } | |
| 47 | |
| 48 } // namespace nacl | |
| OLD | NEW |