From 304ad39a2ba4280dba21ec86b6a0d639898aecfe Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 7 Nov 2013 08:02:00 -0800 Subject: [PATCH] VAX: Avoid potential VAX simulator hangs when code may poll for console input without being interrupted --- VAX/vax610_stddev.c | 10 ++++++---- VAX/vax630_stddev.c | 10 ++++++---- VAX/vax730_stddev.c | 10 ++++++---- VAX/vax750_stddev.c | 10 ++++++---- VAX/vax780_stddev.c | 10 ++++++---- VAX/vax860_stddev.c | 9 ++++++--- VAX/vax_stddev.c | 10 ++++++---- 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/VAX/vax610_stddev.c b/VAX/vax610_stddev.c index 8a55229c..d5b2b720 100644 --- a/VAX/vax610_stddev.c +++ b/VAX/vax610_stddev.c @@ -235,10 +235,12 @@ int32 rxdb_rd (void) { int32 t = tti_unit.buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ -CLR_INT (TTI); -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ + CLR_INT (TTI); + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; } diff --git a/VAX/vax630_stddev.c b/VAX/vax630_stddev.c index d66cb362..29480123 100644 --- a/VAX/vax630_stddev.c +++ b/VAX/vax630_stddev.c @@ -211,10 +211,12 @@ int32 rxdb_rd (void) { int32 t = tti_unit.buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ -CLR_INT (TTI); -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ + CLR_INT (TTI); + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; } diff --git a/VAX/vax730_stddev.c b/VAX/vax730_stddev.c index 71ddafe2..fb3bedae 100644 --- a/VAX/vax730_stddev.c +++ b/VAX/vax730_stddev.c @@ -626,10 +626,12 @@ int32 rxdb_rd (void) { int32 t = tti_buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_buf = tti_buf & BMASK; /* clr errors */ -tti_int = 0; -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_buf = tti_buf & BMASK; /* clr errors */ + tti_int = 0; + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; } diff --git a/VAX/vax750_stddev.c b/VAX/vax750_stddev.c index 9e68913f..bddb2a5a 100644 --- a/VAX/vax750_stddev.c +++ b/VAX/vax750_stddev.c @@ -619,10 +619,12 @@ int32 rxdb_rd (void) { int32 t = tti_buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_buf = tti_buf & BMASK; /* clr errors */ -tti_int = 0; -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_buf = tti_buf & BMASK; /* clr errors */ + tti_int = 0; + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; } diff --git a/VAX/vax780_stddev.c b/VAX/vax780_stddev.c index 63983255..d19eeff0 100644 --- a/VAX/vax780_stddev.c +++ b/VAX/vax780_stddev.c @@ -440,10 +440,12 @@ int32 rxdb_rd (void) { int32 t = tti_buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_buf = tti_buf & BMASK; /* clr errors */ -tti_int = 0; -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_buf = tti_buf & BMASK; /* clr errors */ + tti_int = 0; + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; } diff --git a/VAX/vax860_stddev.c b/VAX/vax860_stddev.c index c32efd9f..a5e04be8 100644 --- a/VAX/vax860_stddev.c +++ b/VAX/vax860_stddev.c @@ -453,9 +453,12 @@ return; int32 rxdb_rd (void) { int32 t = tti_buf; -t = t | ((ID_M_LC | ID_M_EMM | ID_M_CT) << RXDB_V_LC); /* char + DTR for hard-wired lines */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_int = 0; + +if (tti_csr & CSR_DONE) { /* Input pending ? */ + t = t | ((ID_M_LC | ID_M_EMM | ID_M_CT) << RXDB_V_LC);/* char + DTR for hard-wired lines */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_int = 0; + } return t; } diff --git a/VAX/vax_stddev.c b/VAX/vax_stddev.c index 8a5dc862..1eb5cbc1 100644 --- a/VAX/vax_stddev.c +++ b/VAX/vax_stddev.c @@ -274,10 +274,12 @@ int32 rxdb_rd (void) { int32 t = tti_unit.buf; /* char + error */ -tti_csr = tti_csr & ~CSR_DONE; /* clr done */ -tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ -CLR_INT (TTI); -sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ +if (tti_csr & CSR_DONE) { /* Input pending ? */ + tti_csr = tti_csr & ~CSR_DONE; /* clr done */ + tti_unit.buf = tti_unit.buf & 0377; /* clr errors */ + CLR_INT (TTI); + sim_activate_abs (&tti_unit, tti_unit.wait); /* check soon for more input */ + } return t; }