diff --git a/core/bitops.h b/core/bitops.h
index 786441d..72f0384 100644
--- a/core/bitops.h
+++ b/core/bitops.h
@@ -26,7 +26,7 @@ along with this program. If not, see .
#include
-#if defined(__GNUG__) && !defined(__clang__) // GCC, mybe ICC but not Clang
+#if defined(__GNUG__) && !defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) // GCC, mybe ICC but not Clang
# include
diff --git a/devices/common/scsi/scsibus.cpp b/devices/common/scsi/scsibus.cpp
index 01b4144..2f6cfff 100644
--- a/devices/common/scsi/scsibus.cpp
+++ b/devices/common/scsi/scsibus.cpp
@@ -67,6 +67,8 @@ void ScsiBus::change_bus_phase(int initiator_id)
void ScsiBus::assert_ctrl_line(int initiator_id, uint16_t mask)
{
+ DCHECK_F(initiator_id >= 0 && initiator_id < SCSI_MAX_DEVS, "ScsiBus: invalid initiator ID %d", initiator_id);
+
uint16_t new_state = 0xFFFFU & mask;
this->dev_ctrl_lines[initiator_id] |= new_state;
@@ -84,6 +86,8 @@ void ScsiBus::assert_ctrl_line(int initiator_id, uint16_t mask)
void ScsiBus::release_ctrl_line(int id, uint16_t mask)
{
+ DCHECK_F(id >= 0 && id < SCSI_MAX_DEVS, "ScsiBus: invalid initiator ID %d", id);
+
uint16_t new_state = 0;
this->dev_ctrl_lines[id] &= ~mask;
diff --git a/main.cpp b/main.cpp
index 5b9a18a..b85ea22 100644
--- a/main.cpp
+++ b/main.cpp
@@ -140,7 +140,7 @@ int main(int argc, char** argv) {
machine_str = MachineFactory::machine_name_from_rom(bootrom_path);
if (machine_str.empty()) {
LOG_F(ERROR, "Could not autodetect machine");
- return 0;
+ return 1;
}
else {
LOG_F(INFO, "Machine was autodetected as: %s", machine_str.c_str());
@@ -150,7 +150,7 @@ int main(int argc, char** argv) {
/* handle overriding of machine settings from command line */
map settings;
if (MachineFactory::get_machine_settings(machine_str, settings) < 0) {
- return 0;
+ return 1;
}
CLI::App sa;
@@ -168,7 +168,7 @@ int main(int argc, char** argv) {
if (SDL_Init(SDL_INIT_VIDEO)) {
LOG_F(ERROR, "SDL_Init error: %s", SDL_GetError());
- return 0;
+ return 1;
}
// initialize global profiler object
@@ -180,6 +180,9 @@ int main(int argc, char** argv) {
// graceful handling of fatal errors
loguru::set_fatal_handler([](const loguru::Message& message) {
+ // Make sure the reason for the failure is visible (it may have been
+ // sent to the logfile only).
+ cerr << message.preamble << message.indentation << message.prefix << message.message << endl;
enter_debugger();
abort();
@@ -206,7 +209,7 @@ int main(int argc, char** argv) {
break;
default:
LOG_F(ERROR, "Invalid EXECUTION MODE");
- return 0;
+ return 1;
}
bail: