Previously, the bootloader would only provide a single memory range.
At least on VirtualBox, this memory range includes the ACPI tables,
which the kernel then happily overwrites when executing VM. Much of
the infrastructure to use a fullblown memory map is already in place;
this patch adds the last (and strangely missing) bit of generating
the memory map in a multiboot-compatible way.
It should be noted that both the bootloader and the kernel actually
violate the multiboot specification by not packing the structure for
the memory ranges. This is a NetBSD bug, but it is also a nonissue
for (our) practical purposes. It can be fixed without changing the
code added in this patch.
The original one-shot page patch (git-e321f65) did not account for the
possibility of pagefaults happening while copying memory in the
kernel. This allowed a simple cp(1) from vbfs to hang the system,
since VM was repeatedly requesting the same page from the file system.
With this fix, VM no longer tries to fetch the same memory-mapped page
from VFS more than once per memory handling request from the kernel.
In addition to fixing the original issue, this change should make
handling memory somewhat more robust and ever-so-slightly faster.
Test74 has been extended with a simple test for this case.
Lionel Sambuc [Thu, 5 Feb 2015 14:00:17 +0000 (14:00 +0000)]
Allow u-boot repository URL to be overridden
This allows the URL used to clone our specific version of u-boot to be
specified in the environment, instead of being hard-coded.
This new flexibility will be required by the new Continuous Integration
infrastructure, whose test nodes are in a network without direct
internet access.
Ben Gras [Thu, 11 Dec 2014 14:00:57 +0000 (15:00 +0100)]
ARM: can build with llvm, switch to EABI
. bitcode fixes
. switch to compiler-rt instead of netbsd libc functions
or libgcc for support functions for both x86 and arm
. minor build fixes
. allow build with llvm without crossbuilding llvm itself
. can now build minix/arm using llvm and eabi - without C++
support for now (hence crossbuilding llvm itself is turned off
for minix/arm)
Lionel Sambuc [Mon, 8 Dec 2014 10:32:14 +0000 (10:32 +0000)]
Restart policies: Add testing and ProcFS DB
- Expose in procfs the service status and supported recovery policies.
- This adds a test (testrelpol.sh) to exercise the restart policies of
the system services and drivers.
NOTE:
The policy support information is temporarily hardcoded in ProcFS, but
this has to be replaced by properly retrieving this information from
RS, which should in turn be setup on a per service basis, at
initialization time.
The new implementation of this library provides abstractions for
network drivers, and should be used for all network drivers from now
on. It provides the following functionality:
- a function call table abstraction, hiding the details of the
datalink protocol with simple parameters;
- a state machine for sending and receiving packets, freeing the
actual driver from keeping track of pending requests;
- an abstraction for copying data from and to the network driver,
freeing the actual driver from dealing with I/O vectors while at
the same time providing a copy implementation which is more
efficient than most current driver implementations;
- a generalized implementation of zero-copy port-based I/O;
- a clearer set of policies and defaults.
While the concept is very similar to lib{block,char,fs,input}driver,
one main difference is that libnetdriver now also takes care of SEF
initialization, mainly so that aspects such as recovery policies and
live-update aspects can be changed for all network drivers in a
single place. As always, for the case that the provided message loop
is too restrictive, a set of more low-level message processing
functions is provided.
The netdriver API has been designed so as to allow alleviation of one
current protocol bottleneck: the fact that at most one send request
and one receive request may be pending at any time. Changing this
aspect will however require a significant rewrite of libnetdriver,
and possibly debugging of drivers that are not able to cope with (in
particular) queuing multiple packets for transmission at once.
Beyond that, the design of the new API is based on the current
protocol, and may be changed/extended later to allow for non-ethernet
network drivers, exposure of link status, multicast address
configuration, suspend and resume, and any other features that are in
fact long overdue.
The expected argument name would include the instance number, which
is not only redundant in many cases (FOOETHn_n=arg.., "n" being the
instance number) and conflicted with what netconf(8) does, but some
drivers need to be able to see the arguments for all instances of its
driver type--for example, dp8390 needs to know how many earlier
instances have been configured to use PCI.
Lionel Sambuc [Wed, 19 Nov 2014 09:54:14 +0000 (10:54 +0100)]
Import a few manpages
The following manpages where contributed by
Jacob Adams <tookmund@gmail.com>:
- atnormalize.8
- autopart.8
- decomp16.1
- devsize.8
- rawspeed.8
- rotate.8
- update_bootcfg.8
- updateboot.8
Lionel Sambuc [Mon, 17 Nov 2014 21:35:00 +0000 (22:35 +0100)]
Fix for missing /usr/games in root's PATH
After importing the default environment from NetBSD, we discovered that
it doesn't contain /usr/games, which is required for the commands
strfile. This utility is used while generating fortune database.
This patch simply sets TOOL_STRFILE to contain an absolute path.
The jump-to-start hack is not resetting global variables, resulting in
a crash after several such restarts cause an overflow in the network
table. This patch fixes that particular issue, but more similar
issues (in particular memory leaks) are bound to come up. As such this
is a stopgap measure until we can get rid of the old dhcpd altogether.
This resolves the additional issue reported in #2.
This patch adds (very limited) support for memory-mapping pages on
file systems that are mounted on the special "none" device and that
do not implement PEEK support by themselves. This includes hgfs,
vbfs, and procfs.
The solution is implemented in libvtreefs, and consists of allocating
pages, filling them with content by calling the file system's READ
functionality, passing the pages to VM, and freeing them again. A new
VM flag is used to indicate that these pages should be mapped in only
once, and thus not cached beyond their single use. This prevents
stale data from getting mapped in without the involvement of the file
system, which would be problematic on file systems where file contents
may become outdated at any time. No VM caching means no sharing and
poor performance, but mmap no longer fails on these file systems.
Compared to a libc-based approach, this patch retains the on-demand
nature of mmap. Especially tail(1) is known to map in a large file
area only to use a small portion of it.
All file systems now need to be given permission for the SETCACHEPAGE
and CLEARCACHE calls to VM.
This directory is filled dynamically with regular files, one for each
service that RS knows about, named after its label. Its contents are
still subject to (heavy) change, but currently expose the service's
endpoint and number of restarts so far.
- rename start_vtreefs to run_vtreefs, since the function returns upon
termination these days;
- add get_inode_slots function to retrieve the number of indexed slots;
- add support for extra per-inode data for arbitrary storage.
Also fix two small IOCTL-related bugs:
- do not print an argument pointer for argument-less IOCTLs;
- print IOCTL contents with -V given once, just like structures.
Ben Gras [Thu, 6 Nov 2014 13:39:32 +0000 (14:39 +0100)]
VM,MFS: better handling of some exceptional cases
Fix for problems reported by Alejandro Hernández:
. VM unmap: handle case where there is no nextvr
Fixes for problems found by running Melkor ELF fuzzing tool:
. VM: better handle case where region prealloc fails by
freeing memory that was allocated so far
. MFS fs_readwrite: EOF check should happen for read and
peek requests, not just read
Lionel Sambuc [Tue, 14 Oct 2014 19:38:39 +0000 (21:38 +0200)]
PCI driver cleanup
- Moved to KNF
- Whitespace cleanup
- Removed useless static functions prototypes
- Renamed some file private functions by prepending '__'
- Renamed some server-specific function by prepending '_'
- Fixed compilation warning for WARNS= 3
Thomas Veerman [Wed, 15 Oct 2014 08:59:38 +0000 (10:59 +0200)]
buildsystem: fix build errors for x86 on OSX
Define _NLS_PRIVATE in tools/llvm-tblgen/Makefile so that
<tools/compat/nl_types.h> will pull in <include/nl_types.h>. This is
necessary as Clang's c++/v1/locale implementation contains references
to catopen and other catalog symbols that aren't defined anywhere.
Moreover, the compiler will complain about NL_CAT_LOCALE not being
declared. The compat nl_types.h fixes these discrepancies.
However, <nl_types.h> uses __format_arg to add function attributes to
declarations. On NetBSD __format_arg(fmtarg) is defined by
<sys/cdefs.h> to be __attribute__((__format_arg__ (fmtarg))) for
briefness, but other platforms don't do that. Consequently, the build
will fail on catopen and friends function declarations because the
compiler doesn't know how to handle __format_arg(fmtarg). A fixup to
<tools/compat/nl_types.h> takes care of this, but it won't win any
beauty contest.
Change-Id: Ic4426eca8385aeef858e60304d6e8c06cd497d95 Signed-off-by: Thomas Veerman <tveerman@gmail.com>
Read calls may be repeated by VFS if the user destination memory is
not mapped in. Devman currently assumes that all reads are
successful, and uses this to track whether EOF has been reached for
a particular event, discarding it as soon as this happens. Upon
repetition, this may result in lost events for devmand.
With this patch, devman discards events only once devmand reads the
EOF marker, which itself can never generate a user page fault. The
result is that read calls for data can be repeated safely, without
the risk of losing events in the process.
Thomas Veerman [Thu, 9 Oct 2014 20:14:41 +0000 (22:14 +0200)]
Fix build error on OSX
When building Gold on OSX 10.9 and Clang 6.0, the build process fails
with the error:
In file included from /Users/thomas/minix/tools/binutils/../../external/gpl3/binutils/dist/gold/binary.cc:31:
In file included from /Users/thomas/minix/tools/binutils/../../external/gpl3/binutils/dist/gold/stringpool.h:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:438:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cwchar:107:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cwctype:54:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:51:72: error: use of undeclared identifier 'do_not_use_isalnum_with_safe_ctype'
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
Signed-off-by: Thomas Veerman <tveerman@gmail.com>
Change-Id: Ib7ca13a51e83c31bb3020d755e04b308aeacde5d
Lionel Sambuc [Fri, 10 Oct 2014 09:19:08 +0000 (11:19 +0200)]
Fix OS X crossbuilds for arm
- Fixed missing variable interpolation because of single quotes
- Replaced /bin/sh in gen_uEnv.txt.sh with /usr/bin/env bash as the default
echo doesn't support '-n'
- Fixed some whitespace errors
- A succesful build requires for now to skip the gold linker on OSX.
We have to use SOCK_SEQPACKET instead of SOCK_STREAM for client/server
communication, because UDS does things with control messages that tmux
does not expect.
The NetBSD version is seriously broken--it is unable to match lines
against an empty pattern--and appears to be unmaintained.
The new version is the latest OpenBSD grep, with a number of MINIX-
specific changes marked as such, and an additional number of
(signed/unsigned, const) fixes to pass compilation.
Since this is not NetBSD code, move back the entire thing into
minix/usr.bin.
- synchronize request type with ioctl by making it unsigned long;
- unbreak VFS requests, as they were being sent to PM;
- use proper ioctl direction flags (and new numbers) for requests;
- remove some needless header inclusions;
- svrctl is in libc, make its message name reflect this;
- keep backward compatibility: svrctl is part of the userland ABI.