/* $NetBSD: rump_vfs.c,v 1.97 2023/09/23 18:21:12 ad Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
*
* Development of this software was supported by the
* Finnish Cultural Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
for (i = 0; i < ncpu; i++) {
struct cpu_info *ci = cpu_lookup(i);
cache_cpu_init(ci);
}
/* make number of bufpages 5% of total memory limit */
if (rump_physmemlimit != RUMPMEM_UNLIMITED) {
extern u_int bufpages;
bufpages = rump_physmemlimit / (20 * PAGE_SIZE);
}
/*
* On archs where the native kernel ABI is supported, map
* host module directory to rump. This means that kernel
* modules from the host will be autoloaded to rump kernels.
*/
if (rump_nativeabi_p()) {
if (rumpuser_getparam("RUMP_MODULEBASE", buf, sizeof(buf)) == 0)
mbase = buf;
else
mbase = module_base;
/*
* Don't build device names for a large set of devices by
* default. While the pseudo-devfs is a fun experiment,
* creating many many device nodes may increase rump kernel
* bootstrap time by ~40%. Device nodes should be created
* per-demand in the component constructors.
*/
#if 0
{
extern struct devsw_conv devsw_conv0[];
extern int max_devsw_convs;
rump_vfs_builddevs(devsw_conv0, max_devsw_convs);
}
#else
rump_vfs_builddevs(NULL, 0);
#endif
/* attach null device and create /dev/{null,zero} */
rump_devnull_init();