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

Side by Side Diff: src/trusted/platform_qualify/arch/x86/vcpuid.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 /* 7 /*
8 * vcpuid.c 8 * vcpuid.c
9 * 9 *
10 * Verify correctness of CPUID implementation. 10 * Verify correctness of CPUID implementation.
11 * 11 *
12 * This uses shell status code to indicate its result; non-zero return 12 * This uses shell status code to indicate its result; non-zero return
13 * code indicates the CPUID instruction is not implemented or not 13 * code indicates the CPUID instruction is not implemented or not
14 * implemented correctly. 14 * implemented correctly.
15 * 15 *
16 * The asm_ tests use inline assembler, which is not supported on 16 * The asm_ tests use inline assembler, which is not supported on
17 * 64-bit Windows. We use #if to prevent these routines from being 17 * 64-bit Windows. We use #if to prevent these routines from being
18 * provided on 64-bit Windows. 18 * provided on 64-bit Windows.
19 * 19 *
20 * TODO(bradchen): test on a machine with SSE4. 20 * TODO(bradchen): test on a machine with SSE4.
21 */ 21 */
22 #include "native_client/src/include/portability.h" 22 #include "native_client/src/include/portability.h"
23 #include <stdio.h> 23 #include <stdio.h>
24 #include <string.h> 24 #include <string.h>
25 #include <assert.h> 25 #include <assert.h>
26 #include <stdlib.h> 26 #include <stdlib.h>
27 #include <setjmp.h> 27 #include <setjmp.h>
28 #include <signal.h> 28 #include <signal.h>
29 #include "native_client/src/trusted/validator/x86/nacl_cpuid.h" 29 #include "native_client/src/trusted/cpu_features/arch/x86/cpu_x86.h"
30 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h" 30 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h"
31 31
32 /* MAGIC_CONST is a 32 bit constant, somewhat arbitrarily choosen. */ 32 /* MAGIC_CONST is a 32 bit constant, somewhat arbitrarily choosen. */
33 /* The value should be a valid (i.e. not denormal single-precision */ 33 /* The value should be a valid (i.e. not denormal single-precision */
34 /* float; otherwise unexpected FP exceptions are possible. */ 34 /* float; otherwise unexpected FP exceptions are possible. */
35 const int kMagicConst = 0xc01df00d; 35 const int kMagicConst = 0xc01df00d;
36 const int kMagicConst_ROUNDSS = 0xc0000000; 36 const int kMagicConst_ROUNDSS = 0xc0000000;
37 const int kMagicConst_POPCNT = 13; 37 const int kMagicConst_POPCNT = 13;
38 const int kMagicConst_CRC32 = 0xb906c3ea; 38 const int kMagicConst_CRC32 = 0xb906c3ea;
39 39
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 * DoTest(asm_HasE3DNow, "E3DNow"); 553 * DoTest(asm_HasE3DNow, "E3DNow");
554 * what about LZCNT? 554 * what about LZCNT?
555 */ 555 */
556 if (rcode != 0) { 556 if (rcode != 0) {
557 PrintFail("CPUID not implemented correctly."); 557 PrintFail("CPUID not implemented correctly.");
558 return 0; 558 return 0;
559 } 559 }
560 printf("[CPUID implementation looks okay]\n"); 560 printf("[CPUID implementation looks okay]\n");
561 return 1; 561 return 1;
562 } 562 }
OLDNEW
« no previous file with comments | « src/trusted/platform_qualify/arch/x86/platform_qual_test.c ('k') | src/trusted/platform_qualify/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698