* Copyright (C) 1998 Ingo Molnar.
*/
-#define FPU_SAVE \
- do { \
- preempt_disable(); \
- if (!test_thread_flag(TIF_USEDFPU)) \
- __asm__ __volatile__ (" clts;\n"); \
- __asm__ __volatile__ ("fsave %0; fwait": "=m"(fpu_save[0])); \
- } while (0)
-
-#define FPU_RESTORE \
- do { \
- __asm__ __volatile__ ("frstor %0": : "m"(fpu_save[0])); \
- if (!test_thread_flag(TIF_USEDFPU)) \
- stts(); \
- preempt_enable(); \
- } while (0)
-
#define LD(x,y) " movq 8*("#x")(%1), %%mm"#y" ;\n"
#define ST(x,y) " movq %%mm"#y", 8*("#x")(%1) ;\n"
#define XO1(x,y) " pxor 8*("#x")(%2), %%mm"#y" ;\n"
xor_pII_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
{
unsigned long lines = bytes >> 7;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
#undef BLOCK
:
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
static void
unsigned long *p3)
{
unsigned long lines = bytes >> 7;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
#undef BLOCK
:
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
static void
unsigned long *p3, unsigned long *p4)
{
unsigned long lines = bytes >> 7;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
#undef BLOCK
:
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
unsigned long *p3, unsigned long *p4, unsigned long *p5)
{
unsigned long lines = bytes >> 7;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
/* need to save/restore p4/p5 manually otherwise gcc's 10 argument
limit gets exceeded (+ counts as two arguments) */
: "r" (p4), "r" (p5)
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
#undef LD
xor_p5_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
{
unsigned long lines = bytes >> 6;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
" .align 32 ;\n"
:
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
static void
unsigned long *p3)
{
unsigned long lines = bytes >> 6;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
" .align 32,0x90 ;\n"
:
: "memory" );
- FPU_RESTORE;
+ kernel_fpu_end();
}
static void
unsigned long *p3, unsigned long *p4)
{
unsigned long lines = bytes >> 6;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
__asm__ __volatile__ (
" .align 32,0x90 ;\n"
:
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
static void
unsigned long *p3, unsigned long *p4, unsigned long *p5)
{
unsigned long lines = bytes >> 6;
- char fpu_save[108];
- FPU_SAVE;
+ kernel_fpu_begin();
/* need to save p4/p5 manually to not exceed gcc's 10 argument limit */
__asm__ __volatile__ (
: "r" (p4), "r" (p5)
: "memory");
- FPU_RESTORE;
+ kernel_fpu_end();
}
static struct xor_block_template xor_block_pII_mmx = {
.do_5 = xor_p5_mmx_5,
};
-#undef FPU_SAVE
-#undef FPU_RESTORE
-
/*
* Cache avoiding checksumming functions utilizing KNI instructions
* Copyright (C) 1999 Zach Brown (with obvious credit due Ingo)