Chromium Code Reviews| Index: src/trusted/validator_ragel/validator_x86_32.rl |
| =================================================================== |
| --- src/trusted/validator_ragel/validator_x86_32.rl (revision 9911) |
| +++ src/trusted/validator_ragel/validator_x86_32.rl (working copy) |
| @@ -4,6 +4,14 @@ |
| * found in the LICENSE file. |
| */ |
| +/* |
| + * This is the core of ia32-mode validator. Please note that this file |
| + * combines ragel machine description and C language actions. Please read |
| + * validator_internals.html first to understand how the whole thing is built: |
| + * it explains how the byte sequences are constructed, what constructs like |
| + * β@{}β or βREX_WRX?β mean, etc. |
| + */ |
| + |
| #include <assert.h> |
| #include <errno.h> |
| #include <stddef.h> |
| @@ -11,7 +19,7 @@ |
| #include <stdlib.h> |
| #include <string.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 |
| @@ -79,7 +87,7 @@ |
| 0x83 0xe6 0xe0 0xff (0xd6|0xe6) | # naclcall/jmp %esi |
| 0x83 0xe7 0xe0 0xff (0xd7|0xe7)) # naclcall/jmp %edi |
|
Brad Chen
2012/10/05 16:47:21
Note: This is a case where repetition seems okay t
khim
2012/10/15 16:38:57
Even so: I've added one minor change to separate a
|
| @{ |
| - BitmapClearBit(valid_targets, (current_position - data) - 1); |
| + MakeInvalidJumpTarget((current_position - data) - 1, valid_targets); |
| instruction_start -= 3; |
| instruction_info_collected |= SPECIAL_INSTRUCTION; |
| } | |
| @@ -104,7 +112,7 @@ |
| main := ((call_alignment | one_instruction | special_instruction) |
| >{ |
| - BitmapSetBit(valid_targets, current_position - data); |
| + MakeJumpTargetValid(current_position - data, valid_targets); |
| } |
| @{ |
| if ((instruction_info_collected & |
| @@ -133,7 +141,7 @@ |
| Bool ValidateChunkIA32(const uint8_t *data, size_t size, |
| enum validation_options options, |
| const NaClCPUFeaturesX86 *cpu_features, |
| - validation_callback_func user_callback, |
| + ValidationCallbackFunc user_callback, |
| void *callback_data) { |
| bitmap_word valid_targets_small; |
| bitmap_word jump_dests_small; |