OLD | NEW |
| (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 /* | |
8 * Checks that CPU ID features match instructions found in executable. | |
9 * | |
10 * Note: The following functions are used to define a validator function | |
11 * for collecting this information. See header file ncvalidator_iter.h | |
12 * for more information on how to register these functions as a validator | |
13 * function. | |
14 */ | |
15 | |
16 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_NC_CPU_CHECKS_H__ | |
17 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_NC_CPU_CHECKS_H__ | |
18 | |
19 #include "native_client/src/shared/utils/types.h" | |
20 #include "native_client/src/trusted/cpu_features/arch/x86/cpu_x86.h" | |
21 | |
22 /* Defines a validator state. */ | |
23 struct NaClValidatorState; | |
24 | |
25 /* Defines an instruction iterator that processes a code segment. */ | |
26 struct NaClInstIter; | |
27 | |
28 /* Defines the set of cpu feature checks applied to the code. */ | |
29 typedef struct NaClCpuCheckState { | |
30 /* The standard CPU features. */ | |
31 NaClCPUFeaturesX86 cpu_features; | |
32 /* Check that both f_CMOV and f_x87 is defined. */ | |
33 Bool f_CMOV_and_x87; | |
34 /* Check that either f_MMX or f_SSE2 is defined. */ | |
35 Bool f_MMX_or_SSE2; | |
36 } NaClCpuCheckState; | |
37 | |
38 /* Creates a CPU feature struct (all fields initialized to false), to be used | |
39 * to record what features need to be squashed out of the executable. | |
40 */ | |
41 void NaClCpuCheckMemoryInitialize(struct NaClValidatorState* state); | |
42 | |
43 /* Check that cpu features match instructions for native client rules. */ | |
44 void NaClCpuCheck(struct NaClValidatorState* state, | |
45 struct NaClInstIter* iter); | |
46 | |
47 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_NC_CPU_CHECKS_H
__ */ | |
OLD | NEW |