key? ( -- flag) \ check to see if there's a key to be read from input
ms ( u -- ) \ wait that many milliseconds
seconds ( -- u ) \ get number of seconds from midnight.
'words' now outputs the list page by page - this probably should go
through libstand's pager, but will have to wait for closer integration of
built-ins with Forth...
Submitted partially by: W Gerald Hicks <wghicks@bellsouth.net>
capabilities are: AF, AB, cm, ho, me, cd. The code is hidden behind
-DTERM_EMU - should it cause any problems, you can remove this define
to get back the old behaviour.
You'll find some examples how to use it in src/share/examples/bootforth.
Reviewed by: jkh
the first time block 0 is read. This fix initialises the block
numbers to -1 which isn't the most correct thing for a daddr_t but
it isn't likely to cause a problem in the boot blocks and it could
do with a more thought out fix later.
The bug is probably benign on the i386 but on the alpha it can
cause initial file opens to fail. This is the cause of the "can't
open /boot/boot.conf" errors.
It appears on the alpha because of a number of combining factors.
On the alpha the LABELSECTOR is 0 so block 0 needs to be read in
from the media. The first time this happens you get a false hit
because the bc_blkno field is zero initially. Also, the timestamp
check against this cache hit succeeds because on the alpha a hacked
getsecs() function can return 0 when it starts counting so that
the zero initial timestamp + BCACHE_TIMEOUT is greater than the
current time until getsecs() has counted passed BCACHE_TIMEOUT.
The overall effect is that the first open() that occurs gets a
false cache hit and returns garbage to the bd_strategy() function
which then fails the open() call. This false hit then stays in the
cache until BCACHE_TIMEOUT getsecs() ticks have passed; all open()
calls during this time fail.
This explains why you can generally access the media by the time
you get to interp() and start issuing commands but the earlier
attempts to run the boot scripts are failing.
It's possible that this is causing the problem switching to the
mfsroot floppy as well but I haven't confirmed that.
interface. Do some general consistency fixes and space optimizations.
Use of some freed-up space to defend against possible BIOS misfeatures.
boot2: Revise disk read interface to provide for boot1 changes. Free
up space for this.
o add fkey and fread
o eliminate fexists now that this can be expressed in HLL forth
( : fexists fopen dup -1 <> if fclose 1 else drop 0 then ; ) :-)
Once we get the ability to write files, it should be possible to do
stand-alone rescue work from the 3rd stage boot. :)
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).
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).
this will allow us to manage bloat in the loader by using a bytecoded HLL
rather than lots of C code. It also offers an opportunity for vendors
or others with special applications to significantly customise the boot
process without having to commit to a divergent code branch.
This early commit is to allow others to experiment with the most effective
mechanisms for integrating FICL with the loader as it currently stands.
Ficl is distributed with the following license conditions:
"Ficl is freeware. Use it in any way that you like, with the understanding
that the code is not supported."
All source files contain authorship attributions.
Obtained from: John Sadler (john_sadler@alum.mit.edu)
and will bypass transfers for more than 8k. Blocks are invalidated after
2 seconds, so removable media should not confuse the cache.
The 8k threshold is a compromise; all UFS transfers performed by
libstand are 8k or less, so large file reads thrash the cache.
However many filesystem metadata operations are also performed using
8k blocks, so using a lower threshold gives poor performance.
Those of you with an eye for cache algorithms are welcome to tell me
how badly this one sucks; you can start with the 'bcachestats' command
which will print the contents of the cache and access statistics.
* Embed the stack into the bss section for loader and netboot. This
is required for netboot since otherwise the stack would be inside our
heap.
* Install loader and netboot in /boot by default.
* Fix getbootfile so that it searches for a ',' instead of a ';'
when terminating the filename.
filesystems.
- New 'help' command and data in the help.* files (not yet installed),
provides topic and subtopic help, indexes, etc.
- Don't crash if the user tries to set an invalid console. Be helpful
instead.
- Expand tabs (badly) on the i386 video console.
- Some minor cosmetic changes.
- Use the ISA PnP enumerator.
- Use the new linker set code, throw out the gensetdefs stuff.
- Produce an intermediate loader image that has symbols stripped, to aid
- in debugging.
- Supply ISA port access functions required for ISA PnP
can fit into my test machine.
- Move to using STAILQs rather than ad-hoc singly-linked lists.
- Use a mostly procedural interface to the PnP information. This
improves data-hiding.
Implement a new linker-set technique (currently on i386 only but should work
on Alpha as well). This is a good candidate for replacing the current
gensetdefs cruft completely.
the boot.config settings are persistent, this seems to provide a
useful override capability, and should break only on broken
boot.config's.
Output a cosmetic newline if booting with no input.
Read boot.help before parsing boot.config. We were parsing
boot.config first, which could result in boot.help being read
from a different location (or not found), which would probably
just cause surprise, without being useful.
can seek back to the first PT_LOAD and doing a close/reopen if it cannot.
This is because the first PT_LOAD section includes the ELF headers.
This fixes gzipped kernels on the i386, it should solve mike's problem
for the Alpha.
independent elf loader and have access to kld modules. Jordan and I were
not sure how to create boot floppies, and the things we tried just made
SRM laugh in our faces - but it was upset at boot1 which was not touched
by these changes. Essentially this has been untested. :-(
What this does is to steal the last three slots from the nine spare longs
in the bootinfo_v1 struct to pass the module base pointer through.
The startup code now to set up and fills in the module and environment
structures, hopefully close enough to the i386 layout to be able to use
the same kernel code. We now pass though the updated end of the kernel
space used, rather than _end. (like the i386).
If this does not work, it needs to be beaten into shape pronto. Otherwise
it should be backed out before 3.0.
Pre-approved in principle by: dfr
Drastically quieten down the verbose load progress messages. They were
more useful for debugging than anything, but are beyond a joke when loading
a few dozen modules.
Simplify the ELF extended symbol table load format. Just take the main
symbol table and the string table that corresponds. This is what we will
be getting local symbols from. (needed for the alpha stack tracebacks).
Use the (optional) full symbol tables in lookups. This means we have to
furhter distinguish between symbols that can come from the dynamic linking
table and the complete table.
The alpha boot code now needs to be adapted as ddb/db_elf.c cannot use
the simpler format.
I have not implemented loading the extended symbol tables from the syscall
interface yet, just for preloaded modules.
I am not sure about the symbol resolution. I *think* it's possible that
a local symbol can be found in preference to a global, depending on the
search sequence and dependency tree.
difference, but might later on when we implement some sort of multi-head
console mode. Select a console after probing them all.
Don't strdup a potentially NULL return from getenv().
If we don't select an active console, choose the first regardless.
Call the console init function, at startup time and on a manual change.
The env_setenv() function needs EV_VOLATILE because it's pointing to
data that isn't malloc'ed and will cause a fault if it's freed later.
Cosmetic change to the init-time character eater (like, make it increment
the index counter - if there's a problem, it would sit there in an infinite
loop instead of only running 10 times).
Also, make sure we set %dx each time around otherwise the commands
suddenly start trying to work on things like com92 instead of com1.
Make sure comc_init() is only run once.
Cosmetic change to init-time character eater.
should be MD code since one day we'll have to recover pages from deleted
preload data. MI code can't be expected to know how to deal with pmap
internals, assuming it gets done via pmap that is. :-)
- get dependency info from PT_DYNAMIC's DT_NEEDED tags.
- store MODINFOMD_DYNAMIC for the kernel's later use
setenv kernelname when we have it
Fix firstaddr/lastaddr calculation (duh! :-)
Explicitly skip string table with section names in it.
KLD modules are *not* PIC. (Shared libs are pic to avoid relocations
causing copy-on-write, that's irrelevant here).
setenv kernelname when we load it.
Use MODINFO_SSYM/ESYM for each symbol section when (if) there are
more than one being loaded.
Remove Mike's explicit data structures for dependency info. This is
done via DT_NEEDED etc in the dynamic section for now. This may need
to be revisited later on.
Do a much better job of DWIM with partial device specifications.
Fix the module metadata build process, which was completely broken.
Use a larger read buffer when copying large objects in; this
improves performance marginally and will avoid flushning any small caches
we might choose to implement.
Remove debugging in command_read().
Correctly strip leading controls on script commands.
Make 'ls' more DWIM in regard to pathnames. We can still do better.
- Don't whine about nodes we can't stat(); these are usually
symlinks that lead out of the filesystem.
- Autoboot is now controlled by $autoboot_delay, which is a value
in seconds or NO to disable autoboot.
- Don't autoboot at the end of boot.conf if we have already tried.
- Add a 'read' command to complement 'echo'. Both are still hidden.
- Improve the 'source' command/function so that it is possible to
source scripts off removable media. The entire script is read and
saved before beginning execution. Script lines beginning with
'@' will not be echoed when being executed. Script execution will
normally terminate at the first error, however if the script line
begins with '-' this behaviour is overriden for that command.
Strip any device name information from the kernel name
before passing it in.
biosdisk.c
Be more strict about matching device names to slice entries.
Only allow unsliced syntax on unsliced disks.
Allocate space for, and copy, NDOSPART slice entries from the
MBR, not just one. Add some extra debugging while we're at it.
elf_freebsd.c
Initialise the symbol table start/end pointers in case we don't
have them.
Use bd_getdev() to work out a dev_t for the root device.
Allow $rootdev to override $currdev as the root device.
biosdisk.c
Save the slice table and disklabel when opening a disk.
Add bd_getdev(), which attempts to return a dev_t corresponding
to a given device. Cases which it still doesn't get right:
- The inevitable da-when-wd-also-exists
- Disks with no slice table (the slice number is not set correctly)
The first is difficult to get right, the second will be
fixed in an upcoming commit.
comconsole.c
vidconsole.c
getchar() should return an 8-bit value; some BIOSsen pack extra
information in %eax.
libi386.h
Remove some stale prototypes, add new ones.
Increase the robustness of the "is it time to boot yet" test;
if the time skipped the "when" time, we would miss it.
Don't spin in an endless loop if we don't find the first possible
kernel suggested. When we run out, don't try to load an empty
kernel name.
load_aout.c
printf format warnings
of the ..umm.. "wierd" way binutils lays out the file. The section
headers are nearly at the end of the file and this is a problem when
loading from a .gz file which can't seek backwards (or has a limited
reverse seek, ~2K from memory).
This is intended to be compatable with the ddb/db_elf.c code and the
alpha/libalpha/elf_freebsd.c layout. I've studied these (which are NetBSD
derived) but did it a bit differently. Naturally the process is similar
since it's supposed to end up with the same result.
bootblocks, the kernel shows up as the primary module:
[3:24am]~-100# kldstat
Id Refs Address Size Name
1 1 0xf0100000 ff00000 /kernel
^^^^ oops.. :-)
Based heavily on aout_freebsd.c. Hmm.. There's so much in common that
these could probably be combined and just check the metadata to see which
format it is.
so far, and should probably be able to be made to work for the alpha
without too much trouble once it's connected up and my assumptions tested.
I think (but have not tested) it will also load "old" ELF kernels that
were not linked with DYNAMIC headers.
The module glue is yet to come. (oh fun.. :-)
It does not explicitly load symbols [yet]. The _DYNAMIC data contains a
runtime symbol set that ddb can use via ddb/db_kld.c. It'll be missing
some detail that stabs normally provides (eg: number of args to a function,
line numbers, etc). On the other hand, those minimal symbols will always
be available even on a stripped kernel.
This is mostly stolen from load_aout.c with some ideas from
alpha/libalpha/elf_freebsd.c.
Presumably VTOP doesn't work for static objects.
The easiest way to get it working was to reserve some space after the
environment strings and copy the bootinfo struct there.
Also, set RB_BOOTINFO, it's needed.
I got the code to load and run an unmolested kernel OK for the first time
with this system a few minutes ago - at last!. I did have to stop it
looking at the floppy though as BTX was trapping a mode 14 fault when
it look for /boot/boot.conf when no disk was in the drive. (I'm booting
from a scsi disk (bios disk 0x80)).
Now to teach it about ELF and modules :-)
* Fix a raft of warnings, printf and otherwise.
* Allocate the correct amount in mod_searchmodule to prevent an overflow.
* Fix the makefiles so they work outside my home directory (oops).