Skip to content

Commit 837750f

Browse files
Only trigger memtest skip once
This fixes OpenVMS installation with memtest skip enabled.
1 parent c1db0aa commit 837750f

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/AlphaCPU.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
**/
569570
inline 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
}

src/AlphaCPU.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ class CAlphaCPU : public CSystemComponent, public CRunnable {
424424

425425
bool icache_enabled;
426426
bool skip_memtest_hack;
427+
int skip_memtest_counter;
427428

428429
// ... ... ...
429430
u64 cc_large;

0 commit comments

Comments
 (0)