@@ -400,6 +400,7 @@ void CAlphaCPU::init() {
400400 flush_icache ();
401401 icache_enabled = myCfg->get_bool_value (" icache" , false );
402402 skip_memtest_hack = myCfg->get_bool_value (" skip_memtest_hack" , false );
403+ skip_memtest_counter = 0 ;
403404
404405 tbia (ACCESS_READ);
405406 tbia (ACCESS_EXEC);
@@ -567,46 +568,64 @@ void CAlphaCPU::check_state() {
567568 * Hack that skips memory check in SRM.
568569 **/
569570inline void CAlphaCPU::skip_memtest () {
570- if (!(state.current_pc & U64 (0x8b000 ))) {
571+ const char *wrong_memskip = " warning: wrong memory check skip\n " ;
572+ const char *counter_mismatch = " warning: memory check skip counter mismatch" ;
573+
574+ if (!(state.current_pc & U64 (0x8b000 )) || (skip_memtest_counter >= 5 )) {
571575 return ;
572576 }
573577
574578 if (state.current_pc == U64 (0x8bb90 )) {
575579 if (state.r [5 ] != U64 (0xaaaaaaaaaaaaaaaa )) {
576- printf (" wrong memory check skip! \n " );
580+ printf (" %s " , wrong_memskip );
577581 } else {
582+ if (skip_memtest_counter != 0 )
583+ printf (" %s" , counter_mismatch);
584+ ++skip_memtest_counter;
578585 state.r [0 ] = state.r [4 ];
579586 }
580587 }
581588
582589 if (state.current_pc == U64 (0x8bbe0 )) {
583590 if (state.r [5 ] != U64 (0xaaaaaaaaaaaaaaaa )) {
584- printf (" wrong memory check skip! \n " );
591+ printf (" %s " , wrong_memskip );
585592 } else {
593+ if (skip_memtest_counter != 1 )
594+ printf (" %s" , counter_mismatch);
595+ ++skip_memtest_counter;
586596 state.r [16 ] = 0 ;
587597 }
588598 }
589599
590600 if (state.current_pc == U64 (0x8bc28 )) {
591601 if (state.r [5 ] != U64 (0xaaaaaaaaaaaaaaaa )) {
592- printf (" wrong memory check skip! \n " );
602+ printf (" %s " , wrong_memskip );
593603 } else {
604+ if (skip_memtest_counter != 2 )
605+ printf (" %s" , counter_mismatch);
606+ ++skip_memtest_counter;
594607 state.r [8 ] = state.r [4 ];
595608 }
596609 }
597610
598611 if (state.current_pc == U64 (0x8bc70 )) {
599612 if (state.r [7 ] != U64 (0x5555555555555555 )) {
600- printf (" wrong memory check skip1! \n " );
613+ printf (" %s " , wrong_memskip );
601614 } else {
615+ if (skip_memtest_counter != 3 )
616+ printf (" %s" , counter_mismatch);
617+ ++skip_memtest_counter;
602618 state.r [0 ] = 0 ;
603619 }
604620 }
605621
606622 if (state.current_pc == U64 (0x8bcb0 )) {
607623 if (state.r [7 ] != U64 (0x5555555555555555 )) {
608- printf (" wrong memory check skip2!\n " );
624+ if (skip_memtest_counter != 4 )
625+ printf (" %s" , counter_mismatch);
626+ printf (" %s" , wrong_memskip);
609627 } else {
628+ ++skip_memtest_counter;
610629 state.r [3 ] = state.r [4 ];
611630 }
612631 }
0 commit comments