aboutsummaryrefslogtreecommitdiff
path: root/kernel/l0/task.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2014-12-07 20:11:06 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2014-12-07 20:11:06 +0100
commitbd1ed224590700c7568dd6a73a2dadcda238b1d5 (patch)
tree65d1204bfd1ef486529c314f3c9f942bd728e78e /kernel/l0/task.c
parentf0475a3d517b4df8eb2b73f22eaec91a72bcc51f (diff)
downloadkogata-bd1ed224590700c7568dd6a73a2dadcda238b1d5.tar.gz
kogata-bd1ed224590700c7568dd6a73a2dadcda238b1d5.zip
Information about current PD now stored in current_task->current_pd_d
Diffstat (limited to 'kernel/l0/task.c')
-rw-r--r--kernel/l0/task.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/l0/task.c b/kernel/l0/task.c
index e02dcf6..f8750e6 100644
--- a/kernel/l0/task.c
+++ b/kernel/l0/task.c
@@ -84,8 +84,10 @@ static void run_task(void (*entry)(void*)) {
ASSERT(current_task->state == T_STATE_RUNNING);
ASSERT(current_task->has_result);
- current_task->has_result = false;
+ switch_pagedir(get_kernel_pagedir());
+ current_task->has_result = false;
+
asm volatile("sti");
entry(current_task->result);
@@ -125,13 +127,15 @@ task_t *new_task(entry_t entry) {
t->result = 0;
t->has_result = false;
+ t->current_pd_d = get_kernel_pagedir();
+
t->more_data = 0;
return t;
}
void tasking_setup(entry_t cont, void* arg) {
- set_pit_frequency(100);
+ set_pit_frequency(TASK_SWITCH_FREQUENCY);
idt_set_irq_handler(IRQ0, yield);
task_t *t = new_task(cont);
@@ -146,6 +150,7 @@ void tasking_setup(entry_t cont, void* arg) {
void yield() {
if (current_task == 0) {
// might happen before tasking is initialized
+ // (but should not...)
dbg_printf("Warning: probable deadlock.");
} else {
save_context_and_enter_scheduler(&current_task->ctx);