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

Unified Diff: src/trusted/validator_x86/nc_inst_state_internal.h

Issue 6883091: Start unit testing for functions in nc_inst_state.c (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 8 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_x86/nc_inst_state_internal.h
===================================================================
--- src/trusted/validator_x86/nc_inst_state_internal.h (revision 4944)
+++ src/trusted/validator_x86/nc_inst_state_internal.h (working copy)
@@ -14,6 +14,8 @@
#include "native_client/src/shared/utils/types.h"
#include "native_client/src/trusted/validator_x86/ncop_exps.h"
+EXTERN_C_BEGIN
+
/* The meta model of an x86 opcode instruction. */
struct NaClInst;
@@ -107,6 +109,22 @@
struct NaClInstState* buffer;
};
+/* Structure holding the results of consuming the opcode bytes of the
+ * instruction.
+ */
+typedef struct {
+ /* The (last) byte of the matched opcode. */
+ uint8_t opcode_byte;
+ /* The most specific prefix that the opcode bytes can match
+ * (or OpcodePrefixEnumSize if no such patterns exist).
+ */
+ NaClInstPrefix matched_prefix;
+ /* The number of bytes to subtract from the instruction length,
+ * the next time GetNextNaClInstCandidates is called.
+ */
+ uint8_t next_length_adjustment;
+} NaClInstPrefixDescriptor;
+
/* Given the current location of the (relative) pc of the given instruction
* iterator, update the given state to hold the matched opcode
* (instruction) pattern. If no matching pattern exists, set the state
@@ -116,4 +134,12 @@
*/
void NaClDecodeInst(struct NaClInstIter* iter, struct NaClInstState* state);
+/* Returns the (undecoded) instruction state of the iterator. Should only
+ * be used for testing.
+ */
+
+struct NaClInstState* NaClInstIterGetUndecodedState(struct NaClInstIter* iter);
+
+EXTERN_C_END
+
#endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_INST_STATE_INTERNAL_H_ */

Powered by Google App Engine
This is Rietveld 408576698