From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 30 03:35:22 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1258316A4CE for ; Thu, 30 Oct 2003 03:35:22 -0800 (PST) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 311F243F75 for ; Thu, 30 Oct 2003 03:35:21 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfim6.dialup.mindspring.com ([165.247.202.198] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1AFB5D-0004z2-00; Thu, 30 Oct 2003 03:35:20 -0800 Message-ID: <3FA0F745.7B9E34F0@mindspring.com> Date: Thu, 30 Oct 2003 03:34:29 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "Vinod R. Kashyap" References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4802c02d67900a489e430697ac4e3d2f4a8438e0f32a48e08350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: freeing data segment X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2003 11:35:22 -0000 "Vinod R. Kashyap" wrote: > I have this huge data structure in the data segment of my scsi driver. This > data structure is initialized at driver build time, and is used only during > driver > initialization. I am trying to find out if I can free-up the memory it > occupies, > once I am done with the driver initialization. Does anyone know how to do > this? You can either implement it in a separate ELF section that's marked "init only" (this is a defined ELF attribute), and then fix FreeBSD to honor discarding of such sections (FreeBSD doesn't implement very much of the capabilities of ELF), or... You can make two drivers, make the init driver depend on the other driver, load the init driver, have it's init routine call an entry point in the other driver to give it a callback into itself, do the callback to do the actual initialization, and then unload the second driver. Convoluted, but it works (I used it for a firmware downaload in a GigE driver at one point). -- Terry