aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/common/interp_forth.c
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-141-332/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Reduce boot loader version string duplicationEd Maste2016-12-181-3/+2
| | | | | | | | | | | | | Instead of repeating "%s, Revision %s" "(%s %s)" in each loader, just create the full version string in vers.c Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8823 Notes: svn path=/head/; revision=310225
* Remove fetching of pInterp. Currently, there's no actual effect otherWarner Losh2016-10-141-6/+0
| | | | | | | | | | | | | | than to store the location of a forth word that is subsequently never used. It was last used before the 2.03 ficl upgrade in r51786. It was only used from r43614 (so Feb-Sept 1999) on head and in the 3.x branch (merged r43715 3.1 -> EOL). Remove it since nobody cared enough to report the bug in the last 18 years rather than fix it. It's need seems to have passed in the 2.03 ficl update. Differential Revision: https://reviews.freebsd.org/D8150 Notes: svn path=/head/; revision=307323
* loader command interpreter should reset command_errmsgToomas Soome2016-09-271-3/+5
| | | | | | | | | | | | | | | | | | | | | The command interpreter does leave command_errmsg as is after printing its content, assuming the next command will reset it in bf_command(). However, in case the forth native word is defined as builtin, the bf_command is not used and forth words will also end up the command_errmsg content printed. Since command_errmsg is pointer to actual error message, which can be static read only string, we can not just set *command_errmsg = '\0', instead we need to reset the pointer itself. Illumos issue: https://www.illumos.org/issues/7405 Reported by: Igor Kozhukhov. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8032 Notes: svn path=/head/; revision=306380
* sys/boot/common: use of spaces vs. TAB.Pedro F. Giffuni2016-05-121-2/+2
| | | | | | | No functional change. Notes: svn path=/head/; revision=299499
* Improve non-interactive forth cmd error reportingSteven Hartland2016-01-131-1/+11
| | | | | | | | | | | | | | | | | | | | | | Non-interactive forth command errors where silent even for critical issues e.g. failing to load a required kernel module or mfs_root. This resulted in later unexplained and hard to trace errors such as mount root failures. This introduces additional command return codes that are treated appropriately by the non-interactive command processor (bf_command). * CMD_CRIT = print error * CMD_FATAL = panic Also fix minor style(9) issues with command_load return codes. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Notes: svn path=/head/; revision=293835
* Give loaders more control over the Forth initialization process. InMarcel Moolenaar2014-07-271-5/+12
| | | | | | | | | | | | | | | | | | | | | | particular, allow loaders to define the name of the RC script the interpreter needs to use. Use this new-found control to have the PXE loader (when compiled with TFTP support and not NFS support) read from ${bootfile}.4th, where ${bootfile} is the name of the file fetched by the PXE firmware. The normal startup process involves reading the following files: 1. /boot/boot.4th 2. /boot/loader.rc or alternatively /boot/boot.conf When these come from a FreeBSD-defined file system, this is all good. But when we boot over the network, subdirectories and fixed file names are often painful to administrators and there's really no way for them to change the behaviour of the loader. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=269153
* Bring in some userboot changes from the bhyve branch to reduce diffs.Peter Grehan2013-01-081-2/+9
| | | | | | | | | | | | | | | | | | | | | | | r238966 Bump up the heap size to 1MB. With a few kernel modules, libstand zalloc and userboot seem to want to use ~600KB of heap space, which results in a segfault when malloc fails in bhyveload. r241180 Clarify comment about default number of FICL dictionary cells. r241153 Allow the number of FICL dictionary cells to be overridden. Loading a 7.3 ISO with userboot/amd64 takes up 10035 cells, overflowing the long-standing default of 10000. Bump userboot's value up to 15000 cells. Reviewed by: dteske (r238966,241180) Obtained from: NetApp Notes: svn path=/head/; revision=245148
* Fix loader crash when some unhalted exception happens during `include`Alexander Motin2012-10-261-0/+6
| | | | | | | | | | command execution. In case of such unhandled exception, vmReset() inside ficlExecC() flushes the VM state. Attempt to return back to Forth after that cause garbage dereference with unexpected results. To avoid that situation call vmThrow() directly instead of expecting Forth to do it. Notes: svn path=/head/; revision=242145
* Use __FBSDID().David E. O'Brien2003-08-251-3/+4
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119483
* Upgrade FICL to 3.02. Forgot this one, sorry.Daniel C. Sobral2002-04-091-6/+7
| | | | | | | | PR: 36308 Submitted by: dcs Notes: svn path=/head/; revision=94313
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-1/+1
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* Upper case the FreeBSD loader prompt.David E. O'Brien2001-11-191-1/+1
| | | | | | | | | On OFW based machines, it is just too confusing having the firmware and OS loader giving the same prompt. This is a nice compromise that 99% of the users on non-OFW platforms will probably not even notice. Notes: svn path=/head/; revision=86608
* Cleanup warnings. Most of these are signed/unsigned warnings, as well asJohn Baldwin2000-08-031-1/+1
| | | | | | | some added const's. Notes: svn path=/head/; revision=64187
* Fix vocabulary juggling so that builtins voc is always searched beforeDaniel C. Sobral2000-06-161-2/+2
| | | | | | | | | | forth vocabulary when initially creating the builtins. FICL 2.05 has a better way to do this, but this works for now. Fixes "?". Notes: svn path=/head/; revision=61720
* Remove the setting of sourceid from bf_vm(), as bf_vm() really hasDaniel C. Sobral2000-06-141-4/+0
| | | | | | | | | | | | | | | no clue. Set sourceid to 0 when booting, which is the correct setting for stdin. Set sourceid to an arbitrary fd when include'ing, preserving and restoring the previous sourceid. This is possibly broken(), as 0 is a valid fd. Maybe we should +1 to this value. This fixes the version problem widely reported. Notes: svn path=/head/; revision=61693
* Place original builtins in a vocabulary called "builtins". ThisDaniel C. Sobral2000-06-071-0/+6
| | | | | | | | is intended mainly for debuging purposes, but it can be used by other words if done carefully. Notes: svn path=/head/; revision=61371
* Bring in ficl version 2.03. No version bump for loader.Daniel C. Sobral1999-09-291-10/+8
| | | | Notes: svn path=/head/; revision=51786
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Increase ficl's dictionary size, in preparation for the newer loader.rc.Daniel C. Sobral1999-03-081-2/+2
| | | | Notes: svn path=/head/; revision=44571
* Make use of prototypes to silence warnings.Daniel C. Sobral1999-02-041-25/+49
| | | | | | | | | | | | | | | | | | | | | | Change include() so it will be able to load files with forth code, instead of just builtins. Remove #@- from the include section of the help file, since they don't work in the new version of include, unless BOOT_FORTH is not defined. Change bf_run() so it will return the result returned by ficlExec(). Also, make bf_run() push "interpret" to be executed by ficlExec(), since ficlExec() doesn't do it by itself. (Things worked previously because nothing recursed through ficlExec() by the way of bf_run()). Change/extend comments on builtin behavior. Search for "interpret" at the end of bf_init(), so /boot/boot.4th can provide it's own version. Remove dead code. Notes: svn path=/head/; revision=43614
* Make builtin's state-aware in loader.Jordan K. Hubbard1999-01-281-14/+106
| | | | | | | | Submitted by: Daniel C. Sobral PR: 9663 Notes: svn path=/head/; revision=43321
* bootstrap.hMike Smith1999-01-221-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | help.common interp.c Rename the 'source' command to 'include' in order to avoid conflict with the ANS Forth command of the same name. (kern/9473) interp_forth.c: Changes from kern/9412 (EXCEPTION word), kern/9442 (TIB buffer sizing) and an improved version of kern/9460 (set version numbers). load_aout.c: Trim some obsolete #if 0'ed cruft. pnp.c: Tidy the pnpscan output, turn off the module scanning until we sort out how to do it right. PR: kern/9412 kern/9442 kern/9460 kern/9473 Submitted by: PRs from Daniel Sobral <dcs@newsguy.com> Notes: svn path=/head/; revision=43077
* Fix variable initialization.. It was written with '==' instead of '-'.Peter Wemm1999-01-041-2/+3
| | | | | | | #include <string.h> for string prototypes. Notes: svn path=/head/; revision=42290
* * Begin integration of built-ins with Forth: leave the exit code fromAndrzej Bialecki1998-12-221-5/+8
| | | | | | | | | | a built-in command on Forth stack. * Fix a bug which was causing a panic when loading stripped aout kernels. Reviewed by: jkh Notes: svn path=/head/; revision=42000
* Eliminate much code cruft by extending simple file I/O API to includeJordan K. Hubbard1998-11-071-4/+9
| | | | | | | | fopen and fclose. Also look for /boot/boot.4th now and, if found, load its contents. Notes: svn path=/head/; revision=40988
* Don't have debugging on by default - it makes testing annoying. :)Jordan K. Hubbard1998-11-071-2/+2
| | | | Notes: svn path=/head/; revision=40984
* Ack. Create parseable command tail properly, and eat args out of the TIB.Mike Smith1998-11-061-2/+5
| | | | Notes: svn path=/head/; revision=40950
* Don't use the poxy vmGetString interface (who uses counted strings theseMike Smith1998-11-061-7/+23
| | | | | | | days?), get the input buffer ourselves. Add some debugging code. Notes: svn path=/head/; revision=40948
* Remember a bit more of my forth and do:Jordan K. Hubbard1998-11-051-3/+4
| | | | | | | | | | | | o Add fexists word to check for the presence of a file o make fexists and fload immediate words which DTRT both interpreted and compiled (doh!) o add an init word which gets run at bootstrapping time to do extra post-coldload initialization (in the default implementation, we look for /boot/boot.4th and load it if found). Notes: svn path=/head/; revision=40929
* Use a smaller default dictionary to waste less space.Mike Smith1998-11-041-2/+2
| | | | Notes: svn path=/head/; revision=40882
* Add BootForth hooks; if BOOT_FORTH is defined, pass every line readMike Smith1998-11-041-0/+113
to the Forth interpreter. Instantiate all of our inbuilt commands as Forth words, and handle them being called from there. Add my copyright to the bcache module (oops). Notes: svn path=/head/; revision=40875