Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2003 03:34:29 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        "Vinod R. Kashyap" <vinodrk@hotmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: freeing data segment
Message-ID:  <3FA0F745.7B9E34F0@mindspring.com>
References:  <BAY2-F168Sc6pT0giSf0001cfb4@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FA0F745.7B9E34F0>