Debugging: Add code to print backtrace for guest on SIGSEGV
[nativeclient.git] / ncv / nacl_cpuid_test.c
blob025839bbfc3c8f508fff64222bdabae22f321418
1 /*
2 * Copyright 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * nacl_cpuid_test.c
34 * test main and subroutines for nacl_cpuid
36 #include "native_client/include/portability.h"
37 #include <stdio.h>
38 #include <string.h>
39 #include <stdlib.h>
40 #include "native_client/ncv/nacl_cpuid.h"
42 int main(int argc, char *argv[]) {
43 CPUFeatures fv;
45 GetCPUFeatures(&fv);
46 if (fv.f_386) printf("This is a 386 compatible computer\n");
48 printf("This processor has:\n");
49 if (fv.f_x87) printf(" x87\n");
50 if (fv.f_MMX) printf(" MMX\n");
51 if (fv.f_SSE) printf(" SSE\n");
52 if (fv.f_SSE2) printf(" SSE2\n");
53 if (fv.f_SSE3) printf(" SSE3\n");
54 if (fv.f_SSSE3) printf(" SSSE3\n");
55 if (fv.f_SSE41) printf(" SSE41\n");
56 if (fv.f_SSE42) printf(" SSE42\n");
57 if (fv.f_MOVBE) printf(" MOVBE\n");
58 if (fv.f_POPCNT) printf(" POPCNT\n");
59 if (fv.f_CX8) printf(" CX8\n");
60 if (fv.f_CX16) printf(" CX16\n");
61 if (fv.f_CMOV) printf(" CMOV\n");
62 if (fv.f_MON) printf(" MON\n");
63 if (fv.f_FXSR) printf(" FXSR\n");
64 if (fv.f_CFLUSH) printf(" CFLUSH\n");
65 if (fv.f_TSC) printf(" TSC\n");
66 /* These instructions are illegal but included for completeness */
67 if (fv.f_MSR) printf(" MSR\n");
68 if (fv.f_VME) printf(" VME\n");
69 if (fv.f_PSN) printf(" PSN\n");
70 if (fv.f_VMX) printf(" VMX\n");
71 /* AMD-specific features */
72 if (fv.f_3DNOW) printf(" 3DNOW\n");
73 if (fv.f_EMMX) printf(" EMMX\n");
74 if (fv.f_E3DNOW) printf(" E3DNOW\n");
75 if (fv.f_LZCNT) printf(" LZCNT\n");
76 if (fv.f_SSE4A) printf(" SSE4A\n");
77 if (fv.f_LM) printf(" LM\n");
78 if (fv.f_SVM) printf(" SVM\n");
80 return 0;