mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
x86/asm: Remove unused __constant_c_x_memset() macro and inlines
Nothing refers to the __constant_c_x_memset() macro anymore. Remove it and the two referenced static inline functions. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: x86-ml <x86@kernel.org> Link: https://lkml.kernel.org/r/20190111084931.24601-2-linux@rasmusvillemoes.dk
This commit is contained in:
parent
88ca66d854
commit
2e905c7abd
1 changed files with 0 additions and 84 deletions
|
@ -209,29 +209,6 @@ static inline void *__memset_generic(void *s, char c, size_t count)
|
|||
/* we might want to write optimized versions of these later */
|
||||
#define __constant_count_memset(s, c, count) __memset_generic((s), (c), (count))
|
||||
|
||||
/*
|
||||
* memset(x, 0, y) is a reasonably common thing to do, so we want to fill
|
||||
* things 32 bits at a time even when we don't know the size of the
|
||||
* area at compile-time..
|
||||
*/
|
||||
static __always_inline
|
||||
void *__constant_c_memset(void *s, unsigned long c, size_t count)
|
||||
{
|
||||
int d0, d1;
|
||||
asm volatile("rep ; stosl\n\t"
|
||||
"testb $2,%b3\n\t"
|
||||
"je 1f\n\t"
|
||||
"stosw\n"
|
||||
"1:\ttestb $1,%b3\n\t"
|
||||
"je 2f\n\t"
|
||||
"stosb\n"
|
||||
"2:"
|
||||
: "=&c" (d0), "=&D" (d1)
|
||||
: "a" (c), "q" (count), "0" (count/4), "1" ((long)s)
|
||||
: "memory");
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Added by Gertjan van Wingerde to make minix and sysv module work */
|
||||
#define __HAVE_ARCH_STRNLEN
|
||||
extern size_t strnlen(const char *s, size_t count);
|
||||
|
@ -240,67 +217,6 @@ extern size_t strnlen(const char *s, size_t count);
|
|||
#define __HAVE_ARCH_STRSTR
|
||||
extern char *strstr(const char *cs, const char *ct);
|
||||
|
||||
/*
|
||||
* This looks horribly ugly, but the compiler can optimize it totally,
|
||||
* as we by now know that both pattern and count is constant..
|
||||
*/
|
||||
static __always_inline
|
||||
void *__constant_c_and_count_memset(void *s, unsigned long pattern,
|
||||
size_t count)
|
||||
{
|
||||
switch (count) {
|
||||
case 0:
|
||||
return s;
|
||||
case 1:
|
||||
*(unsigned char *)s = pattern & 0xff;
|
||||
return s;
|
||||
case 2:
|
||||
*(unsigned short *)s = pattern & 0xffff;
|
||||
return s;
|
||||
case 3:
|
||||
*(unsigned short *)s = pattern & 0xffff;
|
||||
*((unsigned char *)s + 2) = pattern & 0xff;
|
||||
return s;
|
||||
case 4:
|
||||
*(unsigned long *)s = pattern;
|
||||
return s;
|
||||
}
|
||||
|
||||
#define COMMON(x) \
|
||||
asm volatile("rep ; stosl" \
|
||||
x \
|
||||
: "=&c" (d0), "=&D" (d1) \
|
||||
: "a" (eax), "0" (count/4), "1" ((long)s) \
|
||||
: "memory")
|
||||
|
||||
{
|
||||
int d0, d1;
|
||||
unsigned long eax = pattern;
|
||||
|
||||
switch (count % 4) {
|
||||
case 0:
|
||||
COMMON("");
|
||||
return s;
|
||||
case 1:
|
||||
COMMON("\n\tstosb");
|
||||
return s;
|
||||
case 2:
|
||||
COMMON("\n\tstosw");
|
||||
return s;
|
||||
default:
|
||||
COMMON("\n\tstosw\n\tstosb");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define __constant_c_x_memset(s, c, count) \
|
||||
(__builtin_constant_p(count) \
|
||||
? __constant_c_and_count_memset((s), (c), (count)) \
|
||||
: __constant_c_memset((s), (c), (count)))
|
||||
|
||||
#define __memset(s, c, count) \
|
||||
(__builtin_constant_p(count) \
|
||||
? __constant_count_memset((s), (c), (count)) \
|
||||
|
|
Loading…
Reference in a new issue