<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/sys/boot/forth/support.4th, branch release/8.2.0_cvs</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F8.2.0_cvs</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F8.2.0_cvs'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2011-02-16T16:18:46Z</updated>
<entry>
<title>Copy releng/8.2 to release/8.2.0 for 8.2-RELEASE.</title>
<updated>2011-02-16T16:18:46Z</updated>
<author>
<name>Ken Smith</name>
<email>kensmith@FreeBSD.org</email>
</author>
<published>2011-02-16T16:18:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=dec99dafe5763ba1db6950342aa80a634169c083'/>
<id>urn:sha1:dec99dafe5763ba1db6950342aa80a634169c083</id>
<content type='text'>
Approved by:	re (implicit)

This commit was manufactured to restore the state of the 8.2-RELEASE image.
</content>
</entry>
<entry>
<title>comment out some debugging messages that slipped in by mistake.</title>
<updated>2009-01-13T12:28:14Z</updated>
<author>
<name>Luigi Rizzo</name>
<email>luigi@FreeBSD.org</email>
</author>
<published>2009-01-13T12:28:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=2ca710fbbc9242bcaaf08e17d46fe10267247050'/>
<id>urn:sha1:2ca710fbbc9242bcaaf08e17d46fe10267247050</id>
<content type='text'>
MFC after:	3 days
</content>
</entry>
<entry>
<title>This patch introduces a number of simplifications to the Forth</title>
<updated>2009-01-05T20:09:54Z</updated>
<author>
<name>Luigi Rizzo</name>
<email>luigi@FreeBSD.org</email>
</author>
<published>2009-01-05T20:09:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=065188a6300fb53e66c2f09af2d3974ef4067d77'/>
<id>urn:sha1:065188a6300fb53e66c2f09af2d3974ef4067d77</id>
<content type='text'>
functions used in the bootloader. The goal is to make the code more
readable and smaller (especially because we have size issues
in the loader's environment).

High level description of the changes:
+ define some string manipulation functions to improve readability;
+ create functions to manipulate module descriptors, removing some
  duplicated code;
+ rename the error codes to ESOMETHING;
+ consistently use set_environment_variable (which evaluates
  $variables) when interpreting variable=value assignments;

I have tested the code, but there might be code paths that I have
not traversed so please let me know of any issues.

Details of this change:

--- loader.4th ---
+ add some module operators, to remove duplicated code while parsing
  module-related commands:

        set-module-flag
        enable-module
        disable-module
        toggle-module
        show-module

--- pnp.4th ---
+ move here the definition related to the pnp devices list, e.g.
  STAILQ_* , pnpident, pnpinfo

--- support.4th ---
+ rename error codes to capital e.g. ENOMEM EFREE ... and do obvious
  changes related to the renaming;
+ remove unused structures (those relevant to pnp are moved to pnp.4th)
+ various string functions
  - strlen removed (it is an internal function)
  - strchr, defined as the C function
  - strtype -- type a string to output
  - strref -- assign a reference to the string on the stack
  - unquote -- remove quotes from a string

+ remove reset_line_buffer

+ move up the 'set_environment_variable' function (which now
  uses the interpreter, so $variables are evaluated).
  Use the function in various places

+ add a 'test_file function' for debugging purposes

MFC after:	4 weeks
</content>
</entry>
<entry>
<title>PROBLEM: putting in a loader config file a line of the form</title>
<updated>2008-12-07T19:42:20Z</updated>
<author>
<name>Luigi Rizzo</name>
<email>luigi@FreeBSD.org</email>
</author>
<published>2008-12-07T19:42:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=5e5391084a3c5a60bc0ab098e73638c122797ac8'/>
<id>urn:sha1:5e5391084a3c5a60bc0ab098e73638c122797ac8</id>
<content type='text'>
        loader_conf_files="foo bar baz"

should cause loading the files listed, and then resume with the
remaining config files (from previous values of the variable).
Unfortunately, sometimes the line was ignored -- actually even
modifying the line in /boot/default/loader.conf  sometimes doesn't work.

ANALYSIS: After much investigation, turned out to be a bug in the logic.
The existing code detected a new assignment by looking at the address
of the the variable containing the string. This only worked by pure
chance, i.e. if the new string is longer than the previous value
then the memory allocator may return a different address
to store the string hence triggering the detection.

SOLUTION: This commit contains a minimal change to fix the problem,
without altering too much the existing structure of the code.
However, as a step towards improving the quality and reliability of
this code, I have introduced a handful of one-line functions
(strget, strset, strfree, string= ) that could be used in dozens
of places in the existing code.

HOWEVER:
There is a much bigger problem here. Even though I am no Forth
expert (as most fellow src committers) I can tell that much of the
forth code (in support.4th at least) is in severe need of a
review/refactoring:

+ pieces of code are replicated multiple times instead of writing
  functions (see e.g.  set_module_*);

+ a lot of stale code (e.g. "structure" definitions for
  preloaded_files, kernel_module, pnp stuff) which is not used
  or at least belongs elsewhere.
  The code bload is extremely bad as the loader runs with very small
  memory constraints, and we already hit the limit once (see

    http://svn.freebsd.org/viewvc/base?view=revision&amp;revision=185132
  Reducing the footprint of the forth files is critical.

+ two different styles of coding, one using pure stack functions
  (maybe beautiful but surely highly unreadable), one using
  high level mechanisms to give names to arguments and local
  variables (which leads to readable code).

Note that this code is used by default by all FreeBSD installations,
so the fragility and the code bloat are extremely damaging.
I will try to work fixing the three items above, but if others have
time, please have a look at these issues.

MFC after:	4 weeks
</content>
</entry>
<entry>
<title>Allow negative values to be specified in the loader.</title>
<updated>2007-12-19T17:06:32Z</updated>
<author>
<name>Doug Ambrisko</name>
<email>ambrisko@FreeBSD.org</email>
</author>
<published>2007-12-19T17:06:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=c609b15425fde04da428184d1f8fe12832b5469e'/>
<id>urn:sha1:c609b15425fde04da428184d1f8fe12832b5469e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Replace a rarely used "depuration" with "debugging".</title>
<updated>2006-10-13T20:48:17Z</updated>
<author>
<name>Ruslan Ermilov</name>
<email>ru@FreeBSD.org</email>
</author>
<published>2006-10-13T20:48:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=675e8ac08cb5d8a91416fdbc689d6888feb06d66'/>
<id>urn:sha1:675e8ac08cb5d8a91416fdbc689d6888feb06d66</id>
<content type='text'>
PR:		docs/85127
Submitted by:	Gary W. Swearingen (partially)
MFC after:	3 days
</content>
</entry>
<entry>
<title>Add support for reading an additional loader configuration file. By default,</title>
<updated>2002-05-24T02:28:58Z</updated>
<author>
<name>Gordon Tetlow</name>
<email>gordon@FreeBSD.org</email>
</author>
<published>2002-05-24T02:28:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=666df9ddf35c5db4ee084fe76225336b9df712fa'/>
<id>urn:sha1:666df9ddf35c5db4ee084fe76225336b9df712fa</id>
<content type='text'>
this is called /boot/nextboot.conf. This file is required to have it's first
line be nextboot_enable="YES" for it to be read. Also, this file is
rewritten by the loader to nextboot_enable="NO"&lt;space&gt; after it is read.
This makes it so the file is read exactly once. Finally, the nextboot.conf
is removed shortly after the filesystems are mounted r/w.

Caution should be taken as you can shoot yourself in the foot. This is only
the loader piece. There will be a tool called nextboot(8) that will manage
the nextboot.conf file for you. It is coming shortly.

Reviewed by:	dcs
Approved by:	jake (mentor)
</content>
</entry>
<entry>
<title>- Add 'fwrite' and 'fseek' words for writing to and seeking on files.</title>
<updated>2001-12-11T00:49:34Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2001-12-11T00:49:34Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=0889b9be414989d292712d60a1e2fcd837eaf504'/>
<id>urn:sha1:0889b9be414989d292712d60a1e2fcd837eaf504</id>
<content type='text'>
- Change the 'fopen' keyword to accept a mode parameter.  Note that this
  will break existing 4th scripts that use fopen.  Thus, the loader
  version has been bumped and loader.4th has been changed to check for a
  sufficient version on i386 and alpha.  Be sure that you either do a full
  world build or install or full build and install of sys/boot after this
  since loader.old won't work with the new 4th files and vice versa.

PR:		kern/32389
Submitted by:	Jonathan Mini &lt;mini@haikugeek.com&gt;
Sponsored by:	ClickArray, Inc.
</content>
</entry>
<entry>
<title>Get rid of garbage left on the stack.</title>
<updated>2000-09-25T11:36:55Z</updated>
<author>
<name>Daniel C. Sobral</name>
<email>dcs@FreeBSD.org</email>
</author>
<published>2000-09-25T11:36:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=530df9baad1ae23cf5fbd52690b37e20ac41d066'/>
<id>urn:sha1:530df9baad1ae23cf5fbd52690b37e20ac41d066</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use _ instead or - where proper, according to the style I have been</title>
<updated>2000-09-16T21:04:49Z</updated>
<author>
<name>Daniel C. Sobral</name>
<email>dcs@FreeBSD.org</email>
</author>
<published>2000-09-16T21:04:49Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=818c39998ed7789491c4ab6be234818e07710dd8'/>
<id>urn:sha1:818c39998ed7789491c4ab6be234818e07710dd8</id>
<content type='text'>
using.

Overload "?" so it will also show loader.4th commands.
</content>
</entry>
</feed>
