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

Unified Diff: src/trusted/validator_arm/cpuid_arm.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_arm/cpuid_arm.h ('k') | src/trusted/validator_arm/cpuid_arm_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/validator_arm/cpuid_arm.c
diff --git a/src/trusted/validator_arm/cpuid_arm.c b/src/trusted/validator_arm/cpuid_arm.c
deleted file mode 100644
index dc98828bd1f874978cf40b15510067475a2e4c68..0000000000000000000000000000000000000000
--- a/src/trusted/validator_arm/cpuid_arm.c
+++ /dev/null
@@ -1,87 +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_arm/cpuid_arm.h"
-
-
-void NaClSetAllCPUFeaturesArm(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesArm *features = (NaClCPUFeaturesArm *) f;
- /* Pedantic: avoid using memset, as in x86's nacl_cpuid.c. */
- int id;
- /* Ensure any padding is zeroed. */
- NaClClearCPUFeaturesArm(features);
- for (id = 0; id < NaClCPUFeatureArm_Max; ++id) {
- NaClSetCPUFeatureArm(features, id, 1);
- }
-}
-
-void NaClGetCurrentCPUFeaturesArm(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesArm *features = (NaClCPUFeaturesArm *) f;
- /*
- * TODO(jfb) Create a whitelist of CPUs that don't leak information when
- * TST+LDR and TST+STR are used. Disallow all for now.
- */
- NaClSetCPUFeatureArm(features, NaClCPUFeatureArm_CanUseTstMem, 0);
-}
-
-/* This array defines the CPU feature model for fixed-feature CPU mode. */
-static const int kFixedFeatureArmCPUModel[NaClCPUFeatureArm_Max] = {
- 0 /* NaClCPUFeatureArm_CanUseTstMem */
-};
-
-int NaClFixCPUFeaturesArm(NaClCPUFeatures *f) {
- /* TODO(jfb) Use a safe cast in this interface. */
- NaClCPUFeaturesArm *features = (NaClCPUFeaturesArm *) f;
- NaClCPUFeatureArmID fid;
- int rvalue = 1;
-
- for (fid = 0; fid < NaClCPUFeatureArm_Max; fid++) {
- if (kFixedFeatureArmCPUModel[fid]) {
- if (!NaClGetCPUFeatureArm(features, fid)) {
- /* This CPU is missing a required feature. */
- NaClLog(LOG_ERROR,
- "This CPU is missing a feature required by fixed-mode: %s\n",
- NaClGetCPUFeatureArmName(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.
- */
- NaClSetCPUFeatureArm(features, fid, 0);
- }
- }
- return rvalue;
-}
-
-void NaClSetCPUFeatureArm(NaClCPUFeaturesArm *f, NaClCPUFeatureArmID id,
- int state) {
- f->data[id] = (char) state;
-}
-
-const char *NaClGetCPUFeatureArmName(NaClCPUFeatureArmID id) {
- static const char *kFeatureArmNames[NaClCPUFeatureArm_Max] = {
-# define NACL_ARM_CPU_FEATURE(name) NACL_TO_STRING(name),
-# include "native_client/src/trusted/validator_arm/cpuid_arm_features.h"
-# undef NACL_ARM_CPU_FEATURE
- };
- return ((unsigned)id < NaClCPUFeatureArm_Max) ?
- kFeatureArmNames[id] : "INVALID";
-}
-
-void NaClClearCPUFeaturesArm(NaClCPUFeaturesArm *features) {
- memset(features, 0, sizeof(*features));
-}
-
-void NaClCopyCPUFeaturesArm(NaClCPUFeaturesArm *target,
- const NaClCPUFeaturesArm *source) {
- memcpy(target, source, sizeof(*target));
-}
« no previous file with comments | « src/trusted/validator_arm/cpuid_arm.h ('k') | src/trusted/validator_arm/cpuid_arm_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698