From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 24 17:38:41 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 6AC3D16A400; Sun, 24 Feb 2008 17:38:41 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id B8D7D13C448; Sun, 24 Feb 2008 17:38:40 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id m1OHccpR031634; Sun, 24 Feb 2008 18:38:39 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.1/8.14.1/Submit) id m1OHccfW031633; Sun, 24 Feb 2008 18:38:38 +0100 (CET) (envelope-from olli) Date: Sun, 24 Feb 2008 18:38:38 +0100 (CET) Message-Id: <200802241738.m1OHccfW031633@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG, koitsu@FreeBSD.ORG In-Reply-To: <20080224145940.GA41037@eos.sc1.parodius.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE-20070808 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Sun, 24 Feb 2008 18:38:39 +0100 (CET) Cc: Subject: Re: loader and ficl/Forth help X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG, koitsu@FreeBSD.ORG 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 17:38:41 -0000 Jeremy Chadwick wrote: > So I've finally gotten around to attempting a feature I mentionted back > in June 2007: using ASCII line-drawing characters for the borders around > beastie/fbsdlogo in frames.4th: > > http://lists.freebsd.org/pipermail/freebsd-hackers/2007-June/020851.html > > I was hoping there might be some folks familiar with the existing Forth > pieces in /boot who could help, since debugging this is incredibly > difficult. This is my first time with Forth, which is probably where > the true problem lies... 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 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. > My idea was to implement a loader_logo_lines loader variable, which you > could set to "ascii" to achieve the desired effect -- but simultaneously > retaining support for the PC98 character set, and the CP437 (IBM PC > ANSI) set if the variable isn't defined, or is set to something it > doesn't understand. 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. > So far I've managed to crash loader(8) doing the below, with the message > "sh_el not found" from ficl on the serial console, then either an > infinite register dump or an automatic reboot. > > I moved the PC98 and CP437 line constants into routines named pc98_lines > and cp437_lines repectively, and made one called ascii_lines. The main > code piece I changed in frames.4th became this: > > s" loader_logo_lines" getenv > dup -1 = if > drop > s" arch-pc98" environment? if > drop > pc98_lines > else > drop > cp437_lines > then > then > 2dup s" ascii" compare-insensitive 0= if > 2drop > ascii_lines > then > 2drop > cp437_lines 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. The following snippet should work better, but I have't actually tried it myself, so it's just theory. 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 Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "Emacs ist für mich kein Editor. Für mich ist das genau das gleiche, als wenn ich nach einem Fahrrad (für die Sonntagbrötchen) frage und einen pangalaktischen Raumkreuzer mit 10 km Gesamtlänge bekomme. Ich weiß nicht, was ich damit soll." -- Frank Klemm, de.comp.os.unix.discussion