summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c3
-rw-r--r--sys/kern/kern_exit.c1
-rw-r--r--sys/kern/kern_panic.c8
-rw-r--r--sys/kern/kern_sched.c17
-rw-r--r--sys/kern/kern_spawn.c6
5 files changed, 30 insertions, 5 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 670d68c..146c4a9 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -35,6 +35,7 @@
#include <sys/exec.h>
#include <sys/driver.h>
#include <sys/panic.h>
+#include <dev/acpi/uacpi.h>
#include <dev/cons/cons.h>
#include <dev/acpi/acpi.h>
#include <machine/cpu.h>
@@ -95,6 +96,8 @@ main(void)
/* Expose the console to devfs */
cons_expose();
+ uacpi_init();
+
/* Start scheduler and bootstrap APs */
md_intoff();
sched_init();
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 3cb48bf..d6c9168 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -48,6 +48,7 @@ unload_td(struct proc *td)
struct pcb *pcbp;
size_t len;
+ sched_detach(td);
execp = &td->exec;
auxvalp = &execp->auxval;
pcbp = &td->pcb;
diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c
index 950ea8f..7660fff 100644
--- a/sys/kern/kern_panic.c
+++ b/sys/kern/kern_panic.c
@@ -31,6 +31,8 @@
#include <sys/spinlock.h>
#include <sys/syslog.h>
#include <sys/reboot.h>
+#include <machine/cdefs.h>
+#include <machine/cpu.h>
/*
* Burn and sizzle - the core logic that really ends
@@ -69,8 +71,12 @@ panic(const char *fmt, ...)
{
va_list ap;
+ /* Shut everything else up */
+ md_intoff();
+ cpu_halt_others();
+
va_start(ap, fmt);
- kprintf(OMIT_TIMESTAMP "panic: ");
+ kprintf(OMIT_TIMESTAMP "\npanic: ");
vkprintf(fmt, &ap);
bas(true, REBOOT_HALT);
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 4bbe5a0..8e5c0e9 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -185,7 +185,7 @@ sched_switch(struct trapframe *tf)
struct cpu_info *ci;
struct pcb *pcbp;
struct proc *next_td, *td;
- bool use_current = true;
+ bool use_current;
ci = this_cpu();
td = ci->curtd;
@@ -200,6 +200,7 @@ sched_switch(struct trapframe *tf)
* in the middle of an exit, exec, or whatever.
*/
do {
+ use_current = true;
if ((next_td = sched_dequeue_td()) == NULL) {
sched_oneshot(false);
return;
@@ -256,10 +257,20 @@ sched_yield(void)
if (td != NULL) {
td->rested = true;
+ sched_switch(&td->tf);
}
+}
- sched_oneshot(false);
- while (td->rested);
+void
+sched_detach(struct proc *td)
+{
+ struct sched_queue *queue;
+
+ spinlock_acquire(&tdq_lock);
+ queue = &qlist[td->priority];
+
+ TAILQ_REMOVE(&queue->q, td, link);
+ spinlock_release(&tdq_lock);
}
void
diff --git a/sys/kern/kern_spawn.c b/sys/kern/kern_spawn.c
index 2cddd84..cb898dc 100644
--- a/sys/kern/kern_spawn.c
+++ b/sys/kern/kern_spawn.c
@@ -81,7 +81,11 @@ spawn_thunk(void)
path = NULL;
dynfree(args);
- execve(cur, &execve_args);
+
+ if (execve(cur, &execve_args) != 0) {
+ pr_error("execve failed, aborting\n");
+ exit1(this_td());
+ }
__builtin_unreachable();
}