@@ -420,6 +420,26 @@ static unsigned int ExceptionGen(unsigned int PC, int basemode, int trapno,
420420static unsigned int _Interp86 (unsigned int PC , unsigned int Interp_LONG_CS ,
421421 unsigned short ocs , int basemode , int flags );
422422
423+ static int leave_instremu (void )
424+ {
425+ if (CEmuStat & CeS_INSTREMUx (PROTMODE ())) {
426+ if (debug_level ('e' )> 1 )
427+ dbug_printf ("CeS_INSTREMU, count=%d\n" ,
428+ interp_inst_emu_count );
429+ if (interp_inst_emu_count == 0 ||
430+ -- interp_inst_emu_count == 0 ) {
431+ if ((CEmuStat & CeS_INSTREMU_PM ) &&
432+ config .dpmi_remote &&
433+ vga .inst_emu ) {
434+ instr_emu_sim_reset_count ();
435+ } else {
436+ return 1 ;
437+ }
438+ }
439+ }
440+ return 0 ;
441+ }
442+
423443static unsigned int FindExecCode (unsigned int PC )
424444{
425445 TNode * G ;
@@ -491,11 +511,10 @@ static unsigned int FindExecCode(unsigned int PC)
491511 error ("@corrupted at %x\n" , G -> key + j );
492512 }
493513 /* ---- this is the MAIN EXECUTE point ---- */
494- unsigned short seqflg = G -> flags ;
495514 NodesExecd ++ ;
496515#if PROFILE
497516 TotalNodesExecd ++ ;
498- if (seqflg & F_PREJ )
517+ if (G -> flags & F_PREJ )
499518 PrejitNodesExecd ++ ;
500519#endif
501520 assert (G -> seqlen );
@@ -511,7 +530,7 @@ static unsigned int FindExecCode(unsigned int PC)
511530 speculate = 0 ;
512531 }
513532#endif
514- if (seqflg & F_LEAV )
533+ if (leave_instremu () )
515534 TheCPU .err = EXCP_EMULEAVE ;
516535
517536 if (TheCPU .err ) return PC ;
@@ -552,22 +571,6 @@ static int interp_post(unsigned int PC, unsigned int Interp_LONG_CS,
552571 int gap = (flags & F_SPRJ ) ? SAFE_PRJ_GAP : 1 ;
553572 assert (CurrIMeta >=0 );
554573
555- if (CEmuStat & CeS_INSTREMUx (PROTMODE ())) {
556- if (debug_level ('e' )> 1 )
557- dbug_printf ("CeS_INSTREMU, count=%d\n" ,
558- interp_inst_emu_count );
559- if (interp_inst_emu_count == 0 ||
560- -- interp_inst_emu_count == 0 ) {
561- if ((CEmuStat & CeS_INSTREMU_PM ) &&
562- config .dpmi_remote &&
563- vga .inst_emu ) {
564- instr_emu_sim_reset_count ();
565- } else {
566- flags |= F_LEAV ;
567- }
568- }
569- }
570-
571574#ifndef SINGLEBLOCK
572575 IMeta * GL = & InstrMeta [CurrIMeta ];
573576 if ((mode & MSSTP ) ||
@@ -586,7 +589,7 @@ static void sprj_deep(TNode *G, unsigned PC, unsigned int Interp_LONG_CS,
586589#ifdef SPEC_PREJIT
587590 int i = 0 ;
588591
589- while (G -> clink_t .link && !(G -> flags & ( F_LJMP | F_LEAV ) )) {
592+ while (G -> clink_t .link && !(G -> flags & F_LJMP )) {
590593 TNode * oldG = G ;
591594 PC = G -> clink_t .target ;
592595 if (e_querymark (PC , SAFE_PRJ_GAP )) break ;
0 commit comments