Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Mar 1999 13:40:19 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        "Matthew N. Dodd" <winter@jurai.net>
Cc:        Mike Smith <mike@smith.net.au>, hackers@FreeBSD.ORG
Subject:   Re: Reading a file inside the kernel.
Message-ID:  <36E20333.884D63E7@newsguy.com>
References:  <Pine.BSF.4.02.9903062306220.15262-100000@sasami.jurai.net>

next in thread | previous in thread | raw e-mail | index | archive | help
"Matthew N. Dodd" wrote:
> 
> Any pointers on writing the probe/download code in Forth?  I'm assuming
> I'll need to learn Forth first, but what are the entry points for drivers
> in BootForth?

I suspect the idea is a forth code, loaded at "loader" time, that
would do the probing and then load the appropriate file with load -t
something, for later use by the driver by the driver at boot time.

It would be along this line:

: card_exists? ( -- flag ) <code> ;
: which_card? ( -- n ) <code> ;
: probe ( -- n | 0 ) card_exists? if which_card? else false then ;
<some sort of table to convert "n" into a filename>
: load-microcode ( n -- ) n-to-name s" -t my_type" load ;
: probe-and-load ( -- flag ) probe ?dup if ['] load-microcode catch
then ;
probe-and-load [if] .( Could not load microcode! ) cr [then]


Only, hopefully, prettier. :-) With the about-to-be-introduced new
loader.rc mechanism, you would actually place something similar to
the above code in a microcode_probe.4th file, then add the following
lines to loader.conf:

yourmodulename_load="yes"
yourmodulename_beforeload="probe-and-load"
exec="include microcode_probe.4th"


The thing is... bootforth is an afterthought of three-stage boot
loader, not a solution carefully designed. It was along the lines
"hey, we are beginning to write a scripting language, so not just
add one?", and ficl was selected because it was small enough (and
easy to plug in). :-) So, nobody actually stopped and made sure
everything one needs is there. Dynamic memory allocation almost
didn't made 3.1-RELEASE... :-) There is inb/outb, for instance, but
if the probe requires anything else, it will probably have to be
added.

And until the time comes when someone actually wants to do something
like this, it is unlikely that the situation will change. Me, I'm
working to make bootforth useful, but the only driver I ever wrote
didn't need anything more than inb/outb.

--
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com
dcs@freebsd.org

	"FreeBSD is Yoda, Linux is Luke Skywalker."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36E20333.884D63E7>