From nobody@FreeBSD.org  Tue Apr  9 18:23:38 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id DE73E37B417
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  9 Apr 2002 18:23:33 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g3A1NX604113;
	Tue, 9 Apr 2002 18:23:33 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200204100123.g3A1NX604113@freefall.freebsd.org>
Date: Tue, 9 Apr 2002 18:23:33 -0700 (PDT)
From: "Kamal R. Prasad" <kamalpr@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kldload causes kernel panic
X-Send-Pr-Version: www-1.0

>Number:         36944
>Category:       i386
>Synopsis:       kldload causes kernel panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 09 18:30:01 PDT 2002
>Closed-Date:    Wed Apr 10 09:55:32 PDT 2002
>Last-Modified:  Wed Apr 10 09:55:32 PDT 2002
>Originator:     Kamal R. Prasad
>Release:        4.5-STABLE
>Organization:
>Environment:
>Description:
I have a sample  device driver which when we try to load, causes a kernel panic because of a page fault. (Im new to device drivers so pl. excuse me for any bugs in the code). the c code(chardev_example.c) is pasted below:-
-----------------------------------------------
#include <sys/types.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/kernel.h>


static int chardev_example_load(struct module* m, int what, void* ar
{
        int err = 0;

        switch (what)
        {
                case MOD_LOAD : uprintf("skeleton kld loaded\n");
                        break;
                case MOD_UNLOAD : uprintf("skeleton kld un-loaded\n"
                        break;
                default:
                        err = EINVAL;
                        break;
        }
        return err;
}

DECLARE_MODULE(chardev_example, chardev_example_load, SI_SUB_KLD, SI_ORDER_ANY);
----------------------------------------------------------
the Makefile is pasted below:-
-----------------------------------------
SRCS=chardev_example.c
KMOD=chardev_example

.include <bsd.kmod.mk>
-----------------------------------------


>How-To-Repeat:
make
kldload -v ./chardev_example.ko

>Fix:
      
>Release-Note:
>Audit-Trail:

From: Kamal Prasad <kamalpr@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org, kamalpr@yahoo.com
Cc:  
Subject: Re: i386/36944: kldload causes kernel panic
Date: Tue, 9 Apr 2002 18:50:34 -0700 (PDT)

 this is because I did not define moduledata_t
 chardev_example.
 
 
 __________________________________________________
 Do You Yahoo!?
 Yahoo! Tax Center - online filing with TurboTax
 http://taxes.yahoo.com/
State-Changed-From-To: open->closed 
State-Changed-By: roam 
State-Changed-When: Wed Apr 10 09:54:51 PDT 2002 
State-Changed-Why:  
Turned out the problem was due to pilot error. 
Still, thank you for trying to enhance FreeBSD by bringing up 
what you considered a genuine problem! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36944 
>Unformatted:
