Renamed some init2() functions to init_post_vm() to make clearer when and why

they are called.
Introduced a cpu_init_post_vm() that will now call arch_init_post_vm() instead
of letting main() doing it.
Fixed some return types (mostly from int to status_t).
Some minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-21 01:45:43 +00:00
parent b0d8e689ac
commit d330cc09e2
4 changed files with 40 additions and 34 deletions

View File

@ -1,14 +1,12 @@
/* This file contains the cpu functions (init, etc). */
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
// ToDo: fix the atomic_*() functions and possibly move them elsewhere;
// they are exported in libroot.so anyway, so the best place would
// probably there.
/* This file contains the cpu functions (init, etc). */
#include <kernel.h>
#include <cpu.h>
@ -18,26 +16,34 @@
#include <string.h>
/* global per-cpu structure */
cpu_ent cpu[MAX_BOOT_CPUS];
int
cpu_init(kernel_args *ka)
status_t
cpu_init(kernel_args *args)
{
int i;
memset(cpu, 0, sizeof(cpu));
for(i = 0; i < MAX_BOOT_CPUS; i++) {
for (i = 0; i < MAX_BOOT_CPUS; i++) {
cpu[i].info.cpu_num = i;
}
return arch_cpu_init(ka);
return arch_cpu_init(args);
}
int
cpu_preboot_init(kernel_args *ka)
status_t
cpu_init_post_vm(kernel_args *args)
{
return arch_cpu_preboot_init(ka);
return arch_cpu_init_post_vm(args);
}
status_t
cpu_preboot_init(kernel_args *args)
{
return arch_cpu_preboot_init(args);
}

View File

@ -348,15 +348,15 @@ cmd_continue(int argc, char **argv)
}
int
dbg_init(kernel_args *ka)
status_t
debug_init(kernel_args *args)
{
return arch_dbg_con_init(ka);
return arch_dbg_con_init(args);
}
int
dbg_init2(kernel_args *ka)
status_t
debug_init_post_vm(kernel_args *args)
{
add_debugger_command("help", &cmd_help, "List all debugger commands");
add_debugger_command("reboot", &cmd_reboot, "Reboot the system");
@ -365,7 +365,7 @@ dbg_init2(kernel_args *ka)
add_debugger_command("exit", &cmd_continue, NULL);
add_debugger_command("es", &cmd_continue, NULL);
return arch_dbg_init(ka);
return arch_dbg_init(args);
}
// ToDo: this one is probably not needed

View File

@ -45,23 +45,23 @@ restore_interrupts(cpu_status status)
}
int
int_init(kernel_args *ka)
status_t
int_init(kernel_args *args)
{
dprintf("init_int_handlers: entry\n");
return arch_int_init(ka);
return arch_int_init(args);
}
int
int_init2(kernel_args *ka)
status_t
int_init_post_vm(kernel_args *args)
{
int i;
io_vectors = (struct io_vector *)malloc(sizeof(struct io_vector) * NUM_IO_VECTORS);
if (io_vectors == NULL)
panic("int_init2: could not create io vector table!\n");
panic("int_init_post_vm: could not create io vector table!\n");
/* initialize the vector list */
for (i = 0; i < NUM_IO_VECTORS; i++) {
@ -69,7 +69,7 @@ int_init2(kernel_args *ka)
initque(&io_vectors[i].handler_list); /* initialize handler queue */
}
return arch_int_init2(ka);
return arch_int_init_post_vm(args);
}

View File

@ -14,8 +14,6 @@
#include <console.h>
#include <debug.h>
#include <arch/faults.h>
#include <arch/int.h>
#include <arch/cpu.h>
#include <vm.h>
#include <timer.h>
#include <smp.h>
@ -77,7 +75,7 @@ _start(kernel_args *oldka, int cpu_num)
smp_wait_for_ap_cpus(&ka);
// setup debug output
dbg_init(&ka);
debug_init(&ka);
set_dprintf_enabled(true);
dprintf("Welcome to kernel debugger output!\n");
@ -86,19 +84,21 @@ _start(kernel_args *oldka, int cpu_num)
int_init(&ka);
vm_init(&ka);
// Before vm_init_post_sem() is called, we have to make sure that
// the boot loader allocated region is not used anymore
TRACE(("vm up\n"));
// now we can use the heap and create areas
dbg_init2(&ka);
int_init2(&ka);
debug_init_post_vm(&ka);
int_init_post_vm(&ka);
cpu_init_post_vm(&ka);
faults_init(&ka);
smp_init(&ka);
rtc_init(&ka);
timer_init(&ka);
arch_cpu_init2(&ka);
sem_init(&ka);
TRACE(("##################################################################\n"));