summaryrefslogtreecommitdiff
path: root/kern/kernel.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-01-13 23:13:01 +0100
committerRichard Braun <rbraun@sceen.net>2014-01-14 01:35:17 +0100
commit9d998f839452b005401b00c76fd8d03ca062e096 (patch)
tree6537e14ac3a031ac23ca909079003fd07f31abba /kern/kernel.c
parentcbca7bb4f1f59aee176aeb79a69fafd51e17b267 (diff)
Rework bootstrapping
Start application processors once the kernel is completely initialized, right before starting the scheduler. This simplifies the procedure with regard to inter-processor pmap updates.
Diffstat (limited to 'kern/kernel.c')
-rw-r--r--kern/kernel.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/kern/kernel.c b/kern/kernel.c
index d636d54a..ea11bf2b 100644
--- a/kern/kernel.c
+++ b/kern/kernel.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, 2013 Richard Braun.
+ * Copyright (c) 2011-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,10 +31,6 @@ kernel_main(void)
{
assert(!cpu_intr_enabled());
- /* Enable interrupts to allow inter-processor pmap updates */
- cpu_intr_enable();
-
- /* Initialize the kernel */
rdxtree_setup();
cpumap_setup();
task_setup();
@@ -42,11 +38,13 @@ kernel_main(void)
work_setup();
llsync_setup();
- /* Rendezvous with APs */
- cpu_mp_sync();
+ /*
+ * Enabling application processors must be the last step before starting
+ * the scheduler.
+ */
+ cpu_mp_setup();
- /* Run the scheduler */
- thread_run();
+ thread_run_scheduler();
/* Never reached */
}
@@ -56,17 +54,7 @@ kernel_ap_main(void)
{
assert(!cpu_intr_enabled());
- /*
- * Enable interrupts to allow inter-processor pmap updates while the BSP
- * is initializing the kernel.
- */
- cpu_intr_enable();
-
- /* Wait for the BSP to complete kernel initialization */
- cpu_ap_sync();
-
- /* Run the scheduler */
- thread_run();
+ thread_run_scheduler();
/* Never reached */
}