imcplugin: Add launching sel_ldr
[nativeclient.git] / platform_qual_test / platform_qual_test.c
blob1af1a0b2d857efe4fe78430aa9f7521494cda762
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 * platform_qual_test.c
35 * Native Client Platform Qualification Test
37 * This uses shell status code to indicate its result; non-zero return
38 * code indicates the CPUID instruction is not implemented or not
39 * implemented correctly.
41 #include "native_client/include/portability.h"
42 #include <stdio.h>
43 #include <string.h>
44 #include <assert.h>
45 #include <stdlib.h>
46 #include <setjmp.h>
47 #include <signal.h>
48 #include "native_client/ncv/nacl_cpuid.h"
49 #include "native_client/platform_qual_test/nacl_cpuwhitelist.h"
50 #include "native_client/platform_qual_test/nacl_os_qualify.h"
51 #include "native_client/platform_qual_test/vcpuid.h"
53 int main(int argc, char *argv[]) {
54 if (!CPUIDImplIsValid()) return -1;
55 printf("CPUID implementation looks okay\n");
56 if (NaCl_CPUIsBlacklisted()) return -1;
57 printf("CPU is not blacklisted\n");
59 // don't use the white list for now
60 // if (NaCl_CPUIsWhitelisted() == 0) return -1;
61 // printf("CPU is whitelisted\n");
63 if (NaClOsIsSupported() != 1) return -1;
64 printf("OS is supported\n");
65 if (NaClOsRestoresLdt() != 1) return -1;
66 printf("OS restores LDT\n");
68 printf("platform_qual_test: PASS\n");
69 return 0;