Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 1997 18:56:02 +0100 (MET)
From:      hans@brandinnovators.com (Hans Zuidam)
To:        hackers@freebsd.org
Subject:   driver panic
Message-ID:  <199703271756.SAA00260@truk.brandinnovators.com>

next in thread | raw e-mail | index | archive | help
Hi,

I have a driver which does:

    /*
     * As long as there's data, try to fill the output buffer to
     * it's maximum size.  If the number of bytes is not a multiple
     * of four round down, effectively forgetting up to three bytes.
     */
    while ((n = min((BUFSIZE - bp->b_olen), uio->uio_resid)) != 0) {
        if (n & 0x3) n &= ~0x3;
        if (n > 0) {
            uiomove(((u_char *) bp->b_obuf) + bp->b_olen, n, uio);
            bp->b_olen += n;
        }
        else {
            splx(s);
            return 0;
        }

        /*
         * As long as there's something in the output buffer, write it.
         */
        while (bp->b_olen) {

		...
	}

	...
    }

while a test program did:

	u_long wo = 0L;
	r = write(fd, (char *) wo, 4);

which is obviously wrong.  What makes me wonder is why this causes
a page fault.  As far as I can see uiomove() is the only one
accessing the write buffer.  When I do the right thing (i.e. (char *) &wo)
everything is fine.  Anyone any idea?

Thanks in advance,
				Hans

-- 
H. Zuidam                        E-Mail: hans@brandinnovators.com
Brand Innovators B.V.            P-Mail: P.O. Box 1377
de Pinckart 54                   5602 BJ Eindhoven, The Netherlands
5674 CC Nuenen                   Tel. +31 40 2631134, Fax. +31 40 2831138



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703271756.SAA00260>