Fixed a race that caused panics in kernel printfs when the screen timeout

routine changed the screen pointers while output was in progress.
This commit is contained in:
Bruce Evans 1996-05-01 03:58:21 +00:00
parent eabe0f9f57
commit b1d3d2ffcf
3 changed files with 15 additions and 6 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $
* $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $
*/
#include "sc.h"
@ -1215,6 +1215,7 @@ void
sccnputc(dev_t dev, int c)
{
u_char buf[1];
int s;
scr_stat *scp = console[0];
term_stat save = scp->term;
@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c)
kernel_console = scp->term;
current_default = &user_default;
scp->term = save;
if (scp == cur_console /* && scrn_timer not running */) {
s = splclock(); /* XXX stop scrn_timer */
if (scp == cur_console) {
if (scp->scr_buf != Crtat && (scp->start <= scp->end)) {
bcopyw(scp->scr_buf + scp->start, Crtat + scp->start,
(1 + scp->end - scp->start) * sizeof(u_short));
@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c)
}
draw_cursor(scp, TRUE);
}
splx(s);
}
int

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $
* $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $
*/
#include "sc.h"
@ -1215,6 +1215,7 @@ void
sccnputc(dev_t dev, int c)
{
u_char buf[1];
int s;
scr_stat *scp = console[0];
term_stat save = scp->term;
@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c)
kernel_console = scp->term;
current_default = &user_default;
scp->term = save;
if (scp == cur_console /* && scrn_timer not running */) {
s = splclock(); /* XXX stop scrn_timer */
if (scp == cur_console) {
if (scp->scr_buf != Crtat && (scp->start <= scp->end)) {
bcopyw(scp->scr_buf + scp->start, Crtat + scp->start,
(1 + scp->end - scp->start) * sizeof(u_short));
@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c)
}
draw_cursor(scp, TRUE);
}
splx(s);
}
int

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $
* $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $
*/
#include "sc.h"
@ -1215,6 +1215,7 @@ void
sccnputc(dev_t dev, int c)
{
u_char buf[1];
int s;
scr_stat *scp = console[0];
term_stat save = scp->term;
@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c)
kernel_console = scp->term;
current_default = &user_default;
scp->term = save;
if (scp == cur_console /* && scrn_timer not running */) {
s = splclock(); /* XXX stop scrn_timer */
if (scp == cur_console) {
if (scp->scr_buf != Crtat && (scp->start <= scp->end)) {
bcopyw(scp->scr_buf + scp->start, Crtat + scp->start,
(1 + scp->end - scp->start) * sizeof(u_short));
@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c)
}
draw_cursor(scp, TRUE);
}
splx(s);
}
int