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

Unified Diff: src/trusted/validator_mips/cpuid_mips.c

Issue 11864002: Move CPU features into its own static library. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Address bsy's comments by not building x86 target when host isn't x86. This is how things are curre… Created 7 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 | « src/trusted/validator_mips/cpuid_mips.h ('k') | src/trusted/validator_mips/cpuid_mips_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/validator_mips/cpuid_mips.c
diff --git a/src/trusted/validator_mips/cpuid_mips.c b/src/trusted/validator_mips/cpuid_mips.c
deleted file mode 100644
index b5b04a52f83d11da96264a0a6f8676bde13f8e11..0000000000000000000000000000000000000000
--- a/src/trusted/validator_mips/cpuid_mips.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2012 The Native Client Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <string.h>
-
-#include "native_client/src/shared/platform/nacl_log.h"
-#include "native_client/src/trusted/validator_mips/cpuid_mips.h"
-
-
-void NaClSetAllCPUFeaturesMips(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesMips *features = (NaClCPUFeaturesMips *) f;
- /* Pedantic: avoid using memset, as in x86's nacl_cpuid.c. */
- int id;
- /* Ensure any padding is zeroed. */
- NaClClearCPUFeaturesMips(features);
- for (id = 0; id < NaClCPUFeatureMips_Max; ++id) {
- NaClSetCPUFeatureMips(features, id, 1);
- }
-}
-
-void NaClGetCurrentCPUFeaturesMips(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesMips *features = (NaClCPUFeaturesMips *) f;
- features->data[NaClCPUFeatureMips_BOGUS] = 0;
-}
-
-/* This array defines the CPU feature model for fixed-feature CPU mode. */
-static const int kFixedFeatureMipsCPUModel[NaClCPUFeatureMips_Max] = {
- 0 /* NaClCPUFeatureMips_BOGUS */
-};
-
-int NaClFixCPUFeaturesMips(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesMips *features = (NaClCPUFeaturesMips *) f;
- NaClCPUFeatureMipsID fid;
- int rvalue = 1;
-
- for (fid = 0; fid < NaClCPUFeatureMips_Max; fid++) {
- if (kFixedFeatureMipsCPUModel[fid]) {
- if (!NaClGetCPUFeatureMips(features, fid)) {
- /* This CPU is missing a required feature. */
- NaClLog(LOG_ERROR,
- "This CPU is missing a feature required by fixed-mode: %s\n",
- NaClGetCPUFeatureMipsName(fid));
- rvalue = 0; /* set return value to indicate failure */
- }
- } else {
- /* Feature is not in the fixed model.
- * Ensure cpu_features does not have it either.
- */
- NaClSetCPUFeatureMips(features, fid, 0);
- }
- }
- return rvalue;
-}
-
-void NaClSetCPUFeatureMips(NaClCPUFeaturesMips *f, NaClCPUFeatureMipsID id,
- int state) {
- f->data[id] = (char) state;
-}
-
-const char *NaClGetCPUFeatureMipsName(NaClCPUFeatureMipsID id) {
- static const char *kFeatureMipsNames[NaClCPUFeatureMips_Max] = {
-# define NACL_MIPS_CPU_FEATURE(name) NACL_TO_STRING(name),
-# include "native_client/src/trusted/validator_mips/cpuid_mips_features.h"
-# undef NACL_MIPS_CPU_FEATURE
- };
- return ((unsigned)id < NaClCPUFeatureMips_Max) ?
- kFeatureMipsNames[id] : "INVALID";
-}
-
-void NaClClearCPUFeaturesMips(NaClCPUFeaturesMips *features) {
- memset(features, 0, sizeof(*features));
-}
« no previous file with comments | « src/trusted/validator_mips/cpuid_mips.h ('k') | src/trusted/validator_mips/cpuid_mips_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698