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 rt_exchange_tasks(oldtask, newtask) \
00024         __asm__ __volatile__( \
00025         "pushl %%eax\n\t" \
00026         "pushl %%ebp\n\t" \
00027         "pushl %%edi\n\t" \
00028         "pushl %%esi\n\t" \
00029         "pushl %%edx\n\t" \
00030         "pushl %%ecx\n\t" \
00031         "pushl %%ebx\n\t" \
00032         "pushl $1f\n\t" \
00033         "movl (%%ecx), %%ebx\n\t" \
00034         "movl %%esp, (%%ebx)\n\t" \
00035         "movl (%%edx), %%esp\n\t" \
00036         "movl %%edx, (%%ecx)\n\t" \
00037         "ret\n\t" \
00038 "1:     popl %%ebx\n\t \
00039         popl %%ecx\n\t \
00040         popl %%edx\n\t \
00041         popl %%esi\n\t \
00042         popl %%edi\n\t \
00043         popl %%ebp\n\t \
00044         popl %%eax\n\t" \
00045         : \
00046         : "c" (&oldtask), "d" (newtask) \
00047         );
00048 
00049 #define init_arch_stack() \
00050 do { \
00051         *--(task->stack) = data;                \
00052         *--(task->stack) = (int) rt_thread;     \
00053         *--(task->stack) = 0;                   \
00054         *--(task->stack) = (int) rt_startup;    \
00055 } while(0)
00056 
00057 #define DEFINE_LINUX_CR0      static unsigned long linux_cr0;
00058 
00059 #define DEFINE_LINUX_SMP_CR0  static unsigned long linux_smp_cr0[NR_RT_CPUS];
00060 
00061 #define init_fp_env(spare_fpu_reg) \
00062 do { \
00063         save_cr0_and_clts(linux_cr0);   \
00064         save_fpenv(spare_fpu_reg);      \
00065         init_xfpu();                    \
00066         save_fpenv(task->fpu_reg);      \
00067         restore_fpenv(spare_fpu_reg);   \
00068         restore_cr0(linux_cr0);         \
00069 } while(0)
00070 
00071 static inline void *get_stack_pointer(void)
00072 {
00073         void *sp;
00074         asm volatile ("movl %%esp, %0" : "=r" (sp));
00075         return sp;
00076 }
00077 
00078 #define RT_SET_RTAI_TRAP_HANDLER(x)  rt_set_rtai_trap_handler(x)
00079 
00080 #define DO_TIMER_PROPER_OP();
00081 
00082 #endif /* !_RTAI_ASM_I386_SCHED_H */

Generated on Tue Jan 18 22:53:52 2005 for RTAI API by  doxygen 1.3.9.1