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

Side by Side Diff: src/trusted/cpu_features/arch/mips/cpu_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 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_mips/cpuid_mips.h" 10 #include "native_client/src/trusted/cpu_features/arch/mips/cpu_mips.h"
11 11
12 12
13 void NaClSetAllCPUFeaturesMips(NaClCPUFeatures *f) { 13 void NaClSetAllCPUFeaturesMips(NaClCPUFeatures *f) {
14 /* TODO(jfb) Use a safe cast in this interface. */ 14 /* TODO(jfb) Use a safe cast in this interface. */
15 NaClCPUFeaturesMips *features = (NaClCPUFeaturesMips *) f; 15 NaClCPUFeaturesMips *features = (NaClCPUFeaturesMips *) 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 NaClClearCPUFeaturesMips(features); 19 NaClClearCPUFeaturesMips(features);
20 for (id = 0; id < NaClCPUFeatureMips_Max; ++id) { 20 for (id = 0; id < NaClCPUFeatureMips_Max; ++id) {
21 NaClSetCPUFeatureMips(features, id, 1); 21 NaClSetCPUFeatureMips(features, id, 1);
22 } 22 }
23 } 23 }
24 24
25 void NaClGetCurrentCPUFeaturesMips(NaClCPUFeatures *f) { 25 void NaClGetCurrentCPUFeaturesMips(NaClCPUFeatures *f) {
26 /* TODO(jfb) Use a safe cast in this interface. */ 26 /* TODO(jfb) Use a safe cast in this interface. */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void NaClSetCPUFeatureMips(NaClCPUFeaturesMips *f, NaClCPUFeatureMipsID id, 61 void NaClSetCPUFeatureMips(NaClCPUFeaturesMips *f, NaClCPUFeatureMipsID id,
62 int state) { 62 int state) {
63 f->data[id] = (char) state; 63 f->data[id] = (char) state;
64 } 64 }
65 65
66 const char *NaClGetCPUFeatureMipsName(NaClCPUFeatureMipsID id) { 66 const char *NaClGetCPUFeatureMipsName(NaClCPUFeatureMipsID id) {
67 static const char *kFeatureMipsNames[NaClCPUFeatureMips_Max] = { 67 static const char *kFeatureMipsNames[NaClCPUFeatureMips_Max] = {
68 # define NACL_MIPS_CPU_FEATURE(name) NACL_TO_STRING(name), 68 # define NACL_MIPS_CPU_FEATURE(name) NACL_TO_STRING(name),
69 # include "native_client/src/trusted/validator_mips/cpuid_mips_features.h" 69 # include "native_client/src/trusted/cpu_features/arch/mips/cpu_mips_features.h"
70 # undef NACL_MIPS_CPU_FEATURE 70 # undef NACL_MIPS_CPU_FEATURE
71 }; 71 };
72 return ((unsigned)id < NaClCPUFeatureMips_Max) ? 72 return ((unsigned)id < NaClCPUFeatureMips_Max) ?
73 kFeatureMipsNames[id] : "INVALID"; 73 kFeatureMipsNames[id] : "INVALID";
74 } 74 }
75 75
76 void NaClClearCPUFeaturesMips(NaClCPUFeaturesMips *features) { 76 void NaClClearCPUFeaturesMips(NaClCPUFeaturesMips *features) {
77 memset(features, 0, sizeof(*features)); 77 memset(features, 0, sizeof(*features));
78 } 78 }
OLDNEW
« no previous file with comments | « src/trusted/cpu_features/arch/mips/cpu_mips.h ('k') | src/trusted/cpu_features/arch/mips/cpu_mips_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698