diff options
author | luigi <luigi@FreeBSD.org> | 2009-01-05 20:09:54 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2009-01-05 20:09:54 +0000 |
commit | 46249a2f7459b043ea535462ad382781d3bbc556 (patch) | |
tree | 2683a38a91eea5e1fd5210102d42416261c58691 /sys/boot/forth/pnp.4th | |
parent | f93aa92f65c1c87a7cca4edf05dd0374d309bd40 (diff) | |
download | FreeBSD-src-46249a2f7459b043ea535462ad382781d3bbc556.zip FreeBSD-src-46249a2f7459b043ea535462ad382781d3bbc556.tar.gz |
This patch introduces a number of simplifications to the Forth
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
Diffstat (limited to 'sys/boot/forth/pnp.4th')
-rw-r--r-- | sys/boot/forth/pnp.4th | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/boot/forth/pnp.4th b/sys/boot/forth/pnp.4th index 395164d..8cd6bea 100644 --- a/sys/boot/forth/pnp.4th +++ b/sys/boot/forth/pnp.4th @@ -24,6 +24,39 @@ \ \ $FreeBSD$ + +\ The following pnp code is used in pnp.4th and pnp.c +structure: STAILQ_HEAD + ptr stqh_first \ type* + ptr stqh_last \ type** +;structure + +structure: STAILQ_ENTRY + ptr stqe_next \ type* +;structure + +structure: pnphandler + ptr pnph.name + ptr pnph.enumerate +;structure + +structure: pnpident + ptr pnpid.ident \ char* + sizeof STAILQ_ENTRY cells member: pnpid.link \ pnpident +;structure + +structure: pnpinfo \ sync with sys/boot/config/bootstrap.h + ptr pnpi.desc + int pnpi.revision + ptr pnpi.module \ (char*) module args + int pnpi.argc + ptr pnpi.argv + ptr pnpi.handler \ pnphandler + sizeof STAILQ_HEAD member: pnpi.ident \ pnpident + sizeof STAILQ_ENTRY member: pnpi.link \ pnpinfo +;structure +\ end of pnp support + pnpdevices drop : enumerate |