This directory tests the x86-32 instruction decoder and instruction validator.
It does so using (human readable) text files.

For a test FOO, the following files are defined:

FOO.hex

   Textual file defining the sequence of hexidecimal bytes in the code segment
   for testing. Comments on what the code segment is intended to test are at
   the top of the file, and begin with a pound (#) symbol.

   By default, the starting program counter is at 0. If you want it at
   a different place, make the first non-comment line of the form '@XXX'
   where XXX should be used as the starting program counter.

FOO.dis

   Output generated by the instruction decoder for the corresponding FOO.hex
   file.

   It uses the iter model, which is the decoder associated with the SFI
   validator solution.

   Note: This file is generated by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdis --use_iter \
          --hex_text=- < FOO.hex

FOO.ndis

   Output generated by the instruction decoder for the corresponding FOO.hex
   file.

   It doesn't use the iter model, which is the decoder associated with the
   SEGMENT validator solution.

   Note: This file is generated by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdis --use_iter=false \
          --hex_text=- < FOO.hex

FOO.nval

   Output generated by the x86-32 (segment based) validator for the
   corresponding FOO.hex file

   Note: This file is generated by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncval --use_iter=false \
          --hex_text=- --max_errors=1000 < FOO.hex

FOO.nexe

   Run the installed instruction decoder and validator on the predefined
   compiled NACL executable FOO.nexe.

In addition, the following non-unit tests are run:

ncdis_test.input

   Self documenting file for the instruction decoder.

   It doesn't use the iter model, which is the decoder associated with the
   SEGMENT validator solution.

   Note: This input matches the generated output (i.e. self
   documenting) by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdis -self_document \
          -commands=- < ncdis_test.input

ncdis_iter_test.input

   Self documenting file for the instruction decoder.

   It uses the iter model, which is the decoder associated with the SFI
   validator solution.

   Note: This input matches the generated output (i.e. self
   documenting) by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdis -use_iter \
          -self_document -commands=- < ncdis_iter_test.input

ncdis_iter_test.internal

   Output generated by the instruction decoder, generated from the
   input file ncdis_iter_test.input. After each instruction, the internal
   form of the matched instruction, and the corresponding expression tree
   is also printed.

   It uses the iter model, which is the decoder associated with the SFI
   validator solution.

   Note: This file is generated by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdis -use_iter \
          -internal -commands=- < ncdis_iter_test.input

modeled_insts.txt

   Automatically generated text describing the instruction set that
   the (iterator form) decoder/validator understands.

   Note: This file is generated by running:

     > scons-out/.../obj/src/trusted/validator_x86/ncdecode_tablegen \
          -m32 -documentation
