#ifndef ASM_VIDEO_H
#define ASM_VIDEO_H
static inline void copy(void *dest, const void *src, unsigned int count)
{
int d0, d1, d2;
asm volatile ("cld\n\t"
"rep\n\t"
"movsl\n\t"
"testb $1, %b4\n\t"
"je 1f\n\t"
"movsw\n"
"1:"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "0" (count >> 1), "q" (count), "1" (dest), "2" (src)
: "cc", "memory");
}
static inline void fill(void *dest, int c, unsigned int count)
{
int d0, d1;
asm volatile ("cld\n\t"
"rep\n\t"
"stosw"
: "=&c" (d0), "=&D" (d1)
: "a" (c), "0" (count), "1" (dest)
: "cc", "memory");
}
static inline void copy_fill(void *dest, const void *src, unsigned int count_copy, int c, unsigned int count_fill)
{
int d0, d1, d2;
asm volatile ("cld\n\t"
"rep\n\t"
"movsl\n\t"
"testb $1, %b6\n\t"
"je 1f\n\t"
"movsw\n"
"1:\tmovl %q3, %5\n\t"
"rep\n\t"
"stosw"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "q" (count_fill), "a" (c), "0" (count_copy >> 1), "q" (count_copy), "1" (dest), "2" (src)
: "cc", "memory");
}
#endif