/usr/include/xenomai/asm-x86/switch_32.h is in libxenomai-dev 2.6.4+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /*
* Copyright (C) 2001-2007 Philippe Gerum <rpm@xenomai.org>.
* Copyright (C) 2004,2005 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
*
* Xenomai is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Xenomai is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Xenomai; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _XENO_ASM_X86_SWITCH_32_H
#define _XENO_ASM_X86_SWITCH_32_H
#define _XENO_ASM_X86_SWITCH_H
#ifndef __KERNEL__
#error "Pure kernel header included from user-space!"
#endif
#ifdef CONFIG_CC_STACKPROTECTOR
#warning "Buffer overflow detection not supported in 32bit mode"
#error "Disable CONFIG_CC_STACKPROTECTOR in your kernel configuration"
#endif
static inline void xnarch_switch_threads(xnarchtcb_t *out_tcb,
xnarchtcb_t *in_tcb,
struct task_struct *outproc,
struct task_struct *inproc)
{
#if __GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ < 2
__asm__ __volatile__("pushfl\n\t"
"pushl %%ecx\n\t"
"pushl %%edi\n\t"
"pushl %%ebp\n\t"
"movl %0,%%ecx\n\t"
"movl %%esp,(%%ecx)\n\t"
"movl %1,%%ecx\n\t"
"movl $2f,(%%ecx)\n\t"
"movl %2,%%ecx\n\t"
"movl %3,%%edi\n\t"
"movl (%%ecx),%%esp\n\t"
"pushl (%%edi)\n\t"
"testl %%edx,%%edx\n\t"
"je 1f\n\t"
"cmp %%edx,%%eax\n\t"
"jne __switch_to\n\t"
"1: ret\n\t"
"2: popl %%ebp\n\t"
"popl %%edi\n\t"
"popl %%ecx\n\t"
"popfl\n\t": /* no output */
:"m"(out_tcb->spp),
"m"(out_tcb->ipp),
"m"(in_tcb->spp),
"m"(in_tcb->ipp),
"b"(out_tcb),
"S"(in_tcb), "a"(outproc), "d"(inproc));
#else /* GCC version >= 3.2 */
long ebx_out, ecx_out, edi_out, esi_out;
__asm__ __volatile__("pushfl\n\t"
"pushl %%ebp\n\t"
"movl %6,%%ecx\n\t"
"movl %%esp,(%%ecx)\n\t"
"movl %7,%%ecx\n\t"
"movl $2f,(%%ecx)\n\t"
"movl %8,%%ecx\n\t"
"movl %9,%%edi\n\t"
"movl (%%ecx),%%esp\n\t"
"pushl (%%edi)\n\t"
"testl %%edx,%%edx\n\t"
"je 1f\n\t"
"cmp %%edx,%%eax\n\t"
"jne __switch_to\n\t"
"1: ret\n\t"
"2: popl %%ebp\n\t"
"popfl\n\t":"=b"(ebx_out),
"=&c"(ecx_out),
"=S"(esi_out),
"=D"(edi_out), "+a"(outproc), "+d"(inproc)
:"m"(out_tcb->spp),
"m"(out_tcb->ipp),
"m"(in_tcb->spp), "m"(in_tcb->ipp));
#endif /* GCC version < 3.2 */
}
#define xnarch_thread_head() do { } while (0)
#endif /* !_XENO_ASM_X86_SWITCH_32_H */
|