OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |