OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/cpu.h" | 5 #include "src/base/cpu.h" |
6 | 6 |
7 #if V8_LIBC_MSVCRT | 7 #if V8_LIBC_MSVCRT |
8 #include <intrin.h> // __cpuid() | 8 #include <intrin.h> // __cpuid() |
9 #endif | 9 #endif |
10 #if V8_OS_LINUX | 10 #if V8_OS_LINUX |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // The list is well-known, unlike the the output of | 461 // The list is well-known, unlike the the output of |
462 // the 'Processor' field which can vary greatly. | 462 // the 'Processor' field which can vary greatly. |
463 // See the definition of the 'proc_arch' array in | 463 // See the definition of the 'proc_arch' array in |
464 // $KERNEL/arch/arm/kernel/setup.c and the 'c_show' function in | 464 // $KERNEL/arch/arm/kernel/setup.c and the 'c_show' function in |
465 // same file. | 465 // same file. |
466 char* architecture = cpu_info.ExtractField("CPU architecture"); | 466 char* architecture = cpu_info.ExtractField("CPU architecture"); |
467 if (architecture != NULL) { | 467 if (architecture != NULL) { |
468 char* end; | 468 char* end; |
469 architecture_ = strtol(architecture, &end, 10); | 469 architecture_ = strtol(architecture, &end, 10); |
470 if (end == architecture) { | 470 if (end == architecture) { |
471 architecture_ = 0; | 471 // Kernels older than 3.18 report "CPU architecture: AArch64" on ARMv8. |
| 472 if (strcmp(architecture, "AArch64") == 0) { |
| 473 architecture_ = 8; |
| 474 } else { |
| 475 architecture_ = 0; |
| 476 } |
472 } | 477 } |
473 delete[] architecture; | 478 delete[] architecture; |
474 | 479 |
475 // Unfortunately, it seems that certain ARMv6-based CPUs | 480 // Unfortunately, it seems that certain ARMv6-based CPUs |
476 // report an incorrect architecture number of 7! | 481 // report an incorrect architecture number of 7! |
477 // | 482 // |
478 // See http://code.google.com/p/android/issues/detail?id=10812 | 483 // See http://code.google.com/p/android/issues/detail?id=10812 |
479 // | 484 // |
480 // We try to correct this by looking at the 'elf_platform' | 485 // We try to correct this by looking at the 'elf_platform' |
481 // field reported by the 'Processor' field, which is of the | 486 // field reported by the 'Processor' field, which is of the |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 part_ = PPC_POWER5; | 700 part_ = PPC_POWER5; |
696 break; | 701 break; |
697 } | 702 } |
698 #endif // V8_OS_AIX | 703 #endif // V8_OS_AIX |
699 #endif // !USE_SIMULATOR | 704 #endif // !USE_SIMULATOR |
700 #endif // V8_HOST_ARCH_PPC | 705 #endif // V8_HOST_ARCH_PPC |
701 } | 706 } |
702 | 707 |
703 } // namespace base | 708 } // namespace base |
704 } // namespace v8 | 709 } // namespace v8 |
OLD | NEW |