Exemple #1
0
/**
 * Give the control of the CPU to another process.
 *
 * \note Assume the current process has been already added to a wait queue.
 *
 * \warning This should be considered an internal kernel function, even if it
 * is allowed, usage from application code is strongly discouraged.
 */
void proc_switch(void)
{
	ASSERT(proc_preemptAllowed());
	ATOMIC(
		preempt_reset_quantum();
		proc_schedule();
	);
Exemple #2
0
/**
 * Preempt the current task.
 */
void proc_preempt(void)
{
	IRQ_ASSERT_DISABLED();
	ASSERT(current_process);

	/* Perform the kernel preemption */
	LOG_INFO("preempting %p:%s\n", current_process, proc_currentName());
	/* We are inside a IRQ context, so ATOMIC is not needed here */
	SCHED_ENQUEUE(current_process);
	preempt_reset_quantum();
	proc_schedule();
}
Exemple #3
0
void
proc_init()
{
    dbg_uart_str("Proc init\n");

    _proc_id = 0;

    sb_init(&proc_tree);
    list_init(&proc_zero_queue);
    list_init(&proc_normal_queue);
    list_init(&proc_normal_noticks_queue);
    list_init(&proc_realtime_queue);

    list_init(&init_proc_queue);

    Process *init_proc = _proc_construct_init();
    current_process = init_proc;

    proc_schedule();    // update states

    ProcScene *scene = proc_current_scene(init_proc);
    scene->regs[28] = (size_t)mm_do_mmap_empty(PAGE_SIZE, USER_SPACE_SIZE - PAGE_SIZE) + PAGE_SIZE;
}
Exemple #4
0
PUBLIC	void clock_handle(int irq)
{
	ticks++;
	proc_schedule();
}