| OLD | NEW |
| (Empty) |
| 1 This directory implements the decoder table generator used by | |
| 2 native_client/src/trusted/validator/x86/decoder. See the README in | |
| 3 that directory for more information on how instructions are | |
| 4 modeled. In particular, note the sections on "Modeled Instructions", | |
| 5 "Opcode Sequences", and "Instruction Arguments". | |
| 6 | |
| 7 Modeled instructions specify what assembly instructions are recognized | |
| 8 by the decoder. The form used is based on the AMD (R) document | |
| 9 24594-Rev.3.14-September 2007, "AMD64 Architecture Programmer's manual | |
| 10 Volume 3: General-Purpose and System Instructions", and Intel (R) | |
| 11 docuements 253666-030US - March 2009, "Intel 654 and IA-32 | |
| 12 Architectures Software Developer's Manual, Volume2A: Instruction Set | |
| 13 Reference, A-M" and 253667-030US - March 2009, "Intel 654 and IA-32 | |
| 14 Architectures Software Developer's Manual, Volume2B: Instruction Set | |
| 15 Reference, N-Z". In particular, it tries to follow the print forms | |
| 16 defined by AMD's "Appendex section A.1 - Opcode-Syntax Notation", or | |
| 17 Intel's "Appendix Section A.2 - Key To Abbreviations". | |
| 18 | |
| 19 Source files: | |
| 20 ------------- | |
| 21 | |
| 22 modeled_nacl_inst.{c,h} | |
| 23 | |
| 24 Defines structures to hold modeled instructions, and a | |
| 25 print routine to print these modeled instructions. | |
| 26 | |
| 27 ncdecode_tablegen.{h,c} | |
| 28 | |
| 29 Implements the table generator executable. Includes: | |
| 30 | |
| 31 code to add modeled instructions (one by one). | |
| 32 | |
| 33 code to check consistency of the modeled instructions. | |
| 34 | |
| 35 code to print out generated tables that encode the modeled | |
| 36 instructions. | |
| 37 | |
| 38 code to print out a human readable form of the modeled | |
| 39 instructions, so that it easy to see what instructions are | |
| 40 being encoded into the generated tables. | |
| 41 | |
| 42 nacl_regsgen.{c,h} | |
| 43 | |
| 44 Implements code that generates header files containing the | |
| 45 set of general purpose registers (and thier correlations) for | |
| 46 both x86-32 and x86-64. | |
| 47 | |
| 48 ncdecode_forms.{h,c} | |
| 49 | |
| 50 Implements code that takes string definitions of modeled | |
| 51 instructions, and generates the corresponding appropriate calls to | |
| 52 model the instructions, as expected by code in | |
| 53 ncdecode_tablegen.h. The modeled instructions define an opcode | |
| 54 sequence, an instruction mnemonic, and instruction arguments | |
| 55 expected by that instruction. | |
| 56 | |
| 57 ncdecode_onebyte.c | |
| 58 | |
| 59 Defines one byte opcodes for 386, return, and system instructions. | |
| 60 | |
| 61 ncdecodeX87.c | |
| 62 | |
| 63 Defines the x87 floating point instructions. | |
| 64 | |
| 65 ncdecode_0F.c | |
| 66 | |
| 67 Defines the multibyte opcode instructions, which begin with byte | |
| 68 0F. Excludes sse instructions ((except for the Ldmxcse, Stmxcsr, | |
| 69 Lfence, and Mfence instructions). | |
| 70 | |
| 71 ncdecode_sse.c | |
| 72 | |
| 73 Defines sse instructions (except for the Ldmxcse, Stmxcsr, Lfence, | |
| 74 and Mfence instructions, which are defined in ncdecode_0F.c). | |
| 75 | |
| 76 defsize64.{c,h} | |
| 77 | |
| 78 Defines instructions (mnemonics) which for x86-64, always have | |
| 79 64-bit arguments, and ignores operand size specified by prefix | |
| 80 bytes. | |
| 81 | |
| 82 lock_insts.{c,h} | |
| 83 | |
| 84 Defines instructions (mnemonics) that can use a lock prefix. | |
| 85 | |
| 86 long_mode.{c,h} | |
| 87 | |
| 88 Defines instructions (mnemonics) that are considered LongMode in | |
| 89 x86-64. | |
| 90 | |
| 91 nacl_illegal.{c,h} | |
| 92 | |
| 93 Defines instructions (mnemonics) that are (apriori) considered | |
| 94 illegal in native client. | |
| 95 | |
| 96 nc_def_jumps.{c,h} | |
| 97 | |
| 98 Defines instructions (mnemonics) that do either conditional or | |
| 99 unconditional jumps. | |
| 100 | |
| 101 zero_extends.{c,h} | |
| 102 | |
| 103 Defines instructions (mnemonics) that native client assumes to do | |
| 104 zero-extension when assigning a 32-bit value to a 64-bit register. | |
| 105 | |
| 106 Note: This is not the same as specified in the instruction manuals. | |
| 107 Rather, it only includes those that have been whitelisted to do | |
| 108 this for native client. | |
| 109 | |
| 110 nc_rep_prefix.{c,h} | |
| 111 | |
| 112 Defines instructions (mnemonics) that can use the REP/REPE/REPZ | |
| 113 (F3) and REPNE/REPNZ (F2) prefix. | |
| 114 | |
| 115 nacl_disallows.enum | |
| 116 | |
| 117 Defines an enumerated type of possible reasons why a modeled | |
| 118 instruction may not be accepted by the table generator. | |
| 119 | |
| 120 ncdecode_st.{c,h} | |
| 121 | |
| 122 Symbol table used to encode names used when defining modeled | |
| 123 instructions. This includes common registers (i.e. the stack and | |
| 124 ip), as well as functions that convert instruction arguments | |
| 125 (strings) into the corresponding modeled instruction data. | |
| 126 | |
| 127 nc_compress.{c,h} | |
| 128 | |
| 129 Defines code that compresses the data used to model instructions, | |
| 130 so that the corresponding tables generated are smaller. | |
| 131 | |
| 132 ncval_simplify.{c,h} | |
| 133 | |
| 134 Code that simplifies (fully) modeled instructions into patterns | |
| 135 that can be used by the x86-64 validator to parse the corresponding | |
| 136 instructions. | |
| 137 | |
| 138 force_cpp.cc | |
| 139 | |
| 140 Dummy file to make scons understand that the corresponding | |
| 141 executable contains c++ code. | |
| 142 | |
| 143 build.scons | |
| 144 | |
| 145 The scons file to construct the needed tables for the x86 decoders | |
| 146 and validators. | |
| 147 | |
| 148 Note: The tables are not automatically rebuilt on each call to | |
| 149 scons. Rather, to regenerate the corresponding tables, one must do | |
| 150 the following (in the native_client directory): | |
| 151 | |
| 152 .> ./scons --mode=opt-linux platform=x86-64 valclean | |
| 153 .> ./scons --mode=opt-linux platform=x86-64 valgen | |
| 154 | |
| 155 Generated Tables | |
| 156 ---------------- | |
| 157 | |
| 158 The following tables are generated by scons (when call with argument | |
| 159 "valgen"): | |
| 160 | |
| 161 gen/nacl_disallows.h | |
| 162 | |
| 163 The generated enumerated type defined by file nacl_disallows.enum | |
| 164 | |
| 165 gen/nacl_disallows_impl.h | |
| 166 | |
| 167 The generated implementation of the function NaClDisallowsFlagName. | |
| 168 | |
| 169 gen/nc_opcode_table_32.h | |
| 170 | |
| 171 The generated tables for the full decoder for x86-32 instructions. | |
| 172 | |
| 173 gen/nc_opcode_table_64.h | |
| 174 | |
| 175 The generated tables for the full decoder for x86-64 instructions. | |
| 176 | |
| 177 gen/nc_subregs_64.h | |
| 178 | |
| 179 The generated mapping of all possible registers in x86-64, to the | |
| 180 index of the (64-bit) register that is is a subregister of. | |
| 181 | |
| 182 gen/nc_subregs_32.h | |
| 183 | |
| 184 The generated mapping of all possible registers in x86-32, to the | |
| 185 index of the (32-bit) register that is is a subregister of. | |
| 186 | |
| 187 Modeled Instructions | |
| 188 -------------------- | |
| 189 | |
| 190 To make it easier to see what instructions are generated, and test | |
| 191 that changes to the code in this directory has NOT changed that set, | |
| 192 the following test files exists: | |
| 193 | |
| 194 testdata/64/modeled_insts.txt | |
| 195 | |
| 196 The instructions recognized by the full decoder for x86-64. | |
| 197 | |
| 198 testdata/32/modeled_insts.txt | |
| 199 | |
| 200 The instructions recognized by the full decoder for x86-32. | |
| 201 | |
| 202 testdata/64/ncval_reg_sfi_modeled_insts.txt | |
| 203 | |
| 204 The instruction patterns (generated by ncval_simplify.c) that | |
| 205 will be used by the x86-64 register SFI validator. | |
| 206 | |
| 207 testdata/32/ncval_reg_sfi_modeled_insts.txt | |
| 208 | |
| 209 The instruction patterns (generated by ncval_simplify.c) that | |
| 210 will be used by the x86-32 register SFI validator. | |
| 211 | |
| 212 Note: Deprecated and will be removed, since the x86-32 version | |
| 213 of the register SFI validator does not make sense. | |
| OLD | NEW |