rtai-core/include/asm-i386/rtai_sched.h

00001 /*
00002  * Copyright (C) 1999-2003 Paolo Mantegazza <mantegazza@aero.polimi.it>
00003  * Copyright (C) 2000      Stuart Hughes    <shughes@zentropix.com>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License as
00007  * published by the Free Software Foundation; either version 2 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 /* !_RTAI_ASM_I386_SCHED_H */

Generated on Sat Jul 24 19:36:02 2004 for RTAI API by doxygen 1.3.4