*BSD News Article 59131


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.cis.okstate.edu!news.ksu.ksu.edu!news.mid.net!news.dra.com!news.id.net!news.cic.net!condor.ic.net!news2.acs.oakland.edu!newshub.gmr.com!hobbes.tad.eds.com!maverick.tad.eds.com!usenet.bzn.vlt.eds.com!not-for-mail
From: carlson@olympus.bzn.vlt.eds.com (Brent Carlson)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Device Driver questions
Date: 9 Jan 1996 13:55:46 -0700
Organization: Video Lottery Consultants, Bozeman MT.
Lines: 25
Message-ID: <4cukoi$1cbl@olympus.bzn.vlt.eds.com>
NNTP-Posting-Host: olympus.bzn.vlt.eds.com

I'm writing a FreeBSD device driver.  The driver seems to work
fine most of the time.  I have a couple questions:

1)  I have an ioctl routine.  I could not get copyin/copyout to
    work correctly.  The copyin/copyout fails with an EFAULT.
    After reviewing the ioctl function code in
    /usr/src/sys/kern/sys_generic.c it appears that ioctl does
    the copyin/copyout for me and that I don't have to use these
    functions in ioctl function.  Is this assumption correct?

2)  I have a number of printf statements in my device driver.
    These are only needed for debugging and generally do not
    execute (due to ifdefs).  However, I've noticed when I do
    turn the printf's on, often the system will crash with a
    page fault while in kernel mode (fatal trap 12).  Is this
    due to the printf?  What's causing the page fault?  I've 
    never had the PC crash when the printf's are turned off.

Thanks for your help.

-- 
                           \_     \_  \_     \_\_\_\_\_
Brent Carlson               \_   \_   \_         \_    VLT Info Services/EDS
(406) 585-6600 ext. 5123     \_ \_    \_         \_    2311 South 7th Avenue
carlson@bzn.vlt.eds.com       \_      \_\_\_\_   \_    Bozeman, MT  59715