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

Side by Side Diff: src/trusted/cpu_features/arch/arm/cpu_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "native_client/src/shared/platform/nacl_log.h" 9 #include "native_client/src/shared/platform/nacl_log.h"
10 #include "native_client/src/trusted/validator_arm/cpuid_arm.h" 10 #include "native_client/src/trusted/cpu_features/arch/arm/cpu_arm.h"
11 11
12 12
13 void NaClSetAllCPUFeaturesArm(NaClCPUFeatures *f) { 13 void NaClSetAllCPUFeaturesArm(NaClCPUFeatures *f) {
14 /* TODO(jfb) Use a safe cast in this interface. */ 14 /* TODO(jfb) Use a safe cast in this interface. */
15 NaClCPUFeaturesArm *features = (NaClCPUFeaturesArm *) f; 15 NaClCPUFeaturesArm *features = (NaClCPUFeaturesArm *) f;
16 /* Pedantic: avoid using memset, as in x86's nacl_cpuid.c. */ 16 /* Pedantic: avoid using memset, as in x86's cpu_x86.c. */
17 int id; 17 int id;
18 /* Ensure any padding is zeroed. */ 18 /* Ensure any padding is zeroed. */
19 NaClClearCPUFeaturesArm(features); 19 NaClClearCPUFeaturesArm(features);
20 for (id = 0; id < NaClCPUFeatureArm_Max; ++id) { 20 for (id = 0; id < NaClCPUFeatureArm_Max; ++id) {
21 NaClSetCPUFeatureArm(features, id, 1); 21 NaClSetCPUFeatureArm(features, id, 1);
22 } 22 }
23 } 23 }
24 24
25 void NaClGetCurrentCPUFeaturesArm(NaClCPUFeatures *f) { 25 void NaClGetCurrentCPUFeaturesArm(NaClCPUFeatures *f) {
26 /* TODO(jfb) Use a safe cast in this interface. */ 26 /* TODO(jfb) Use a safe cast in this interface. */
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 void NaClSetCPUFeatureArm(NaClCPUFeaturesArm *f, NaClCPUFeatureArmID id, 65 void NaClSetCPUFeatureArm(NaClCPUFeaturesArm *f, NaClCPUFeatureArmID id,
66 int state) { 66 int state) {
67 f->data[id] = (char) state; 67 f->data[id] = (char) state;
68 } 68 }
69 69
70 const char *NaClGetCPUFeatureArmName(NaClCPUFeatureArmID id) { 70 const char *NaClGetCPUFeatureArmName(NaClCPUFeatureArmID id) {
71 static const char *kFeatureArmNames[NaClCPUFeatureArm_Max] = { 71 static const char *kFeatureArmNames[NaClCPUFeatureArm_Max] = {
72 # define NACL_ARM_CPU_FEATURE(name) NACL_TO_STRING(name), 72 # define NACL_ARM_CPU_FEATURE(name) NACL_TO_STRING(name),
73 # include "native_client/src/trusted/validator_arm/cpuid_arm_features.h" 73 # include "native_client/src/trusted/cpu_features/arch/arm/cpu_arm_features.h"
74 # undef NACL_ARM_CPU_FEATURE 74 # undef NACL_ARM_CPU_FEATURE
75 }; 75 };
76 return ((unsigned)id < NaClCPUFeatureArm_Max) ? 76 return ((unsigned)id < NaClCPUFeatureArm_Max) ?
77 kFeatureArmNames[id] : "INVALID"; 77 kFeatureArmNames[id] : "INVALID";
78 } 78 }
79 79
80 void NaClClearCPUFeaturesArm(NaClCPUFeaturesArm *features) { 80 void NaClClearCPUFeaturesArm(NaClCPUFeaturesArm *features) {
81 memset(features, 0, sizeof(*features)); 81 memset(features, 0, sizeof(*features));
82 } 82 }
83 83
84 void NaClCopyCPUFeaturesArm(NaClCPUFeaturesArm *target, 84 void NaClCopyCPUFeaturesArm(NaClCPUFeaturesArm *target,
85 const NaClCPUFeaturesArm *source) { 85 const NaClCPUFeaturesArm *source) {
86 memcpy(target, source, sizeof(*target)); 86 memcpy(target, source, sizeof(*target));
87 } 87 }
OLDNEW
« no previous file with comments | « src/trusted/cpu_features/arch/arm/cpu_arm.h ('k') | src/trusted/cpu_features/arch/arm/cpu_arm_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698