diff --git a/PDP11/pdp11_rp.c b/PDP11/pdp11_rp.c index afc10545..cb99a766 100644 --- a/PDP11/pdp11_rp.c +++ b/PDP11/pdp11_rp.c @@ -1154,8 +1154,7 @@ else { /* Bottom End (After I/O processing) */ case FNC_SEARCH: /* search */ case FNC_SEEK: /* seek */ case FNC_WRITEH: /* write headers stub */ - sim_abort ("rp_svc() error", __FILE__, __LINE__); /* should NEVER happen */ - break; + return SCPE_IERR; /* should NEVER happen */ case FNC_WRITE: /* write */ case FNC_WCHK: /* write check */ diff --git a/scp.c b/scp.c index abcdbc1d..49dd2185 100644 --- a/scp.c +++ b/scp.c @@ -12339,7 +12339,7 @@ else if (uptr->next) { char buf[128]; snprintf (buf, sizeof (buf), "Cancel failed for %s\n", sim_uname(uptr)); - sim_abort (buf, __FILE__, __LINE__); + SIM_SCP_ABORT (buf); } return SCPE_OK; } @@ -13707,7 +13707,7 @@ return SCPE_OK; /* Abort and sanely close output files */ /* This routine should ONLY be called from SCP modules */ -void sim_abort (const char *msg, const char *file, int linenum) +void _sim_scp_abort (const char *msg, const char *file, int linenum) { sim_printf ("%s - aborting from %s:%d\n", msg, file, linenum); sim_flush_buffered_files (); diff --git a/scp.h b/scp.h index 65c655e7..5af24b39 100644 --- a/scp.h +++ b/scp.h @@ -275,7 +275,10 @@ void _sim_debug_device (uint32 dbits, DEVICE* dptr, const char* fmt, ...) GCC_FM #define sim_debug_unit(dbits, uptr, ...) do { if ((sim_deb != NULL) && ((uptr) != NULL) && (uptr->dptr != NULL) && (((uptr)->dctrl | (uptr)->dptr->dctrl) & (dbits))) _sim_debug_unit (dbits, uptr, __VA_ARGS__);} while (0) #endif void sim_flush_buffered_files (void); -void sim_abort (const char *msg, const char *filename, int filelinenum); + +/* Only for use in SCP code and libraries - NOT in simulator code */ +#define SIM_SCP_ABORT(msg) _sim_scp_abort (msg, __FILE__, __LINE__) +void _sim_scp_abort (const char *msg, const char *filename, int filelinenum); void fprint_stopped_gen (FILE *st, t_stat v, REG *pc, DEVICE *dptr); #define SCP_HELP_FLAT (1u << 31) /* Force flat help when prompting is not possible */ diff --git a/sim_defs.h b/sim_defs.h index 7c4d1c2e..d0fc943f 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -1145,7 +1145,7 @@ struct MEMFILE { #define ASSURE(_Expression) while (!(_Expression)) { \ char buf[512]; \ snprintf(buf, sizeof (buf), "%s failed", #_Expression); \ - sim_abort (buf, __FILE__, __LINE__); \ + SIM_SCP_ABORT (buf); \ } /* Asynch/Threaded I/O support */ @@ -1193,8 +1193,7 @@ extern int32 sim_asynch_inst_latency; (_cptr != QUEUE_LIST_END); \ _cptr = _cptr->next) \ if (!_cptr->next) \ - sim_abort ("Queue Corruption detected", \ - __FILE__, __LINE__); \ + SIM_SCP_ABORT ("Queue Corruption detected"); \ if (lock) \ pthread_mutex_unlock (lock); \ } while (0) @@ -1348,8 +1347,7 @@ extern int32 sim_asynch_inst_latency; #endif /* USE_AIO_INTRINSICS */ #define AIO_VALIDATE(uptr) \ if (!pthread_equal ( pthread_self(), sim_asynch_main_threadid )) { \ - sim_abort ("Improper thread context for operation detected", \ - __FILE__, __LINE__); \ + SIM_SCP_ABORT ("Improper thread context for operation detected");\ } else (void)0 #define AIO_CHECK_EVENT \ if (0 > --sim_asynch_check) { \ diff --git a/sim_disk.c b/sim_disk.c index 22dcbff5..8a46c90a 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -234,7 +234,7 @@ if ((!callback) || !ctx->asynch_io) op, (int)(uptr - ctx->dptr->units), _lba, _sects);\ \ if (ctx->callback) /* horrible mistake, stop */ \ - sim_abort ("AIO_CALL error", __FILE__, __LINE__); \ + SIM_SCP_ABORT ("AIO_CALL error"); \ ctx->io_dop = op; \ ctx->lba = _lba; \ ctx->buf = _buf; \ @@ -316,7 +316,7 @@ DISK_PCALLBACK callback = ctx->callback; sim_debug_unit (ctx->dbit, uptr, "_disk_completion_dispatch(unit=%d, dop=%d, callback=%p)\n", (int)(uptr - ctx->dptr->units), ctx->io_dop, (void *)(ctx->callback)); if (ctx->io_dop != DOP_DONE) - sim_abort ("_disk_completion_dispatch()", __FILE__, __LINE__); /* horribly wrong, stop */ + SIM_SCP_ABORT ("_disk_completion_dispatch()"); /* horribly wrong, stop */ if (ctx->callback && ctx->io_dop == DOP_DONE) { ctx->callback = NULL; diff --git a/sim_ether.c b/sim_ether.c index 6f7a53e1..47211099 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -3721,7 +3721,7 @@ switch (dev->eth_api) { break; default: bpf_used = to_me = 0; /* Should NEVER happen */ - sim_abort ("_eth_callback()", __FILE__, __LINE__); + SIM_SCP_ABORT ("_eth_callback()"); break; } diff --git a/sim_tape.c b/sim_tape.c index 6feff983..5580c18f 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -187,7 +187,7 @@ if ((callback == NULL) || !(ctx->asynch_io)) "sim_tape AIO_CALL(op=%d, unit=%d)\n", op, (int)(uptr-ctx->dptr->units));\ \ if (ctx->callback) /* horrible mistake, stop */ \ - sim_abort ("AIO_CALL error", __FILE__, __LINE__); \ + SIM_SCP_ABORT ("AIO_CALL error"); \ ctx->io_top = op; \ ctx->buf = _buf; \ ctx->bc = _bc; \ @@ -325,7 +325,7 @@ TAPE_PCALLBACK callback = ctx->callback; sim_debug_unit (ctx->dbit, uptr, "_tape_completion_dispatch(unit=%d, top=%d, callback=%p)\n", (int)(uptr-ctx->dptr->units), ctx->io_top, ctx->callback); if (ctx->io_top != TOP_DONE) - sim_abort ("_tape_completion_dispatch()", __FILE__, __LINE__); /* horribly wrong, stop */ + SIM_SCP_ABORT ("_tape_completion_dispatch()"); /* horribly wrong, stop */ if (ctx->asynch_io) pthread_mutex_lock (&ctx->io_lock); diff --git a/sim_tmxr.c b/sim_tmxr.c index 8370962e..1ee64baa 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -3898,7 +3898,7 @@ while (sim_asynch_enabled) { if (select_errno == EINTR) break; sim_printf ("select() returned -1, errno=%d - %s\r\n", select_errno, strerror(select_errno)); - sim_abort ("", __FILE__, __LINE__); + SIM_SCP_ABORT (""); break; default: wait_count = 0; @@ -4015,7 +4015,7 @@ while (sim_asynch_enabled) { switch (status) { case WAIT_FAILED: sim_printf ("WaitForMultipleObjects() Failed, LastError=%d\r\n", GetLastError()); - sim_abort ("", __FILE__, __LINE__); + SIM_SCP_ABORT (""); break; case WAIT_TIMEOUT: sim_debug (TMXR_DBG_ASY, dptr, "_tmxr_serial_poll() - Poll Timeout - %dms\n", timeout_usec/1000); @@ -4126,7 +4126,7 @@ while (sim_asynch_enabled) { &iosb, 0, 0, buf, 1, 1, term, 0, 0); if (status != SS$_NORMAL) { sim_printf ("_tmxr_serial_line_poll() - QIO Failed, Status=%d\r\n", status); - sim_abort ("", __FILE__, __LINE__); + SIM_SCP_ABORT (""); } wait_count = 0; sys$synch (0, &iosb);