From owner-freebsd-hackers Sat Mar 6 20:41:57 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id 9AC3314C10 for ; Sat, 6 Mar 1999 20:41:55 -0800 (PST) (envelope-from dcs@newsguy.com) Received: from newsguy.com by peach.ocn.ne.jp (8.9.1a/OCN) id NAA28768; Sun, 7 Mar 1999 13:41:38 +0900 (JST) Message-ID: <36E20333.884D63E7@newsguy.com> Date: Sun, 07 Mar 1999 13:40:19 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.5 [en] (Win98; I) X-Accept-Language: pt-BR,ja MIME-Version: 1.0 To: "Matthew N. Dodd" Cc: Mike Smith , hackers@FreeBSD.ORG Subject: Re: Reading a file inside the kernel. References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG "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 ) ; : which_card? ( -- n ) ; : probe ( -- n | 0 ) card_exists? if which_card? else false then ; : 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