| Index: src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_utils.c
|
| ===================================================================
|
| --- src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_utils.c (revision 6742)
|
| +++ src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_utils.c (working copy)
|
| @@ -11,7 +11,6 @@
|
| #include "native_client/src/shared/platform/nacl_log.h"
|
| #include "native_client/src/trusted/validator/x86/decoder/nc_decode_tables.h"
|
| #include "native_client/src/trusted/validator/x86/decoder/nc_inst_state_internal.h"
|
| -#include "native_client/src/trusted/validator/x86/decoder/ncop_exps.h"
|
|
|
| /* To turn on debugging of instruction decoding, change value of
|
| * DEBUGGING to 1.
|
| @@ -20,6 +19,9 @@
|
|
|
| #include "native_client/src/shared/utils/debugging.h"
|
|
|
| +#include "native_client/src/trusted/validator/x86/decoder/ncopcode_desc_inl.c"
|
| +#include "native_client/src/trusted/validator/x86/decoder/ncop_exps_inl.c"
|
| +
|
| const NaClOpFlags NaClOpSetOrUse = NACL_OPFLAG(OpSet) | NACL_OPFLAG(OpUse);
|
|
|
| Bool NaClIsBinaryUsingRegisters(const NaClInst* inst,
|
| @@ -28,13 +30,13 @@
|
| NaClOpKind reg_1,
|
| NaClOpKind reg_2) {
|
| return name == inst->name &&
|
| - 2 == NaClGetInstNumberOperands(inst) &&
|
| + 2 == NaClGetInstNumberOperandsInline(inst) &&
|
| /* Note: Since the vector contains a list of operand expressions, the
|
| * first operand reference is always at index zero, and its first child
|
| * (where the register would be defined) is at index 1.
|
| */
|
| ExprRegister == vector->node[1].kind &&
|
| - reg_1 == NaClGetExpRegister(&vector->node[1]) &&
|
| + reg_1 == NaClGetExpRegisterInline(&vector->node[1]) &&
|
| /* Note: Since the first subtree is a register operand, it uses
|
| * nodes 0 and 1 in the vector (node 0 is the operand reference, and
|
| * node 1 is its child defining a register value). The second operand
|
| @@ -42,7 +44,7 @@
|
| * a register, it is the first kid of node 2, which is node 3.
|
| */
|
| ExprRegister == vector->node[3].kind &&
|
| - reg_2 == NaClGetExpRegister(&vector->node[3]);
|
| + reg_2 == NaClGetExpRegisterInline(&vector->node[3]);
|
| }
|
|
|
| Bool NaClIsMovUsingRegisters(const NaClDecodeTables* tables,
|
| @@ -52,9 +54,9 @@
|
| NaClOpKind reg_use) {
|
| return NaClIsBinaryUsingRegisters(inst, InstMov, vector, reg_set, reg_use) &&
|
| NACL_OPFLAG(OpSet) ==
|
| - (NaClGetInstOperand(tables, inst, 0)->flags & NaClOpSetOrUse) &&
|
| + (NaClGetInstOperandInline(tables, inst, 0)->flags & NaClOpSetOrUse) &&
|
| NACL_OPFLAG(OpUse) ==
|
| - (NaClGetInstOperand(tables, inst, 1)->flags & NaClOpSetOrUse);
|
| + (NaClGetInstOperandInline(tables, inst, 1)->flags & NaClOpSetOrUse);
|
| }
|
|
|
| Bool NaClIsBinarySetUsingRegisters(const NaClDecodeTables* tables,
|
| @@ -65,9 +67,9 @@
|
| NaClOpKind reg_2) {
|
| return NaClIsBinaryUsingRegisters(inst, name, vector, reg_1, reg_2) &&
|
| NaClOpSetOrUse ==
|
| - (NaClGetInstOperand(tables, inst, 0)->flags & NaClOpSetOrUse) &&
|
| + (NaClGetInstOperandInline(tables, inst, 0)->flags & NaClOpSetOrUse) &&
|
| NACL_OPFLAG(OpUse) ==
|
| - (NaClGetInstOperand(tables, inst, 1)->flags & NaClOpSetOrUse);
|
| + (NaClGetInstOperandInline(tables, inst, 1)->flags & NaClOpSetOrUse);
|
| }
|
|
|
| Bool NaClOperandOneIsRegisterSet(NaClInstState* inst,
|
| @@ -85,7 +87,7 @@
|
| if (vector->number_expr_nodes >= 2) {
|
| NaClExp* op_reg = &vector->node[1];
|
| result = (ExprRegister == op_reg->kind &&
|
| - reg_name == NaClGetExpRegister(op_reg) &&
|
| + reg_name == NaClGetExpRegisterInline(op_reg) &&
|
| (op_reg->flags & NACL_EFLAG(ExprSet)));
|
| }
|
| DEBUG(NaClLog(LOG_INFO,
|
| @@ -98,8 +100,8 @@
|
| const NaClInst* inst = NaClInstStateInst(state);
|
| DEBUG(NaClLog(LOG_INFO, "->NaClOperandOneZeroExtends\n"));
|
| DEBUG_OR_ERASE(NaClInstPrint(NaClLogGetGio(), state->decoder_tables, inst));
|
| - result = (1 <= NaClGetInstNumberOperands(inst) &&
|
| - (NaClGetInstOperand(state->decoder_tables, inst, 0)->flags &
|
| + result = (1 <= NaClGetInstNumberOperandsInline(inst) &&
|
| + (NaClGetInstOperandInline(state->decoder_tables, inst, 0)->flags &
|
| NACL_OPFLAG(OperandZeroExtends_v)) &&
|
| 4 == NaClInstStateOperandSize(state));
|
| DEBUG(NaClLog(LOG_INFO,
|
|
|