SCP: Add unit to AIO_VALIDATE context message

This commit is contained in:
Mark Pizzolato 2018-08-08 11:51:54 -07:00
parent 44bc5116e7
commit 6070692581
6 changed files with 19 additions and 14 deletions

14
scp.c
View file

@ -10790,7 +10790,7 @@ return _sim_activate_after_abs (uptr, usec_delay);
t_stat _sim_activate_after_abs (UNIT *uptr, double usec_delay) t_stat _sim_activate_after_abs (UNIT *uptr, double usec_delay)
{ {
AIO_VALIDATE; /* Can't call asynchronously */ AIO_VALIDATE(uptr); /* Can't call asynchronously */
sim_cancel (uptr); sim_cancel (uptr);
return _sim_activate_after (uptr, usec_delay); return _sim_activate_after (uptr, usec_delay);
} }
@ -10807,8 +10807,8 @@ return _sim_activate_after (uptr, usec_delay);
t_stat _sim_activate_after (UNIT *uptr, double usec_delay) t_stat _sim_activate_after (UNIT *uptr, double usec_delay)
{ {
AIO_VALIDATE; /* Can't call asynchronously */ AIO_VALIDATE(uptr); /* Can't call asynchronously */
if (sim_is_active (uptr)) /* already active? */ if (sim_is_active (uptr)) /* already active? */
return SCPE_OK; return SCPE_OK;
return sim_timer_activate_after (uptr, usec_delay); return sim_timer_activate_after (uptr, usec_delay);
} }
@ -10826,7 +10826,7 @@ t_stat sim_cancel (UNIT *uptr)
{ {
UNIT *cptr, *nptr; UNIT *cptr, *nptr;
AIO_VALIDATE; AIO_VALIDATE(uptr);
if ((uptr->cancel) && uptr->cancel (uptr)) if ((uptr->cancel) && uptr->cancel (uptr))
return SCPE_OK; return SCPE_OK;
if (uptr->dynflags & UNIT_TMR_UNIT) if (uptr->dynflags & UNIT_TMR_UNIT)
@ -10881,7 +10881,7 @@ return SCPE_OK;
t_bool sim_is_active (UNIT *uptr) t_bool sim_is_active (UNIT *uptr)
{ {
AIO_VALIDATE; AIO_VALIDATE(uptr);
AIO_UPDATE_QUEUE; AIO_UPDATE_QUEUE;
return (((uptr->next) || AIO_IS_ACTIVE(uptr) || ((uptr->dynflags & UNIT_TMR_UNIT) ? sim_timer_is_active (uptr) : FALSE)) ? TRUE : FALSE); return (((uptr->next) || AIO_IS_ACTIVE(uptr) || ((uptr->dynflags & UNIT_TMR_UNIT) ? sim_timer_is_active (uptr) : FALSE)) ? TRUE : FALSE);
} }
@ -10917,7 +10917,7 @@ int32 sim_activate_time (UNIT *uptr)
{ {
int32 accum; int32 accum;
AIO_VALIDATE; AIO_VALIDATE(uptr);
accum = _sim_timer_activate_time (uptr); accum = _sim_timer_activate_time (uptr);
if (accum >= 0) if (accum >= 0)
return accum; return accum;
@ -10930,7 +10930,7 @@ UNIT *cptr;
int32 accum; int32 accum;
double result; double result;
AIO_VALIDATE; AIO_VALIDATE(uptr);
result = sim_timer_activate_time_usecs (uptr); result = sim_timer_activate_time_usecs (uptr);
if (result >= 0) if (result >= 0)
return result; return result;

View file

@ -1256,7 +1256,12 @@ extern int32 sim_asynch_inst_latency;
return SCPE_OK; \ return SCPE_OK; \
} else (void)0 } else (void)0
#endif /* USE_AIO_INTRINSICS */ #endif /* USE_AIO_INTRINSICS */
#define AIO_VALIDATE if (!pthread_equal ( pthread_self(), sim_asynch_main_threadid )) {sim_printf("Improper thread context for operation in %s line %d\n", __FILE__, __LINE__); abort();} #define AIO_VALIDATE(uptr) \
if (!pthread_equal ( pthread_self(), sim_asynch_main_threadid )) { \
sim_printf("Improper thread context for operation on %s in %s line %d\n", \
sim_uname(uptr), __FILE__, __LINE__); \
abort(); \
} else (void)0
#define AIO_CHECK_EVENT \ #define AIO_CHECK_EVENT \
if (0 > --sim_asynch_check) { \ if (0 > --sim_asynch_check) { \
AIO_UPDATE_QUEUE; \ AIO_UPDATE_QUEUE; \
@ -1272,7 +1277,7 @@ extern int32 sim_asynch_inst_latency;
#define AIO_QUEUE_MODE "Asynchronous I/O is not available" #define AIO_QUEUE_MODE "Asynchronous I/O is not available"
#define AIO_UPDATE_QUEUE #define AIO_UPDATE_QUEUE
#define AIO_ACTIVATE(caller, uptr, event_time) #define AIO_ACTIVATE(caller, uptr, event_time)
#define AIO_VALIDATE #define AIO_VALIDATE(uptr)
#define AIO_CHECK_EVENT #define AIO_CHECK_EVENT
#define AIO_INIT #define AIO_INIT
#define AIO_MAIN_THREAD TRUE #define AIO_MAIN_THREAD TRUE

View file

@ -1996,7 +1996,7 @@ if (!(uptr->flags & UNIT_ATT)) /* attached? */
sim_debug_unit (ctx->dbit, uptr, "sim_disk_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units)); sim_debug_unit (ctx->dbit, uptr, "sim_disk_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units));
_sim_disk_io_flush(uptr); _sim_disk_io_flush(uptr);
AIO_VALIDATE; AIO_VALIDATE(uptr);
AIO_UPDATE_QUEUE; AIO_UPDATE_QUEUE;
return SCPE_OK; return SCPE_OK;
} }

View file

@ -2439,7 +2439,7 @@ if (ctx == NULL) /* if not properly attac
sim_debug_unit (ctx->dbit, uptr, "sim_tape_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units)); sim_debug_unit (ctx->dbit, uptr, "sim_tape_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units));
_sim_tape_io_flush(uptr); _sim_tape_io_flush(uptr);
AIO_VALIDATE; AIO_VALIDATE(uptr);
AIO_UPDATE_QUEUE; AIO_UPDATE_QUEUE;
return SCPE_OK; return SCPE_OK;
} }

View file

@ -2508,7 +2508,7 @@ return inst_per_sec;
t_stat sim_timer_activate (UNIT *uptr, int32 interval) t_stat sim_timer_activate (UNIT *uptr, int32 interval)
{ {
AIO_VALIDATE; AIO_VALIDATE(uptr);
return sim_timer_activate_after (uptr, (double)((interval * 1000000.0) / sim_timer_inst_per_sec ())); return sim_timer_activate_after (uptr, (double)((interval * 1000000.0) / sim_timer_inst_per_sec ()));
} }
@ -2519,7 +2519,7 @@ int inst_delay, tmr;
double inst_delay_d, inst_per_usec; double inst_delay_d, inst_per_usec;
t_stat stat; t_stat stat;
AIO_VALIDATE; AIO_VALIDATE(uptr);
/* If this is a clock unit, we need to schedule the related timer unit instead */ /* If this is a clock unit, we need to schedule the related timer unit instead */
for (tmr=0; tmr<=SIM_NTIMERS; tmr++) for (tmr=0; tmr<=SIM_NTIMERS; tmr++)
if (sim_clock_unit[tmr] == uptr) { if (sim_clock_unit[tmr] == uptr) {

View file

@ -4260,7 +4260,7 @@ return _sim_activate (uptr, interval);
t_stat tmxr_activate_abs (UNIT *uptr, int32 interval) t_stat tmxr_activate_abs (UNIT *uptr, int32 interval)
{ {
AIO_VALIDATE; /* Can't call asynchronously */ AIO_VALIDATE(uptr); /* Can't call asynchronously */
sim_cancel (uptr); sim_cancel (uptr);
return tmxr_activate (uptr, interval); return tmxr_activate (uptr, interval);
} }