-// if (CurrentProcess->leaving)
-// {
-// TRACEMSG("leaving to %p:%s", CurrentProcess, CurrentProcess->monitor.name);
-// return;
-// }
-
- old_process = CurrentProcess;
-
- irq_handlers[signum]();
-
- if (old_process != CurrentProcess)
- {
- TRACEMSG("switching from %p:%s to %p:%s",
- old_process, old_process->monitor.name,
- CurrentProcess, CurrentProcess->monitor.name);
- swapcontext(&old_process->context, &CurrentProcess->context);
-// TRACEMSG("launching %p:%s", CurrentProcess, CurrentProcess->monitor.name);
-// CurrentProcess->leaving = true;
-// setcontext(&CurrentProcess->context);
- /* not reached */
- }
-
- TRACEMSG("keeping %p:%s", CurrentProcess, CurrentProcess->monitor.name);
-}
-
-void preempt_init(void)
-{
- struct sigaction act;
- act.sa_handler = irq_entry;
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask, SIGUSR1);
- sigaddset(&act.sa_mask, SIGALRM);
- act.sa_flags = SA_RESTART; /* | SA_SIGINFO; */
-
- irq_handlers[SIGUSR1] = proc_preempt;
- irq_handlers[SIGALRM] = proc_preempt_timer;
- sigaction(SIGUSR1, &act, NULL);
- sigaction(SIGALRM, &act, NULL);
-
- alarm(1); // FIXME
+ timer_setSoftint(&preempt_timer, proc_preempt_timer, NULL);
+ timer_setDelay(&preempt_timer, CONFIG_KERN_QUANTUM);
+ timer_add(&preempt_timer);