From b70954d3ab137d43c1bde70bb34ad19174e6a9fe Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 11 Oct 2020 18:47:21 +0000 Subject: [PATCH] Don't report BX_ERROR when writing an unsupprted to shutdown status register in case a CMOS image is used. --- bochs/iodev/cmos.cc | 13 +++++++++---- bochs/iodev/cmos.h | 4 +++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bochs/iodev/cmos.cc b/bochs/iodev/cmos.cc index ac1e81398..e196f6956 100644 --- a/bochs/iodev/cmos.cc +++ b/bochs/iodev/cmos.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2018 The Bochs Project +// Copyright (C) 2002-2020 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -210,7 +210,8 @@ void bx_cmos_c::init(void) } // load CMOS from image file if requested. - if (SIM->get_param_bool(BXPN_CMOSIMAGE_ENABLED)->get()) { + BX_CMOS_THIS s.use_image = SIM->get_param_bool(BXPN_CMOSIMAGE_ENABLED)->get(); + if (BX_CMOS_THIS s.use_image) { int fd, ret; struct stat stat_buf; @@ -311,7 +312,7 @@ void bx_cmos_c::save_image(void) int fd, ret; // save CMOS to image file if requested. - if (SIM->get_param_bool(BXPN_CMOSIMAGE_ENABLED)->get()) { + if (BX_CMOS_THIS s.use_image) { fd = open(SIM->get_param_string(BXPN_CMOSIMAGE_PATH)->getptr(), O_WRONLY #ifdef O_BINARY | O_BINARY @@ -647,7 +648,11 @@ void bx_cmos_c::write(Bit32u address, Bit32u value, unsigned io_len) " to retf to DWORD at 40:67")); break; default: - BX_ERROR(("unsupported shutdown status: 0x%02x!", value)); + if (!BX_CMOS_THIS s.use_image) { + BX_ERROR(("unsupported shutdown status: 0x%02x!", value)); + } else { + BX_DEBUG(("shutdown status register set to 0x%02x", value)); + } } BX_CMOS_THIS s.reg[REG_SHUTDOWN_STATUS] = value; break; diff --git a/bochs/iodev/cmos.h b/bochs/iodev/cmos.h index 383464e4c..80ead7447 100644 --- a/bochs/iodev/cmos.h +++ b/bochs/iodev/cmos.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2018 The Bochs Project +// Copyright (C) 2002-2020 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -75,6 +75,8 @@ public: Bit8u reg[256]; Bit8u max_reg; + + bx_bool use_image; } s; // state information private: