Skip to content

Commit c7aab58

Browse files
committed
hw/m68k/mcf5206: Replace remaining hw_error()s by qemu_log_mask()
hw_error() dumps the CPU state and exits QEMU. This is ok during initial code development (to see where the guest code is currently executing), but it is certainly not the desired behavior that we want to present to normal users, and it can also cause trouble when e.g. fuzzing devices. Thus let's replace these hw_error()s by qemu_log_mask()s instead. Message-Id: <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent 9df8b20 commit c7aab58

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

hw/m68k/mcf5206.c

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "qemu/error-report.h"
1111
#include "qemu/log.h"
1212
#include "cpu.h"
13-
#include "hw/hw.h"
1413
#include "hw/irq.h"
1514
#include "hw/m68k/mcf.h"
1615
#include "qemu/timer.h"
@@ -69,10 +68,16 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
6968
if (mode == 2)
7069
prescale *= 16;
7170

72-
if (mode == 3 || mode == 0)
73-
hw_error("m5206_timer: mode %d not implemented\n", mode);
74-
if ((s->tmr & TMR_FRR) == 0)
75-
hw_error("m5206_timer: free running mode not implemented\n");
71+
if (mode == 3 || mode == 0) {
72+
qemu_log_mask(LOG_UNIMP, "m5206_timer: mode %d not implemented\n",
73+
mode);
74+
goto exit;
75+
}
76+
if ((s->tmr & TMR_FRR) == 0) {
77+
qemu_log_mask(LOG_UNIMP,
78+
"m5206_timer: free running mode not implemented\n");
79+
goto exit;
80+
}
7681

7782
/* Assume 66MHz system clock. */
7883
ptimer_set_freq(s->timer, 66000000 / prescale);
@@ -391,7 +396,9 @@ static uint32_t m5206_mbar_readb(void *opaque, hwaddr offset)
391396
m5206_mbar_state *s = (m5206_mbar_state *)opaque;
392397
offset &= 0x3ff;
393398
if (offset >= 0x200) {
394-
hw_error("Bad MBAR read offset 0x%x", (int)offset);
399+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
400+
offset);
401+
return 0;
395402
}
396403
if (m5206_mbar_width[offset >> 2] > 1) {
397404
uint16_t val;
@@ -410,7 +417,9 @@ static uint32_t m5206_mbar_readw(void *opaque, hwaddr offset)
410417
int width;
411418
offset &= 0x3ff;
412419
if (offset >= 0x200) {
413-
hw_error("Bad MBAR read offset 0x%x", (int)offset);
420+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
421+
offset);
422+
return 0;
414423
}
415424
width = m5206_mbar_width[offset >> 2];
416425
if (width > 2) {
@@ -434,7 +443,9 @@ static uint32_t m5206_mbar_readl(void *opaque, hwaddr offset)
434443
int width;
435444
offset &= 0x3ff;
436445
if (offset >= 0x200) {
437-
hw_error("Bad MBAR read offset 0x%x", (int)offset);
446+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR read offset 0x%" HWADDR_PRIX,
447+
offset);
448+
return 0;
438449
}
439450
width = m5206_mbar_width[offset >> 2];
440451
if (width < 4) {
@@ -458,7 +469,9 @@ static void m5206_mbar_writeb(void *opaque, hwaddr offset,
458469
int width;
459470
offset &= 0x3ff;
460471
if (offset >= 0x200) {
461-
hw_error("Bad MBAR write offset 0x%x", (int)offset);
472+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
473+
offset);
474+
return;
462475
}
463476
width = m5206_mbar_width[offset >> 2];
464477
if (width > 1) {
@@ -482,7 +495,9 @@ static void m5206_mbar_writew(void *opaque, hwaddr offset,
482495
int width;
483496
offset &= 0x3ff;
484497
if (offset >= 0x200) {
485-
hw_error("Bad MBAR write offset 0x%x", (int)offset);
498+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
499+
offset);
500+
return;
486501
}
487502
width = m5206_mbar_width[offset >> 2];
488503
if (width > 2) {
@@ -510,7 +525,9 @@ static void m5206_mbar_writel(void *opaque, hwaddr offset,
510525
int width;
511526
offset &= 0x3ff;
512527
if (offset >= 0x200) {
513-
hw_error("Bad MBAR write offset 0x%x", (int)offset);
528+
qemu_log_mask(LOG_GUEST_ERROR, "Bad MBAR write offset 0x%" HWADDR_PRIX,
529+
offset);
530+
return;
514531
}
515532
width = m5206_mbar_width[offset >> 2];
516533
if (width < 4) {

0 commit comments

Comments
 (0)