*BSD News Article 59508


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!yarrina.connect.com.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!news.mathworks.com!fu-berlin.de!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Device Driver questions
Date: 12 Jan 1996 23:15:13 GMT
Organization: Private BSD site, Dresden
Lines: 29
Message-ID: <4d6q21$h7c@uriah.heep.sax.de>
References: <4cukoi$1cbl@olympus.bzn.vlt.eds.com>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.3

carlson@olympus.bzn.vlt.eds.com (Brent Carlson) writes:

> 1)  I have an ioctl routine.  [...] 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?

Yes, this is BSD.  The size and direction of the data transfer are
encoded into the ioctl command itself (by the _IO, _IOR, and _IOW
macros), and evaluated by the generic ioctl() code.

> 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.

Perhaps you're dereferencing invalid pointers with the printf's?

Configure your kernel to include the DDB kernel debugger, and analyze
the failure when it happens.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)