/usr/include/xenomai/asm-x86/fptest.h is in libxenomai-dev 2.6.2.1-2ubuntu2.
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 | #ifndef _XENO_ASM_X86_FPTEST_H
#define _XENO_ASM_X86_FPTEST_H
#ifdef __KERNEL__
#include <linux/module.h>
#include <asm/i387.h>
static inline int fp_kernel_supported(void)
{
return 1;
}
static inline int fp_linux_begin(void)
{
#if defined(CONFIG_X86_USE_3DNOW) \
|| defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE)
/* Ther kernel uses x86 FPU, we can not also use it in our tests. */
static int once = 0;
if (!once) {
once = 1;
printk("%s:%d: Warning: Linux is compiled to use FPU in "
"kernel-space.\nFor this reason, switchtest can not "
"test using FPU in Linux kernel-space.\n",
__FILE__, __LINE__);
}
return -EBUSY;
#endif /* 3DNow or RAID 456 */
kernel_fpu_begin();
/* kernel_fpu_begin() does no re-initialize the fpu context, but
fp_regs_set() implicitely expects an initialized fpu context, so
initialize it here. */
__asm__ __volatile__("fninit");
return 0;
}
static inline void fp_linux_end(void)
{
kernel_fpu_end();
}
#else /* !__KERNEL__ */
#include <stdio.h>
#define printk printf
#endif /* !__KERNEL__ */
static inline void fp_regs_set(unsigned val)
{
unsigned i;
for (i = 0; i < 8; i++)
__asm__ __volatile__("fildl %0": /* no output */ :"m"(val));
}
static inline unsigned fp_regs_check(unsigned val)
{
unsigned i, result = val;
unsigned e[8];
for (i = 0; i < 8; i++)
__asm__ __volatile__("fistpl %0":"=m"(e[7 - i]));
for (i = 0; i < 8; i++)
if (e[i] != val) {
printk("r%d: %u != %u\n", i, e[i], val);
result = e[i];
}
return result;
}
#endif /* _XENO_ASM_X86_FPTEST_H */
|