switch.h File Reference

Kernel scheduler macros. More...

#include <kern/proc_p.h>

Go to the source code of this file.


Defines

#define SCHEDULER_IRQ_ENTRY
 Interrupt entry point.

Detailed Description

Kernel scheduler macros.

Version:
Id
switch.h 1071 2008-01-29 10:58:04Z batt

Author:
Francesco Sacchi <batt@develer.com>

Stefano Fedrigo <aleph@develer.com>

Definition in file switch.h.


Define Documentation

#define SCHEDULER_IRQ_ENTRY

Value:

asm volatile("sub   lr, lr, #4          \n\t"  /* Adjust LR */ \
                 "stmfd sp!, {r0}           \n\t"  /* Save r0 */ \
                 "stmfd sp, {sp}^           \n\t"  /* Save user SP */ \
                 "sub   sp, sp, #4          \n\t"  /* Decrement irq SP, writeback is illegal */ \
                 "ldmfd sp!, {r0}           \n\t"  /* Restore user SP immedately in r0 */ \
                 "stmfd r0!, {lr}       \n\t"  /* Store system LR in user stack */ \
                 "stmfd r0, {r1-r12,lr}^    \n\t"  /* Store registers on user stack (user LR too) */ \
                 "sub   r0, r0, #52         \n\t"  /* Decrement r0, writeback is illegal */ \
                 "ldmfd sp!, {r1}           \n\t"  /* Restore r0 */ \
                 "stmfd r0!, {r1}           \n\t"  /* Store r0 in user stack too */ \
                 "mrs   r1, spsr            \n\t"  /* Save SPSR... */ \
                 "stmfd r0!, {r1}           \n\t"  /*  ... in user stack */ \
                 "ldr   r1, =CurrentProcess \n\t"  /* Load in r1 &CurrentProcess->stack */ \
                 "ldr   r1, [r1, %0]        \n\t"  \
                 "str   r0, [r1]            \n\t"  /* Store the process SP */ \
                 "sub   fp, sp, #4          \n\t"  /* Store the process SP */ \
                 : /* no output */ \
                 : "n" (offsetof(Process, stack)) \
    )
Interrupt entry point.

Needed because AT91 uses an Interrupt Controller with auto-vectoring.

Definition at line 50 of file switch.h.