Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).
Improved by comments from enami and christos -- thanks!
Heimdal/krb4/KAME changes already fed back, rest to follow.
Inspired by, but not not based on, OpenBSD.
we have to poke the data structures directly to force the offset we need.
The open() function returns with the address of the IO control block in
register t0 so we take a copy of it for our brute-force lseek function.
This should be reasonably portable since the firmware writers closely
follow UNIX semantics and the open stubs should recompile and use the
same registers. May break on the rebadged clones -- buyer beware.
The alternative is to use dummy reads to go forwards and reopen followed
by dummy reads to go backwards. It takes around 60 seconds to boot
using this method if we use a clean filesystem.
Tested with firmware versions 5.40 and 5.43
and alpha ports.
Uses PROM standalone I/O functions but due to the lack of a lseek function
it currently only works with version 5.40 of the firmware. A more portable
solution is being worked on.
installboot utility requires several changes in order to correctly install
the bootstrap code - there is a "volume directory" which contains a list
of filenames, start sectors and length. We need to add a "boot" entry of
the correct length starting at block 2. The boot file has to be ecoff
which means we waste another 0.5k
Normally the Mips filesystem has a ~500k partition for this purpose but it
should be possible to squeeze it all into the first 7k "BSD Style" (1k is
required for 2 different copies of the partition table)
Only the bootxx_ffs first stage bootstrap has been tested via bootp() which
loads the second stage off disk and then boots the kernel.