Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: runtime/vm/cpuinfo_openbsd.cc

Issue 1559053002: Refs #10260 OpenBSD support #25327 Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review issues Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/atomic_openbsd.h ('k') | runtime/vm/debuginfo_openbsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/cpuinfo_openbsd.cc
diff --git a/runtime/vm/cpuinfo_win.cc b/runtime/vm/cpuinfo_openbsd.cc
similarity index 64%
copy from runtime/vm/cpuinfo_win.cc
copy to runtime/vm/cpuinfo_openbsd.cc
index b648566c5d8799fb04c1e134598bdcb408d443ce..963997a1eb8ea3879c40d35007613c18f775445e 100644
--- a/runtime/vm/cpuinfo_win.cc
+++ b/runtime/vm/cpuinfo_openbsd.cc
@@ -1,17 +1,13 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/globals.h"
-#if defined(TARGET_OS_WINDOWS)
+#if defined(TARGET_OS_OPENBSD)
#include "vm/cpuinfo.h"
#include "vm/cpuid.h"
-// __cpuid()
-#include <intrin.h> // NOLINT
-#include <string.h> // NOLINT
-
#include "platform/assert.h"
namespace dart {
@@ -20,15 +16,12 @@ CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
void CpuInfo::InitOnce() {
+ fields_[kCpuInfoProcessor] = "vendor_id";
+ fields_[kCpuInfoModel] = "model name";
+ fields_[kCpuInfoHardware] = "model name";
+ fields_[kCpuInfoFeatures] = "flags";
method_ = kCpuInfoCpuId;
-
- // Initialize the CpuId information.
CpuId::InitOnce();
-
- fields_[kCpuInfoProcessor] = "Processor";
- fields_[kCpuInfoModel] = "Hardware";
- fields_[kCpuInfoHardware] = "Hardware";
- fields_[kCpuInfoFeatures] = "Features";
}
@@ -38,14 +31,12 @@ void CpuInfo::Cleanup() {
bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
- ASSERT(method_ != kCpuInfoDefault);
return strstr(CpuId::field(idx), search_string);
}
bool CpuInfo::FieldContainsByString(const char* field,
const char* search_string) {
- ASSERT(method_ != kCpuInfoDefault);
for (int i = 0; i < kCpuInfoMax; i++) {
if (strcmp(field, fields_[i]) == 0) {
return FieldContains(static_cast<CpuInfoIndices>(i), search_string);
@@ -57,13 +48,11 @@ bool CpuInfo::FieldContainsByString(const char* field,
const char* CpuInfo::ExtractField(CpuInfoIndices idx) {
- ASSERT(method_ != kCpuInfoDefault);
return CpuId::field(idx);
}
const char* CpuInfo::ExtractFieldByString(const char* field) {
- ASSERT(method_ != kCpuInfoDefault);
for (int i = 0; i < kCpuInfoMax; i++) {
if (strcmp(field, fields_[i]) == 0) {
return ExtractField(static_cast<CpuInfoIndices>(i));
@@ -75,13 +64,12 @@ const char* CpuInfo::ExtractFieldByString(const char* field) {
bool CpuInfo::HasField(const char* field) {
- ASSERT(method_ != kCpuInfoDefault);
return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) ||
- (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
- (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
- (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
+ (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
}
} // namespace dart
-#endif // defined(TARGET_OS_WINDOWS)
+#endif // defined(TARGET_OS_OPENBSD)
« no previous file with comments | « runtime/vm/atomic_openbsd.h ('k') | runtime/vm/debuginfo_openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698