summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/scmouse.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2006-09-13 15:48:15 +0000
committerscottl <scottl@FreeBSD.org>2006-09-13 15:48:15 +0000
commitae1ca6fd73256507ef9094b93fec5b9760349c20 (patch)
tree3f6091ef6a36694ab3df9980406f14ca618e4170 /sys/dev/syscons/scmouse.c
parent3927aa447494d5f1b31035c64ecc9b2ae7401a52 (diff)
downloadFreeBSD-src-ae1ca6fd73256507ef9094b93fec5b9760349c20.zip
FreeBSD-src-ae1ca6fd73256507ef9094b93fec5b9760349c20.tar.gz
Introduce a spinlock for synchronizing access to the video output hardware
in syscons. This replaces a simple access semaphore that was assumed to be protected by Giant but often was not. If two threads that were otherwise SMP-safe called printf at the same time, there was a high likelyhood that the semaphore would get corrupted and result in a permanently frozen video console. This is similar to what is already done in the serial console drivers.
Diffstat (limited to 'sys/dev/syscons/scmouse.c')
-rw-r--r--sys/dev/syscons/scmouse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c
index 73455f3..54ca2ec 100644
--- a/sys/dev/syscons/scmouse.c
+++ b/sys/dev/syscons/scmouse.c
@@ -178,13 +178,13 @@ sc_draw_mouse_image(scr_stat *scp)
if (ISGRAPHSC(scp))
return;
- ++scp->sc->videoio_in_progress;
+ SC_VIDEO_LOCK(scp->sc);
(*scp->rndr->draw_mouse)(scp, scp->mouse_xpos, scp->mouse_ypos, TRUE);
scp->mouse_oldpos = scp->mouse_pos;
scp->mouse_oldxpos = scp->mouse_xpos;
scp->mouse_oldypos = scp->mouse_ypos;
scp->status |= MOUSE_VISIBLE;
- --scp->sc->videoio_in_progress;
+ SC_VIDEO_UNLOCK(scp->sc);
}
void
@@ -196,7 +196,7 @@ sc_remove_mouse_image(scr_stat *scp)
if (ISGRAPHSC(scp))
return;
- ++scp->sc->videoio_in_progress;
+ SC_VIDEO_LOCK(scp->sc);
(*scp->rndr->draw_mouse)(scp,
(scp->mouse_oldpos%scp->xsize + scp->xoff)
* scp->font_width,
@@ -217,7 +217,7 @@ sc_remove_mouse_image(scr_stat *scp)
}
#endif /* PC98 */
scp->status &= ~MOUSE_VISIBLE;
- --scp->sc->videoio_in_progress;
+ SC_VIDEO_UNLOCK(scp->sc);
}
int
OpenPOWER on IntegriCloud