Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Initialize ring buffer pointers when the ring buf...



details:   https://anonhg.NetBSD.org/src/rev/d3e0f8380063
branches:  trunk
changeset: 499373:d3e0f8380063
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Sat Nov 18 15:46:23 2000 +0000

description:
Initialize ring buffer pointers when the ring buffer is allocated.
(comsoft() can be invoked before comopen() on serial consoles; a character
received before the console is opened "for real" can result in a fatal trap
unless the ring buffer pointers are initialized early)

diffstat:

 sys/dev/ic/com.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r ab4fdcf06ab5 -r d3e0f8380063 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Sat Nov 18 12:15:50 2000 +0000
+++ b/sys/dev/ic/com.c  Sat Nov 18 15:46:23 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com.c,v 1.181 2000/11/01 23:54:57 eeh Exp $    */
+/*     $NetBSD: com.c,v 1.182 2000/11/18 15:46:23 sommerfeld Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -523,6 +523,8 @@
 
        sc->sc_tty = tp;
        sc->sc_rbuf = malloc(com_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
+       sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf;
+       sc->sc_rbavail = com_rbuf_size;
        if (sc->sc_rbuf == NULL) {
                printf("%s: unable to allocate ring buffer\n",
                    sc->sc_dev.dv_xname);



Home | Main Index | Thread Index | Old Index