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:
+19
-13
@@ -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.
|
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ToDo: fix the atomic_*() functions and possibly move them elsewhere;
|
/* This file contains the cpu functions (init, etc). */
|
||||||
// they are exported in libroot.so anyway, so the best place would
|
|
||||||
// probably there.
|
|
||||||
|
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <cpu.h>
|
#include <cpu.h>
|
||||||
@@ -18,26 +16,34 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
/* global per-cpu structure */
|
/* global per-cpu structure */
|
||||||
cpu_ent cpu[MAX_BOOT_CPUS];
|
cpu_ent cpu[MAX_BOOT_CPUS];
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
cpu_init(kernel_args *ka)
|
cpu_init(kernel_args *args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(cpu, 0, sizeof(cpu));
|
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;
|
cpu[i].info.cpu_num = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return arch_cpu_init(ka);
|
return arch_cpu_init(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
cpu_preboot_init(kernel_args *ka)
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,15 +348,15 @@ cmd_continue(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
dbg_init(kernel_args *ka)
|
debug_init(kernel_args *args)
|
||||||
{
|
{
|
||||||
return arch_dbg_con_init(ka);
|
return arch_dbg_con_init(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
dbg_init2(kernel_args *ka)
|
debug_init_post_vm(kernel_args *args)
|
||||||
{
|
{
|
||||||
add_debugger_command("help", &cmd_help, "List all debugger commands");
|
add_debugger_command("help", &cmd_help, "List all debugger commands");
|
||||||
add_debugger_command("reboot", &cmd_reboot, "Reboot the system");
|
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("exit", &cmd_continue, NULL);
|
||||||
add_debugger_command("es", &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
|
// ToDo: this one is probably not needed
|
||||||
|
|||||||
@@ -45,23 +45,23 @@ restore_interrupts(cpu_status status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
int_init(kernel_args *ka)
|
int_init(kernel_args *args)
|
||||||
{
|
{
|
||||||
dprintf("init_int_handlers: entry\n");
|
dprintf("init_int_handlers: entry\n");
|
||||||
|
|
||||||
return arch_int_init(ka);
|
return arch_int_init(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
status_t
|
||||||
int_init2(kernel_args *ka)
|
int_init_post_vm(kernel_args *args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
io_vectors = (struct io_vector *)malloc(sizeof(struct io_vector) * NUM_IO_VECTORS);
|
io_vectors = (struct io_vector *)malloc(sizeof(struct io_vector) * NUM_IO_VECTORS);
|
||||||
if (io_vectors == NULL)
|
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 */
|
/* initialize the vector list */
|
||||||
for (i = 0; i < NUM_IO_VECTORS; i++) {
|
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 */
|
initque(&io_vectors[i].handler_list); /* initialize handler queue */
|
||||||
}
|
}
|
||||||
|
|
||||||
return arch_int_init2(ka);
|
return arch_int_init_post_vm(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <arch/faults.h>
|
#include <arch/faults.h>
|
||||||
#include <arch/int.h>
|
|
||||||
#include <arch/cpu.h>
|
|
||||||
#include <vm.h>
|
#include <vm.h>
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
@@ -77,7 +75,7 @@ _start(kernel_args *oldka, int cpu_num)
|
|||||||
smp_wait_for_ap_cpus(&ka);
|
smp_wait_for_ap_cpus(&ka);
|
||||||
|
|
||||||
// setup debug output
|
// setup debug output
|
||||||
dbg_init(&ka);
|
debug_init(&ka);
|
||||||
set_dprintf_enabled(true);
|
set_dprintf_enabled(true);
|
||||||
dprintf("Welcome to kernel debugger output!\n");
|
dprintf("Welcome to kernel debugger output!\n");
|
||||||
|
|
||||||
@@ -86,19 +84,21 @@ _start(kernel_args *oldka, int cpu_num)
|
|||||||
int_init(&ka);
|
int_init(&ka);
|
||||||
|
|
||||||
vm_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"));
|
TRACE(("vm up\n"));
|
||||||
|
|
||||||
// now we can use the heap and create areas
|
// now we can use the heap and create areas
|
||||||
dbg_init2(&ka);
|
debug_init_post_vm(&ka);
|
||||||
int_init2(&ka);
|
int_init_post_vm(&ka);
|
||||||
|
cpu_init_post_vm(&ka);
|
||||||
|
|
||||||
faults_init(&ka);
|
faults_init(&ka);
|
||||||
smp_init(&ka);
|
smp_init(&ka);
|
||||||
rtc_init(&ka);
|
rtc_init(&ka);
|
||||||
timer_init(&ka);
|
timer_init(&ka);
|
||||||
|
|
||||||
arch_cpu_init2(&ka);
|
|
||||||
|
|
||||||
sem_init(&ka);
|
sem_init(&ka);
|
||||||
|
|
||||||
TRACE(("##################################################################\n"));
|
TRACE(("##################################################################\n"));
|
||||||
|
|||||||
Reference in New Issue
Block a user