Skip to content

Commit

Permalink
Allow recover from exception
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Aug 6, 2016
1 parent 09a88a9 commit ccba23c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions kernel/include/scheduler.hpp
Expand Up @@ -36,6 +36,11 @@ void sbrk(size_t inc);
void tick();
void reschedule();

/*!
* \brief Indicates a fault in the current process
*/
void fault();

void sleep_ms(size_t time);
void sleep_ms(pid_t pid, size_t time);

Expand Down
4 changes: 1 addition & 3 deletions kernel/src/interrupts.cpp
Expand Up @@ -246,9 +246,7 @@ void _fault_handler(interrupt::fault_regs regs){
double_printf("cr2=%h\n", get_cr2());
double_printf("cr3=%h\n", get_cr3());

//TODO Improve that with kind of blue screen

asm volatile("hlt" : : );
scheduler::fault();
}

void _irq_handler(interrupt::syscall_regs* regs){
Expand Down
6 changes: 6 additions & 0 deletions kernel/src/scheduler.cpp
Expand Up @@ -966,3 +966,9 @@ void scheduler::frequency_updated(uint64_t old_frequency, uint64_t new_frequency
}
}
}

void scheduler::fault(){
logging::logf(logging::log_level::DEBUG, "Fault in %u kill it\n", current_pid);

kill_current_process();
}

0 comments on commit ccba23c

Please sign in to comment.