[BACK]Return to irq_trampoline.c CVS log [TXT][DIR] Up to [local] / funnyos / arch / testarm / boot

File: [local] / funnyos / arch / testarm / boot / irq_trampoline.c (download)

Revision 1.4, Fri Nov 23 13:37:42 2007 UTC (16 years, 5 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +16 -6 lines

basic roundrobin multitasking support in FunnyOS!
_vector_irq saves Sys_mode context (which is treated as struct pcb) in stack and
passes sp to irq_trampoline() which then sets global iframep pointer to point to pcb of interrupted task.

"task" given by u_task (set by user at compile-time) and k_task which is dynamically allocated by the kernel.
scheduler uses list of k_task (circularly linked list) with one constant task "idle".
idle discarded in sched_init() with status TASK_NOSCHED and will not be scheduled after first sched_tick().

tasks created in task/ directory and should implement void ttt_enter(void) to start execution from.
tasks added by inserting new elements in config_tasklist[].

please note that current *ugly* design causes strange behavior if tasks printf something w/out delays..
also, we do not save task's CPSR yet..

/*
 * $Id: irq_trampoline.c,v 1.4 2007/11/23 13:37:42 nbrk Exp $
 */
#include <sys/types.h>

#include <sys/pcb.h>

/*
 * IRQ trampoline->
 * Will enter here when Core IRQ line is asserted.
 * IRQ controller driver configures us to call him on assert;
 * by default (until some irqc attached) we just return doing nothing.
 */

void irq_trampoline(struct pcb *iframep);
void __do_nothing_and_return(void);

/* default to do nothing (will overrided by some irqc driver) */
void 	(*irq_trampoline_func)(void) = __do_nothing_and_return;

/* interrupt frame pointer */
struct pcb *iframep;


void
__do_nothing_and_return(void)
{

	__asm __volatile("mov r1,r1");
}


void
irq_trampoline(struct pcb *ifp)
{

	iframep = ifp;

	irq_trampoline_func();
}