From owner-freebsd-hackers Thu Jan 11 2:40: 5 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id C612837B400 for ; Thu, 11 Jan 2001 02:39:45 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0BAdS309075; Thu, 11 Jan 2001 02:39:28 -0800 (PST) Date: Thu, 11 Jan 2001 02:39:28 -0800 From: Alfred Perlstein To: Mohana Krishna Penumetcha Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: kernel debugging!!! Message-ID: <20010111023928.X7240@fw.wintelcom.net> References: <39C1BC04.4A534A80@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from pmk@sasi.com on Thu, Jan 11, 2001 at 03:55:56PM +0530 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Mohana Krishna Penumetcha [010111 02:26] wrote: > > > we are testing our driver for 4.0 freeBSD. kernel is panicing in the > attach routine with the message "double fault". the longest sequence of > function calls from the attach routine use 180 bytes of kernel stack(this > includes only the local variable), i read in the mailing lists that kernel > stack size is 256 bytes. is there a way i can know what is my current > kernel stack usage? Afaik, on i386 you have ~4k of kernel stack, however you have to realize that driver entry can come from an interrupt generated when the stack is already nearly exhausted. I'm not really that much of a driver programmer, but I've heard of people facing this problem before, solutions varied, but since each driver instance is single threaded you can pre-allocate via malloc (i think) the space you need and attach it to the per-driver data structure (softc afaik). > we enabled the DDB by selecting the DDB option in the configuration file. > After kernel panics control doesn't always go to DDB, did i miss anything > while enabling DDB? Probably not. > when control goes to DDB, it is printing eip, esp, ebp register values > along with some other information. but when i use trace command, it is > listing the trace from trap only. i think when kernel double faults, > original stack trace won't be available. can i know where is the problem > from the above three register values? My first solution would be to rip out your current "attach" code and make sure you're actually getting into it by replacing the routine with a simple 'printf("hello world")' before worrying about kernel stacks and whatnot. If even that does work, then try to take a simple driver from the kernel source (or there may be examples in /usr/share/examples) and try to get it to link properly. Basically, take small steps first, and tread lightly, I don't write drivers, just chat with a bunch of people that do. :) -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message