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

Side by Side Diff: src/trusted/validator/x86/nacl_cpuid_test.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
« no previous file with comments | « src/trusted/validator/x86/nacl_cpuid.c ('k') | src/trusted/validator/x86/nacl_xgetbv.S » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 #ifndef NACL_TRUSTED_BUT_NOT_TCB
8 #error("This file is not meant for use in the TCB")
9 #endif
10
11 /*
12 * nacl_cpuid_test.c
13 * test main and subroutines for nacl_cpuid
14 */
15 #include "native_client/src/include/portability.h"
16 #include <stdio.h>
17 #include "native_client/src/trusted/validator/x86/nacl_cpuid.h"
18
19 int main(int argc, char *argv[]) {
20 NaClCPUFeaturesX86 fv;
21 NaClCPUData cpu_data;
22 int feature_id;
23 NaClCPUDataGet(&cpu_data);
24
25 NaClGetCurrentCPUFeaturesX86((NaClCPUFeatures *) &fv);
26 if (NaClArchSupportedX86(&fv)) {
27 printf("This is a native client %d-bit %s compatible computer\n",
28 NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data));
29 } else {
30 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUIDSupported)) {
31 printf("Computer doesn't support CPUID\n");
32 }
33 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUSupported)) {
34 printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data));
35 }
36 }
37
38 printf("This processor has:\n");
39 for (feature_id = 0; feature_id < NaClCPUFeatureX86_Max; ++feature_id) {
40 if (NaClGetCPUFeatureX86(&fv, feature_id))
41 printf(" %s\n", NaClGetCPUFeatureX86Name(feature_id));
42 }
43 return 0;
44 }
OLDNEW
« no previous file with comments | « src/trusted/validator/x86/nacl_cpuid.c ('k') | src/trusted/validator/x86/nacl_xgetbv.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698