2002-07-09 16:24:59 +04:00
|
|
|
/*
|
2007-06-21 23:50:57 +04:00
|
|
|
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
2004-12-14 18:49:20 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2002-07-18 18:19:53 +04:00
|
|
|
|
2007-06-21 23:50:57 +04:00
|
|
|
/*! This is main - initializes processors and starts init */
|
2004-10-20 03:21:07 +04:00
|
|
|
|
2004-12-14 18:49:20 +03:00
|
|
|
|
2004-03-16 05:53:41 +03:00
|
|
|
#include <OS.h>
|
|
|
|
|
2006-01-03 19:26:39 +03:00
|
|
|
#include <arch/platform.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <boot_item.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <cbuf.h>
|
2008-01-11 03:36:44 +03:00
|
|
|
#include <commpage.h>
|
2007-08-10 00:08:25 +04:00
|
|
|
#include <condition_variable.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <cpu.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <debug.h>
|
|
|
|
#include <elf.h>
|
[Sorry, couldn't split this one up any further.]
* Images preloaded by the boot loader had to be modules to be of any use
to the kernel. Extended the mechanism so that any images not accepted
by the module code would later be tried to be added as drivers by the
devfs. This is a little hacky ATM, since the devfs manages the drivers
using a hash map keyed by the drivers inode ID, which those drivers
obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
doesn't implement the former (all old-style drivers), thus making it
possible to BFS, which uses the file cache which in turn requires
read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
more flexibly be extended and deals more gracefully with
arbitrarily-size data. The disk_identifier structure still exists,
though. It is added as message field in cases where needed (non net
boot). Moved the boot_drive_number field of the bios_ia32 platform
specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
initialization code into the stage 2 loader, which can now be loaded
directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
does no longer use the RemoteDisk protocol (it could actually be
removed from the boot loader). It also parses the DHCP options in the
DHCPACK packet provided by PXE and extracts the root path to be
mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
added support for network boot. In this case the net stack is
initialized and the network interface the boot loader used is brought
up and configured. Since NBD and RemoteDisk are our only options for
net boot (and those aren't really configurable dynamically) ATM, the
the boot device is found automatically by the disk device manager.
Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 06:10:15 +04:00
|
|
|
#include <fs/devfs.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <int.h>
|
2004-05-10 17:28:21 +04:00
|
|
|
#include <kdevice_manager.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <kdriver_settings.h>
|
2003-01-26 20:31:33 +03:00
|
|
|
#include <kernel_daemon.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <kmodule.h>
|
|
|
|
#include <kscheduler.h>
|
|
|
|
#include <ksyscalls.h>
|
2005-01-25 17:48:34 +03:00
|
|
|
#include <messaging.h>
|
2007-07-31 20:23:40 +04:00
|
|
|
#include <Notifications.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <port.h>
|
|
|
|
#include <real_time_clock.h>
|
|
|
|
#include <sem.h>
|
|
|
|
#include <smp.h>
|
|
|
|
#include <system_info.h>
|
|
|
|
#include <team.h>
|
|
|
|
#include <timer.h>
|
2005-03-25 21:29:12 +03:00
|
|
|
#include <user_debugger.h>
|
2005-10-25 20:59:12 +04:00
|
|
|
#include <vfs.h>
|
|
|
|
#include <vm.h>
|
|
|
|
#include <boot/kernel_args.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2002-10-08 05:14:44 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
#define TRACE_BOOT
|
2004-03-15 01:54:00 +03:00
|
|
|
#ifdef TRACE_BOOT
|
2007-06-21 23:50:57 +04:00
|
|
|
# define TRACE(x...) dprintf("INIT: " x)
|
2002-10-08 05:14:44 +04:00
|
|
|
#else
|
2007-02-19 03:11:24 +03:00
|
|
|
# define TRACE(x...) ;
|
2002-10-08 05:14:44 +04:00
|
|
|
#endif
|
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
bool kernel_startup = true;
|
2002-10-08 05:14:44 +04:00
|
|
|
|
2005-10-25 20:59:12 +04:00
|
|
|
static kernel_args sKernelArgs;
|
2007-03-01 11:09:28 +03:00
|
|
|
static uint32 sCpuRendezvous;
|
|
|
|
static uint32 sCpuRendezvous2;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-01-27 06:02:24 +03:00
|
|
|
static int32 main2(void *);
|
2005-10-25 20:59:12 +04:00
|
|
|
int _start(kernel_args *bootKernelArgs, int cpu); /* keep compiler happy */
|
2002-10-08 05:14:44 +04:00
|
|
|
|
2007-06-21 23:50:57 +04:00
|
|
|
|
2002-10-08 05:14:44 +04:00
|
|
|
int
|
2005-10-25 20:59:12 +04:00
|
|
|
_start(kernel_args *bootKernelArgs, int currentCPU)
|
2002-07-09 16:24:59 +04:00
|
|
|
{
|
2005-10-25 20:59:12 +04:00
|
|
|
if (bootKernelArgs->kernel_args_size != sizeof(kernel_args)
|
|
|
|
|| bootKernelArgs->version != CURRENT_KERNEL_ARGS_VERSION) {
|
2004-10-27 03:31:48 +04:00
|
|
|
// This is something we cannot handle right now - release kernels
|
|
|
|
// should always be able to handle the kernel_args of earlier
|
|
|
|
// released kernels.
|
2005-05-29 17:01:38 +04:00
|
|
|
debug_early_boot_message("Version mismatch between boot loader and kernel!\n");
|
2004-06-15 20:57:13 +04:00
|
|
|
return -1;
|
2004-10-27 03:31:48 +04:00
|
|
|
}
|
2004-06-15 20:57:13 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
smp_set_num_cpus(bootKernelArgs->num_cpus);
|
|
|
|
|
|
|
|
// wait for all the cpus to get here
|
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous, currentCPU);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
// the passed in kernel args are in a non-allocated range of memory
|
|
|
|
if (currentCPU == 0)
|
|
|
|
memcpy(&sKernelArgs, bootKernelArgs, sizeof(kernel_args));
|
|
|
|
|
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous2, currentCPU);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// do any pre-booting cpu config
|
2007-02-19 03:11:24 +03:00
|
|
|
cpu_preboot_init_percpu(&sKernelArgs, currentCPU);
|
|
|
|
thread_preboot_init_percpu(&sKernelArgs, currentCPU);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// if we're not a boot cpu, spin here until someone wakes us up
|
2005-10-25 20:59:12 +04:00
|
|
|
if (smp_trap_non_boot_cpus(currentCPU)) {
|
|
|
|
thread_id thread;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2005-12-31 00:20:07 +03:00
|
|
|
// init platform
|
2006-01-03 19:26:39 +03:00
|
|
|
arch_platform_init(&sKernelArgs);
|
2005-12-31 00:20:07 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
// setup debug output
|
2005-10-25 20:59:12 +04:00
|
|
|
debug_init(&sKernelArgs);
|
2003-11-11 06:07:53 +03:00
|
|
|
set_dprintf_enabled(true);
|
2002-07-09 16:24:59 +04:00
|
|
|
dprintf("Welcome to kernel debugger output!\n");
|
2007-05-19 19:36:32 +04:00
|
|
|
dprintf("Haiku revision: %lu\n", get_haiku_revision());
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// init modules
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init CPU\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
cpu_init(&sKernelArgs);
|
2007-02-05 04:46:28 +03:00
|
|
|
cpu_init_percpu(&sKernelArgs, currentCPU);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init interrupts\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
int_init(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init VM\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
vm_init(&sKernelArgs);
|
2004-10-21 05:45:43 +04:00
|
|
|
// Before vm_init_post_sem() is called, we have to make sure that
|
|
|
|
// the boot loader allocated region is not used anymore
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
// now we can use the heap and create areas
|
2006-01-03 19:26:39 +03:00
|
|
|
arch_platform_init_post_vm(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init driver_settings\n");
|
2005-06-13 17:01:13 +04:00
|
|
|
boot_item_init();
|
2005-10-25 20:59:12 +04:00
|
|
|
driver_settings_init(&sKernelArgs);
|
|
|
|
debug_init_post_vm(&sKernelArgs);
|
|
|
|
int_init_post_vm(&sKernelArgs);
|
|
|
|
cpu_init_post_vm(&sKernelArgs);
|
2008-01-11 03:36:44 +03:00
|
|
|
commpage_init();
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init system info\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
system_info_init(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init SMP\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
smp_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init timer\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
timer_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init real time clock\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
rtc_init(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init semaphores\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
sem_init(&sKernelArgs);
|
2007-08-10 00:08:25 +04:00
|
|
|
condition_variable_init();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// now we can create and use semaphores
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init VM semaphores\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
vm_init_post_sem(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init driver_settings\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
driver_settings_init_post_sem(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init generic syscall\n");
|
2004-12-14 18:49:20 +03:00
|
|
|
generic_syscall_init();
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init cbuf\n");
|
2002-07-09 16:24:59 +04:00
|
|
|
cbuf_init();
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init teams\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
team_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init threads\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
thread_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init ports\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
port_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init kernel daemons\n");
|
2003-01-26 20:31:33 +03:00
|
|
|
kernel_daemon_init();
|
2006-01-28 21:11:20 +03:00
|
|
|
arch_platform_init_post_thread(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init VM threads\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
vm_init_post_thread(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init ELF loader\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
elf_init(&sKernelArgs);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init scheduler\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
scheduler_init();
|
2007-07-31 20:23:40 +04:00
|
|
|
TRACE("init notification services\n");
|
|
|
|
notifications_init();
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("init VFS\n");
|
2005-12-16 19:11:36 +03:00
|
|
|
vfs_init(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
// bring up the AP cpus in a lock step fashion
|
|
|
|
TRACE("waking up AP cpus\n");
|
|
|
|
sCpuRendezvous = sCpuRendezvous2 = 0;
|
|
|
|
smp_wake_up_non_boot_cpus();
|
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous, 0); // wait until they're booted
|
|
|
|
|
|
|
|
// exit the kernel startup phase (mutexes, etc work from now on out)
|
|
|
|
TRACE("exiting kernel startup\n");
|
2007-02-19 03:11:24 +03:00
|
|
|
kernel_startup = false;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous2, 0); // release the AP cpus to go enter the scheduler
|
2004-03-15 01:54:00 +03:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
TRACE("enabling interrupts and starting scheduler on cpu 0\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
enable_interrupts();
|
|
|
|
scheduler_start();
|
2007-02-19 03:11:24 +03:00
|
|
|
|
|
|
|
// start a thread to finish initializing the rest of the system
|
|
|
|
TRACE("starting main2 thread\n");
|
|
|
|
thread = spawn_kernel_thread(&main2, "main2", B_NORMAL_PRIORITY, NULL);
|
2007-03-01 11:09:28 +03:00
|
|
|
TRACE("resuming main2 thread...\n");
|
2004-10-27 18:00:40 +04:00
|
|
|
resume_thread(thread);
|
2005-10-25 20:59:12 +04:00
|
|
|
} else {
|
2007-03-01 11:09:28 +03:00
|
|
|
// lets make sure we're in sync with the main cpu
|
|
|
|
// the boot processor has probably been sending us
|
|
|
|
// tlb sync messages all along the way, but we've
|
|
|
|
// been ignoring them
|
|
|
|
arch_cpu_global_TLB_invalidate();
|
|
|
|
|
2005-10-25 20:59:12 +04:00
|
|
|
// this is run for each non boot processor after they've been set loose
|
2007-02-05 04:46:28 +03:00
|
|
|
cpu_init_percpu(&sKernelArgs, currentCPU);
|
2005-10-25 20:59:12 +04:00
|
|
|
smp_per_cpu_init(&sKernelArgs, currentCPU);
|
2004-10-27 18:00:40 +04:00
|
|
|
|
2007-03-01 11:09:28 +03:00
|
|
|
// wait for all other AP cpus to get to this point
|
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous, currentCPU);
|
|
|
|
smp_cpu_rendezvous(&sCpuRendezvous2, currentCPU);
|
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
// welcome to the machine
|
2005-10-25 20:59:12 +04:00
|
|
|
enable_interrupts();
|
2007-02-19 03:11:24 +03:00
|
|
|
scheduler_start();
|
2005-10-25 20:59:12 +04:00
|
|
|
}
|
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("main: done... begin idle loop on cpu %d\n", currentCPU);
|
2004-03-15 01:54:00 +03:00
|
|
|
for (;;)
|
2002-07-18 18:19:53 +04:00
|
|
|
arch_cpu_idle();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-10-08 05:14:44 +04:00
|
|
|
|
2003-01-27 06:02:24 +03:00
|
|
|
static int32
|
2002-10-08 05:14:44 +04:00
|
|
|
main2(void *unused)
|
2002-07-09 16:24:59 +04:00
|
|
|
{
|
|
|
|
(void)(unused);
|
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("start of main2: initializing devices\n");
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Init modules\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
module_init(&sKernelArgs);
|
2004-06-07 21:32:16 +04:00
|
|
|
|
2004-11-11 22:43:59 +03:00
|
|
|
// ToDo: the preloaded image debug data is placed in the kernel args, and
|
|
|
|
// thus, if they are enabled, the kernel args shouldn't be freed, so
|
|
|
|
// that we don't have to copy them.
|
|
|
|
// What is yet missing is a mechanism that controls this (via driver settings).
|
|
|
|
if (0) {
|
2004-10-23 17:53:13 +04:00
|
|
|
// module_init() is supposed to be the last user of the kernel args
|
|
|
|
// Note: don't confuse the kernel_args structure (which is never freed)
|
|
|
|
// with the kernel args ranges it contains (and which are freed here).
|
2005-10-25 20:59:12 +04:00
|
|
|
vm_free_kernel_args(&sKernelArgs);
|
2004-11-11 22:43:59 +03:00
|
|
|
}
|
2004-10-23 17:53:13 +04:00
|
|
|
|
2005-03-25 21:29:12 +03:00
|
|
|
// init userland debugging
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Init Userland debugging\n");
|
2005-03-25 21:29:12 +03:00
|
|
|
init_user_debug();
|
|
|
|
|
2005-01-25 17:48:34 +03:00
|
|
|
// init the messaging service
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Init Messaging Service\n");
|
2005-01-25 17:48:34 +03:00
|
|
|
init_messaging_service();
|
|
|
|
|
2002-07-13 04:55:02 +04:00
|
|
|
/* bootstrap all the filesystems */
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Bootstrap file systems\n");
|
2004-05-06 05:27:34 +04:00
|
|
|
vfs_bootstrap_file_systems();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Init Device Manager\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
device_manager_init(&sKernelArgs);
|
2004-05-10 17:28:21 +04:00
|
|
|
|
[Sorry, couldn't split this one up any further.]
* Images preloaded by the boot loader had to be modules to be of any use
to the kernel. Extended the mechanism so that any images not accepted
by the module code would later be tried to be added as drivers by the
devfs. This is a little hacky ATM, since the devfs manages the drivers
using a hash map keyed by the drivers inode ID, which those drivers
obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
doesn't implement the former (all old-style drivers), thus making it
possible to BFS, which uses the file cache which in turn requires
read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
more flexibly be extended and deals more gracefully with
arbitrarily-size data. The disk_identifier structure still exists,
though. It is added as message field in cases where needed (non net
boot). Moved the boot_drive_number field of the bios_ia32 platform
specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
initialization code into the stage 2 loader, which can now be loaded
directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
does no longer use the RemoteDisk protocol (it could actually be
removed from the boot loader). It also parses the DHCP options in the
DHCPACK packet provided by PXE and extracts the root path to be
mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
added support for network boot. In this case the net stack is
initialized and the network interface the boot loader used is brought
up and configured. Since NBD and RemoteDisk are our only options for
net boot (and those aren't really configurable dynamically) ATM, the
the boot device is found automatically by the disk device manager.
Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 06:10:15 +04:00
|
|
|
TRACE("Add preloaded old-style drivers\n");
|
|
|
|
devfs_add_preloaded_drivers(&sKernelArgs);
|
|
|
|
|
2004-05-06 05:27:34 +04:00
|
|
|
// ToDo: device manager starts here, bus_init()/dev_init() won't be necessary anymore,
|
|
|
|
// but instead, the hardware and drivers are rescanned then.
|
|
|
|
|
2006-02-07 05:50:32 +03:00
|
|
|
int_init_post_device_manager(&sKernelArgs);
|
|
|
|
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Mount boot file system\n");
|
2005-10-25 20:59:12 +04:00
|
|
|
vfs_mount_boot_file_system(&sKernelArgs);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
The short story: we now have MTRR support on Intel and AMD CPUs (the latter
has not yet been tested, though - I'll do this after this commit):
* Removed the arch_memory_type stuff from vm_area; since there are only 8 memory
ranges on x86, it's simply overkill. The MTRR code now remembers the area ID
and finds the MTRR that way (it could also iterate over the existing MTRRs).
* Introduced some post_modules() init functions.
* If the other x86 CPUs out there don't differ a lot, MTRR functionality might
be put back into the kernel.
* x86_write_msr() was broken, it wrote the 64 bit number with the 32 bit words
switched - it took me some time (and lots of #GPs) to figure that one out.
* Removed the macro read_ebp() and introduced a function x86_read_ebp()
(it's not really a time critical call).
* Followed the Intel docs on how to change MTRRs (symmetrically on all CPUs
with caches turned off).
* Asking for memory types will automatically change the requested length to
a power of two - note that BeOS seems to behave in the same, although that's
not really very clean.
* fixed MTRRs are ignored for now - we should make sure at least, though,
that they are identical on all CPUs (or turn them off, even though I'd
prefer the BIOS stuff to be uncacheable, which we don't enforce yet, though).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-13 19:34:29 +03:00
|
|
|
// CPU specific modules may now be available
|
|
|
|
cpu_init_post_modules(&sKernelArgs);
|
|
|
|
vm_init_post_modules(&sKernelArgs);
|
2005-12-13 03:06:52 +03:00
|
|
|
debug_init_post_modules(&sKernelArgs);
|
2006-11-29 22:09:45 +03:00
|
|
|
device_manager_init_post_modules(&sKernelArgs);
|
2005-12-13 03:06:52 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
// start the init process
|
|
|
|
{
|
2004-11-02 00:44:23 +03:00
|
|
|
const char *shellArgs[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", NULL};
|
|
|
|
const char *initArgs[] = {"/bin/init", NULL};
|
|
|
|
const char **args;
|
|
|
|
int32 argc;
|
|
|
|
thread_id thread;
|
|
|
|
|
|
|
|
struct stat st;
|
|
|
|
if (stat(shellArgs[1], &st) == 0) {
|
|
|
|
// start Bootscript
|
|
|
|
args = shellArgs;
|
|
|
|
argc = 2;
|
|
|
|
} else {
|
|
|
|
// ToDo: this is only necessary as long as we have the bootdir mechanism
|
|
|
|
// start init
|
|
|
|
args = initArgs;
|
|
|
|
argc = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
thread = load_image(argc, args, NULL);
|
2004-10-14 22:18:22 +04:00
|
|
|
if (thread >= B_OK) {
|
|
|
|
resume_thread(thread);
|
2007-02-19 03:11:24 +03:00
|
|
|
TRACE("Bootscript started\n");
|
2004-10-14 22:18:22 +04:00
|
|
|
} else
|
2004-11-02 00:44:23 +03:00
|
|
|
dprintf("error starting \"%s\" error = %ld \n", args[0], thread);
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|