Skip to content
Snippets Groups Projects
Select Git revision
  • 698f664b1693ed5873c016961da9ec24c9bc3e63
  • master default protected
2 results

core.c

Blame
  • core.c 7.20 KiB
    /**
     * @file kernel/sched/core.c
     *
     * @brief the core scheduling code
     */
    
    
    
    #include <kernel/err.h>
    #include <kernel/kthread.h>
    #include <kernel/sched.h>
    #include <kernel/init.h>
    #include <kernel/tick.h>
    #include <asm-generic/irqflags.h>
    #include <asm-generic/spinlock.h>
    #include <asm/switch_to.h>
    #include <string.h>
    
    #include <asm/leon.h>
    
    
    #define MSG "SCHEDULER: "
    
    static LIST_HEAD(kernel_schedulers);
    
    
    /* XXX: per-cpu */
    extern struct thread_info *current_set[];
    
    ktime sched_last_time;
    uint32_t sched_ev;
    
     void kthread_lock(void);
     void kthread_unlock(void);
    void schedule(void)
    {
    	struct scheduler *sched;
    
    	struct task_struct *next = NULL;
    	struct task_struct *prev = NULL;
    
    	struct task_struct *current;
    	int64_t slot_ns = 1000000LL;
    	int64_t wake_ns = 1000000000;
    
    	ktime rt;
    	ktime now;
    
    
    	static int once[2];
    	if (!once[leon3_cpuid()]) {
    
    //	tick_set_mode(TICK_MODE_PERIODIC);
    	tick_set_next_ns(1e9);	/* XXX default to 1s ticks initially */
    	once[leon3_cpuid()] = 1;
    	return;
    	}
    
    
    
    	arch_local_irq_disable();
    //	if (leon3_cpuid() != 0)
    //	printk("cpu %d\n", leon3_cpuid());
    
    	/* get the current task for this CPU */
    	/* XXX leon3_cpuid() should be smp_cpu_id() arch call*/
    	current = current_set[leon3_cpuid()]->task;
    
    
    //	if (leon3_cpuid() != 0)