Index: src/trusted/validator_ragel/validator_x86_32.rl |
=================================================================== |
--- src/trusted/validator_ragel/validator_x86_32.rl (revision 10976) |
+++ src/trusted/validator_ragel/validator_x86_32.rl (working copy) |
@@ -20,7 +20,7 @@ |
#include <string.h> |
#include "native_client/src/trusted/validator_ragel/bitmap.h" |
-#include "native_client/src/trusted/validator_ragel/unreviewed/validator_internal.h" |
+#include "native_client/src/trusted/validator_ragel/validator_internal.h" |
/* Ignore this information: it's not used by security model in IA32 mode. */ |
#undef GET_VEX_PREFIX3 |
@@ -62,9 +62,10 @@ |
"native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl"; |
# Action which marks last byte as not immediate. Most 3DNow! instructions, |
- # some AVX and XOP instructions have this property. It's referenced by |
- # decode_x86_32 machine in [autogenerated] "validator_x86_32_instruction.rl" |
- # file. |
+ # some AVX and XOP instructions have this property. |
+ # |
+ # This action is referenced by decode_x86_32 ragel machine in [autogenerated] |
+ # "validator_x86_32_instruction.rl" file. |
action last_byte_is_not_immediate { |
halyavin
2013/03/19 13:44:44
Think on removing code duplication here.
khim
2013/03/19 14:54:46
Done.
|
instruction_info_collected |= LAST_BYTE_IS_NOT_IMMEDIATE; |
} |
@@ -93,7 +94,7 @@ |
0x65 0x8b (0x05|0x0d|0x015|0x1d|0x25|0x2d|0x35|0x3d) |
(0x00|0x04) 0x00 0x00 0x00); # mov %gs:0x0/0x4,%reg |
- # Check if call is properly aligned |
+ # Ragel machine which checks if call is properly aligned. |
halyavin
2013/03/19 13:44:44
Ragel machine that accepts one call instruction or
khim
2013/03/19 14:54:46
Done.
|
# |
# For direct call we explicitly encode all variations. For indirect call |
# we accept all the special instructions which ends with register-addressed |
@@ -160,8 +161,8 @@ |
} |
# This is main ragel machine: it does 99% of validation work. There are only |
- # one thing to do if this machine accepts the bundles - check that direct |
- # jumps are correct. This is done in the following way: |
+ # one thing to do if this ragel machine accepts the bundles - check that |
+ # direct jumps are correct. This is done in the following way: |
# * DFA fills two arrays: valid_targets and jump_dests. |
# * ProcessInvalidJumpTargets checks that "jump_dests & !valid_targets == 0". |
# All other checks are done here. |
@@ -171,9 +172,12 @@ |
}%% |
+/* |
+ * The "write data" statement causes Ragel to emit the constant static data |
+ * needed by the ragel machine. |
+ */ |
%% write data; |
- |
Bool ValidateChunkIA32(const uint8_t *data, size_t size, |
uint32_t options, |
const NaClCPUFeaturesX86 *cpu_features, |
@@ -210,7 +214,7 @@ |
/* |
* This option is usually used in tests: we will process the whole chunk |
* in one pass. Usually each bundle is processed separately which means |
- * instructions (and super-instructions) can not cross borders of the bundle. |
+ * instructions (and "superinstructions") can not cross borders of the bundle. |
*/ |
if (options & PROCESS_CHUNK_AS_A_CONTIGUOUS_STREAM) |
end_of_bundle = data + size; |
@@ -234,7 +238,15 @@ |
uint32_t instruction_info_collected = 0; |
int current_state; |
+ /* |
+ * The "write init" statement causes Ragel to emit initialization code. |
+ * This should be executed once before the ragel machine is started. |
+ */ |
%% write init; |
+ /* |
+ * The "write exec" statement causes Ragel to emit the ragel machine's |
+ * execution code. |
+ */ |
%% write exec; |
} |