Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Feb 2008 18:38:38 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-hackers@FreeBSD.ORG, koitsu@FreeBSD.ORG
Subject:   Re: loader and ficl/Forth help
Message-ID:  <200802241738.m1OHccfW031633@lurza.secnetix.de>
In-Reply-To: <20080224145940.GA41037@eos.sc1.parodius.com>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802241738.m1OHccfW031633>