Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1072)

Unified Diff: src/trusted/validator_ragel/validator_x86_32.rl

Issue 11000033: Move validator_x86_XX.rl out of unreviewed. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698