From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 24 20:03:06 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37AFD16A401 for ; Sun, 24 Feb 2008 20:03:06 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id 0625613C4E1 for ; Sun, 24 Feb 2008 20:03:05 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id E963F1CC033; Sun, 24 Feb 2008 12:03:05 -0800 (PST) Date: Sun, 24 Feb 2008 12:03:05 -0800 From: Jeremy Chadwick To: Oliver Fromme Message-ID: <20080224200305.GA49564@eos.sc1.parodius.com> References: <20080224145940.GA41037@eos.sc1.parodius.com> <200802241738.m1OHccfW031633@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200802241738.m1OHccfW031633@lurza.secnetix.de> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-hackers@freebsd.org Subject: Re: loader and ficl/Forth help X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Feb 2008 20:03:06 -0000 On Sun, Feb 24, 2008 at 06:38:38PM +0100, Oliver Fromme wrote: > There's a debugging aid called "testmain" so you can run > Forth code interactively in multi-user mode for testing > purposes. For details please read the thread starting > here: > > http://lists.freebsd.org/pipermail/freebsd-stable/2005-May/015387.html Thanks! This helps a lot. I'm able to reproduce the sh_el not found condition with testmain. > Personally I use qemu for testing loader things. I wrote > a trivial script that updates a small disk image and then > boot its in qemu, which only takes two or three seconds, > so testing cycles are pretty short. Hmm, interesting software. I'm used to VMware myself, but this seems a bit less bloated. I'd have to run it on Windows, since I don't use FreeBSD as a workstation (no SDL, no VNC/X, etc.). The FreeBSD box in my home runs Samba, so I should be able to set up a method of creating ISO images of FreeBSD, which I can then test via qemu on Windows via CIFS/SMB share... > I suggest you switch to ASCII characters automatically if > the loader is running on comconsole (i.e. serial), and use > CP437 it it is running on vidconsole (i.e. VGA). Then > there will be no need to manually switch a variable. Great idea; I think I'll go with that. > I think the stack layout is not correct, particularly the > drops aren't quite right in some branches of the "if" > statements, I think. It's best to make a stack diagram > on paper and go through all possible branches with it. I have a lot more reading to do on the subject of Forth. Stacks are hardly a new concept to me, but the conditions where Forth puts something onto the stack are. I've never worked with a language like this before (at least RPN doesn't frustrate me!). I've already found some reading material which should help. > s" loader_logo_lines" getenv > dup -1 = if > drop > s" arch-pc98" environment? if > drop > pc98_lines > else > cp437_lines > then > else > s" ascii" compare-insensitive 0= if > ascii_lines > else > cp437_lines > then > then Again, thanks -- I don't quite understand the changes yet, but will after I read aforementioned documents. Sadly, the "sh_el not found" error still continues with this code -- but it does fix the crashing I was seeing. I believe the problem is that constants cannot be put inside of a function (functions being runtime things, not compile-time things). Since the original code used compile-time conditions ([if], etc.), it meant that only one declaration for sh_el, sv_el, etc. was made. Since the *_lines functions are doing the assignments, I had to change them all to runtime, e.g.: 149 sh_el ! 150 sv_el ! And so on, ditto with adding "variable sh_el", "variable sv_el" and others to the very top of frames.4th. This actually fixed the "not found" error, and now I'm stuck with "Error: compile only!" being induced by the "dup -1 = if" line. The same happens when running this natively (outside of testmain). I'll have to get the qemu stuff set up so I can test this more easily. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |