00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _RTAI_ASM_I386_SCHED_H
00021 #define _RTAI_ASM_I386_SCHED_H
00022
00023 #define __STR(x) #x
00024 #define STR(x) __STR(x)
00025
00026 #define rt_switch_to(tsk) \
00027 __asm__ __volatile__( \
00028 "pushl %%eax\n\t" \
00029 "pushl %%ebp\n\t" \
00030 "pushl %%edi\n\t" \
00031 "pushl %%esi\n\t" \
00032 "pushl %%edx\n\t" \
00033 "pushl %%ecx\n\t" \
00034 "pushl %%ebx\n\t" \
00035 "movl "SYMBOL_NAME_STR(rt_smp_current)", %%edx\n\t" \
00036 "pushl $1f\n\t" \
00037 "movl %%esp, (%%edx)\n\t" \
00038 "movl (%%ecx), %%esp\n\t" \
00039 "movl %%ecx, "SYMBOL_NAME_STR(rt_smp_current)"\n\t" \
00040 "ret\n\t" \
00041 "1: popl %%ebx\n\t \
00042 popl %%ecx\n\t \
00043 popl %%edx\n\t \
00044 popl %%esi\n\t \
00045 popl %%edi\n\t \
00046 popl %%ebp\n\t \
00047 popl %%eax\n\t" \
00048 : \
00049 : "c" (tsk));
00050
00051 #define rt_exchange_tasks(oldtask, newtask) \
00052 __asm__ __volatile__( \
00053 "pushl %%eax\n\t" \
00054 "pushl %%ebp\n\t" \
00055 "pushl %%edi\n\t" \
00056 "pushl %%esi\n\t" \
00057 "pushl %%edx\n\t" \
00058 "pushl %%ecx\n\t" \
00059 "pushl %%ebx\n\t" \
00060 "pushl $1f\n\t" \
00061 "movl (%%ecx), %%ebx\n\t" \
00062 "movl %%esp, (%%ebx)\n\t" \
00063 "movl (%%edx), %%esp\n\t" \
00064 "movl %%edx, (%%ecx)\n\t" \
00065 "ret\n\t" \
00066 "1: popl %%ebx\n\t \
00067 popl %%ecx\n\t \
00068 popl %%edx\n\t \
00069 popl %%esi\n\t \
00070 popl %%edi\n\t \
00071 popl %%ebp\n\t \
00072 popl %%eax\n\t" \
00073 : \
00074 : "c" (&oldtask), "d" (newtask) \
00075 : "bx");
00076
00077 #define init_arch_stack() \
00078 do { \
00079 *--(task->stack) = data; \
00080 *--(task->stack) = (int) rt_thread; \
00081 *--(task->stack) = 0; \
00082 *--(task->stack) = (int) rt_startup; \
00083 } while(0)
00084
00085 #define DEFINE_LINUX_CR0 static unsigned long linux_cr0;
00086
00087 #define DEFINE_LINUX_SMP_CR0 static unsigned long linux_smp_cr0[NR_RT_CPUS];
00088
00089 #define init_fp_env() \
00090 do { \
00091 save_cr0_and_clts(linux_cr0); \
00092 save_fpenv(fpu_task->fpu_reg); \
00093 init_xfpu(); \
00094 save_fpenv(task->fpu_reg); \
00095 restore_fpenv(fpu_task->fpu_reg); \
00096 restore_cr0(linux_cr0); \
00097 } while(0)
00098
00099 static inline void *get_stack_pointer(void)
00100 {
00101 void *sp;
00102 asm volatile ("movl %%esp, %0" : "=r" (sp));
00103 return sp;
00104 }
00105
00106 #define RT_SET_RTAI_TRAP_HANDLER(x) rt_set_rtai_trap_handler(x)
00107
00108 #define DO_TIMER_PROPER_OP()
00109
00110 #endif