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

Side by Side Diff: src/trusted/validator/x86/ncval_seg_sfi/ncdecode.c

Issue 10134056: Refactor the process of choosing validators. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: more aesthetics Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * ncdecode.c - table driven decoder for Native Client 8 * ncdecode.c - table driven decoder for Native Client
9 * 9 *
10 * Most x86 decoders I've looked at are big case statements. While 10 * Most x86 decoders I've looked at are big case statements. While
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 678
679 /* Default action for a decoder state pair. */ 679 /* Default action for a decoder state pair. */
680 static Bool NullNCDecoderStatePairAction(struct NCDecoderStatePair* tthis, 680 static Bool NullNCDecoderStatePairAction(struct NCDecoderStatePair* tthis,
681 NCDecoderInst* old_inst, 681 NCDecoderInst* old_inst,
682 NCDecoderInst* new_inst) { 682 NCDecoderInst* new_inst) {
683 return TRUE; 683 return TRUE;
684 } 684 }
685 685
686 void NCDecoderStatePairConstruct(NCDecoderStatePair* tthis, 686 void NCDecoderStatePairConstruct(NCDecoderStatePair* tthis,
687 NCDecoderState* old_dstate, 687 NCDecoderState* old_dstate,
688 NCDecoderState* new_dstate) { 688 NCDecoderState* new_dstate,
689 NaClCopyInstructionFunc copy_func) {
689 tthis->old_dstate = old_dstate; 690 tthis->old_dstate = old_dstate;
690 tthis->new_dstate = new_dstate; 691 tthis->new_dstate = new_dstate;
691 tthis->action_fn = NullNCDecoderStatePairAction; 692 tthis->action_fn = NullNCDecoderStatePairAction;
693 tthis->copy_func = copy_func;
692 } 694 }
693 695
694 void NCDecoderStatePairDestruct(NCDecoderStatePair* tthis) { 696 void NCDecoderStatePairDestruct(NCDecoderStatePair* tthis) {
695 } 697 }
696 698
697 Bool NCDecoderStatePairDecode(NCDecoderStatePair* tthis) { 699 Bool NCDecoderStatePairDecode(NCDecoderStatePair* tthis) {
698 NCDecoderInst* old_dinst = 700 NCDecoderInst* old_dinst =
699 &tthis->old_dstate->inst_buffer[tthis->old_dstate->cur_inst_index]; 701 &tthis->old_dstate->inst_buffer[tthis->old_dstate->cur_inst_index];
700 NCDecoderInst* new_dinst = 702 NCDecoderInst* new_dinst =
701 &tthis->new_dstate->inst_buffer[tthis->new_dstate->cur_inst_index]; 703 &tthis->new_dstate->inst_buffer[tthis->new_dstate->cur_inst_index];
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 if (! (tthis->action_fn)(tthis, old_dinst, new_dinst)) { 766 if (! (tthis->action_fn)(tthis, old_dinst, new_dinst)) {
765 return FALSE; 767 return FALSE;
766 } 768 }
767 769
768 /* Move to next instruction. */ 770 /* Move to next instruction. */
769 old_dinst = IncrementInst(old_dinst); 771 old_dinst = IncrementInst(old_dinst);
770 new_dinst = IncrementInst(new_dinst); 772 new_dinst = IncrementInst(new_dinst);
771 } 773 }
772 return TRUE; 774 return TRUE;
773 } 775 }
OLDNEW
« no previous file with comments | « src/trusted/validator/x86/ncval_seg_sfi/ncdecode.h ('k') | src/trusted/validator/x86/ncval_seg_sfi/ncvalidate.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698