Hello,

I've been porting RTLinux (Viktor Yodaiken's Realtime extensions) to the
CS89712DB board. 

Realtime threads are scheduled by an exclusive rtl_schedule() function
which is called periodically by the timer and a realtime task has the
stack on top of its structure task->stack is on *task as the first entry.

This code can run the RT task but not switch into normal linux properly.
The 
rtl_linux_task **current, *new;

this actually runs new and saves new as (*current) to indicate the switch.
But when the current task which was actually linux becomes new, the system
hangs.

Is there any noticable error with this switching code that I've been
missing all the while. I am willing to give a CVS snapshot if anyone is
willing to help find out what is wrong.

#define rtl_switch_to(current, new) \
        __asm__ __volatile__( \
        "mrs ip, cpsr \n\t" \
        "stmdb sp!, {r0-sl,fp} \n\t" \
        "str ip, [sp, #-4]! \n\t" \
        "str lr, [sp, #-4]! \n\t" \
        "ldr r0, [%0] \n\t" \
        "str sp, [r0] \n\t" \
        "str %1, [%0] \n\t" \
        "ldr sp, [%1] \n\t" \
        "ldr lr, [sp], #4 \n\t" \
        "ldr ip, [sp], #4 \n\t" \
        "teq ip, #0 \n\t" \
        "beq 1f\n\t" \
        "msr spsr, ip \n1:\t" \
        "ldmia sp!, {r0-sl,fp}^ \n\t" \
        "mov r0, r0 \n\t" \
        "mov r0, r0 \n\t" \
        "mov pc, lr \n\t" \
        : \
        : "r" (current), "r" (new) \
        );     


Thanks!



/-------------------------------------------------------\
|                             ,,    Sunil Beta Baskar    |
|    ' _                    ,`/`,      C 0 D 1 T 0       |
|   /|/_) __|_  _,         ,`/`,   "a brave gnu world"   |
|    |  \|/ |  / |        ,`/`,                          |
|    |(_/|_/|_/\/|_/      `/,'                  *        |
|    |                  .-Y-.                   |_       |
|                       |'-'|         (098220)  (o)      |
|   [EMAIL PROTECTED]     '-.-'          27259    |#|      |
|   [EMAIL PROTECTED]                         `-'      |
\-------------------------------------------------------/

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.

Reply via email to