Commit 11828b23 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds

[PATCH] removing bcopy... because it's half broken

Nothing in the kernel is using bcopy right know, and that is a good thing.
Why? Because a lot of the architectures implement a broken bcopy()....
the userspace standard bcopy() is basically a memmove() with a weird
parameter order, however a bunch of architectures implement a memcpy() not a
memmove().

Instead of fixing this inconsistency, I decided to remove it entirely,
explicit memcpy() and memmove() are prefered anyway (welcome to the 1990's)
and nothing in the kernel is using these functions, so this saves code size
as well for everyone.
Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>

[ Side note: the only reason for bcopy appears to be totally ancient
  gcc versions for OSF/1, used to originally cross-compile Linux on
  alpha. Possibly some other similar cases. Time to move on ;-]
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5dd0c5ab
...@@ -11,18 +11,6 @@ ...@@ -11,18 +11,6 @@
.set noreorder .set noreorder
.text .text
.align 4
.globl bcopy
.ent bcopy
bcopy:
ldgp $29, 0($27)
.prologue 1
mov $16,$0
mov $17,$16
mov $0,$17
br $31, memmove !samegp
.end bcopy
.align 4 .align 4
.globl memmove .globl memmove
.ent memmove .ent memmove
......
...@@ -15,22 +15,6 @@ ...@@ -15,22 +15,6 @@
*/ */
#include <asm/asmmacro.h> #include <asm/asmmacro.h>
GLOBAL_ENTRY(bcopy)
.regstk 3,0,0,0
mov r8=in0
mov in0=in1
;;
mov in1=r8
// gas doesn't handle control flow across procedures, so it doesn't
// realize that a stop bit is needed before the "alloc" instruction
// below
{
nop.m 0
nop.f 0
nop.i 0
} ;;
END(bcopy)
// FALL THROUGH
GLOBAL_ENTRY(memcpy) GLOBAL_ENTRY(memcpy)
# define MEM_LAT 21 /* latency to memory */ # define MEM_LAT 21 /* latency to memory */
......
...@@ -17,15 +17,6 @@ ...@@ -17,15 +17,6 @@
#define EK(y...) EX(y) #define EK(y...) EX(y)
GLOBAL_ENTRY(bcopy)
.regstk 3,0,0,0
mov r8=in0
mov in0=in1
;;
mov in1=r8
;;
END(bcopy)
/* McKinley specific optimization */ /* McKinley specific optimization */
#define retval r8 #define retval r8
......
...@@ -515,16 +515,8 @@ void * memcpy(void * dst,const void *src, size_t count) ...@@ -515,16 +515,8 @@ void * memcpy(void * dst,const void *src, size_t count)
return dst; return dst;
} }
void bcopy(const void * srcp, void * destp, size_t count)
{
mtsp(get_kernel_space(), 1);
mtsp(get_kernel_space(), 2);
pa_memcpy(destp, srcp, count);
}
EXPORT_SYMBOL(copy_to_user); EXPORT_SYMBOL(copy_to_user);
EXPORT_SYMBOL(copy_from_user); EXPORT_SYMBOL(copy_from_user);
EXPORT_SYMBOL(copy_in_user); EXPORT_SYMBOL(copy_in_user);
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(bcopy);
#endif #endif
...@@ -52,7 +52,6 @@ extern char _end[]; ...@@ -52,7 +52,6 @@ extern char _end[];
void puts(const char *); void puts(const char *);
void putc(const char c); void putc(const char c);
void puthex(unsigned long val); void puthex(unsigned long val);
void _bcopy(char *src, char *dst, int len);
void gunzip(void *, int, unsigned char *, int *); void gunzip(void *, int, unsigned char *, int *);
static int _cvt(unsigned long val, char *buf, long radix, char *digits); static int _cvt(unsigned long val, char *buf, long radix, char *digits);
......
...@@ -216,12 +216,6 @@ _GLOBAL(memset) ...@@ -216,12 +216,6 @@ _GLOBAL(memset)
bdnz 8b bdnz 8b
blr blr
_GLOBAL(bcopy)
mr r6,r3
mr r3,r4
mr r4,r6
b memcpy
/* /*
* This version uses dcbz on the complete cache lines in the * This version uses dcbz on the complete cache lines in the
* destination area to reduce memory traffic. This requires that * destination area to reduce memory traffic. This requires that
......
...@@ -96,13 +96,6 @@ memset: ...@@ -96,13 +96,6 @@ memset:
bdnz 8b bdnz 8b
blr blr
.globl bcopy
bcopy:
mr r6,r3
mr r3,r4
mr r4,r6
b memcpy
.globl memmove .globl memmove
memmove: memmove:
cmplw 0,r3,r4 cmplw 0,r3,r4
......
...@@ -356,21 +356,6 @@ void *memcpy(void *dest, const void *src, size_t n) ...@@ -356,21 +356,6 @@ void *memcpy(void *dest, const void *src, size_t n)
} }
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
/**
* bcopy - Copy one area of memory to another
* @src: Where to copy from
* @dest: Where to copy to
* @n: The size of the area.
*
* Note that this is the same as memcpy(), with the arguments reversed.
* memcpy() is the standard, bcopy() is a legacy BSD function.
*/
void bcopy(const void *srcp, void *destp, size_t n)
{
__builtin_memcpy(destp, srcp, n);
}
EXPORT_SYMBOL(bcopy);
/** /**
* memset - Fill a region of memory with the given value * memset - Fill a region of memory with the given value
* @s: Pointer to the start of the area. * @s: Pointer to the start of the area.
......
...@@ -75,7 +75,6 @@ extern void *__memscan_generic(void *, int, size_t); ...@@ -75,7 +75,6 @@ extern void *__memscan_generic(void *, int, size_t);
extern int __memcmp(const void *, const void *, __kernel_size_t); extern int __memcmp(const void *, const void *, __kernel_size_t);
extern int __strncmp(const char *, const char *, __kernel_size_t); extern int __strncmp(const char *, const char *, __kernel_size_t);
extern void bcopy (const char *, char *, int);
extern int __ashrdi3(int, int); extern int __ashrdi3(int, int);
extern int __ashldi3(int, int); extern int __ashldi3(int, int);
extern int __lshrdi3(int, int); extern int __lshrdi3(int, int);
...@@ -261,7 +260,6 @@ EXPORT_SYMBOL(__prom_getchild); ...@@ -261,7 +260,6 @@ EXPORT_SYMBOL(__prom_getchild);
EXPORT_SYMBOL(__prom_getsibling); EXPORT_SYMBOL(__prom_getsibling);
/* sparc library symbols */ /* sparc library symbols */
EXPORT_SYMBOL(bcopy);
EXPORT_SYMBOL(memchr); EXPORT_SYMBOL(memchr);
EXPORT_SYMBOL(memscan); EXPORT_SYMBOL(memscan);
EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strlen);
......
/* memcpy.S: Sparc optimized memcpy, bcopy and memmove code /* memcpy.S: Sparc optimized memcpy and memmove code
* Hand optimized from GNU libc's memcpy, bcopy and memmove * Hand optimized from GNU libc's memcpy and memmove
* Copyright (C) 1991,1996 Free Software Foundation * Copyright (C) 1991,1996 Free Software Foundation
* Copyright (C) 1995 Linus Torvalds (Linus.Torvalds@helsinki.fi) * Copyright (C) 1995 Linus Torvalds (Linus.Torvalds@helsinki.fi)
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
...@@ -192,13 +192,6 @@ x: ...@@ -192,13 +192,6 @@ x:
retl retl
nop ! Only bcopy returns here and it retuns void... nop ! Only bcopy returns here and it retuns void...
FUNC(bcopy)
mov %o0, %o3
mov %o1, %o0
mov %o3, %o1
tst %o2
bcs 0b
/* Do the cmp in the delay slot */
#ifdef __KERNEL__ #ifdef __KERNEL__
FUNC(amemmove) FUNC(amemmove)
FUNC(__memmove) FUNC(__memmove)
......
...@@ -60,11 +60,6 @@ void *memcpy (void *dst, const void *src, __kernel_size_t size) ...@@ -60,11 +60,6 @@ void *memcpy (void *dst, const void *src, __kernel_size_t size)
return dst; return dst;
} }
void bcopy (const char *src, char *dst, int size)
{
memcpy (dst, src, size);
}
void *memmove (void *dst, const void *src, __kernel_size_t size) void *memmove (void *dst, const void *src, __kernel_size_t size)
{ {
if ((unsigned long)dst < (unsigned long)src if ((unsigned long)dst < (unsigned long)src
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
extern void * memcpy(void *, const void *, size_t); extern void * memcpy(void *, const void *, size_t);
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_BCOPY
extern void * memmove(void *, const void *, size_t); extern void * memmove(void *, const void *, size_t);
/* For backward compatibility with modules. Unused otherwise. */ /* For backward compatibility with modules. Unused otherwise. */
......
...@@ -25,8 +25,6 @@ extern void * memchr(const void *, int, __kernel_size_t); ...@@ -25,8 +25,6 @@ extern void * memchr(const void *, int, __kernel_size_t);
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
extern void * memset(void *, int, __kernel_size_t); extern void * memset(void *, int, __kernel_size_t);
#define __HAVE_ARCH_BCOPY
extern void __memzero(void *ptr, __kernel_size_t n); extern void __memzero(void *ptr, __kernel_size_t n);
#define memset(p,v,n) \ #define memset(p,v,n) \
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#define __HAVE_ARCH_STRLEN 1 /* see arch/ia64/lib/strlen.S */ #define __HAVE_ARCH_STRLEN 1 /* see arch/ia64/lib/strlen.S */
#define __HAVE_ARCH_MEMSET 1 /* see arch/ia64/lib/memset.S */ #define __HAVE_ARCH_MEMSET 1 /* see arch/ia64/lib/memset.S */
#define __HAVE_ARCH_MEMCPY 1 /* see arch/ia64/lib/memcpy.S */ #define __HAVE_ARCH_MEMCPY 1 /* see arch/ia64/lib/memcpy.S */
#define __HAVE_ARCH_BCOPY 1 /* see arch/ia64/lib/memcpy.S */
extern __kernel_size_t strlen (const char *); extern __kernel_size_t strlen (const char *);
extern void *memcpy (void *, const void *, __kernel_size_t); extern void *memcpy (void *, const void *, __kernel_size_t);
......
...@@ -137,9 +137,6 @@ extern void *memcpy(void *__to, __const__ void *__from, size_t __n); ...@@ -137,9 +137,6 @@ extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
extern void *memmove(void *__dest, __const__ void *__src, size_t __n); extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
/* Don't build bcopy at all ... */
#define __HAVE_ARCH_BCOPY
#ifdef CONFIG_MIPS32 #ifdef CONFIG_MIPS32
#define __HAVE_ARCH_MEMSCAN #define __HAVE_ARCH_MEMSCAN
static __inline__ void *memscan(void *__addr, int __c, size_t __size) static __inline__ void *memscan(void *__addr, int __c, size_t __size)
......
...@@ -7,7 +7,4 @@ extern void * memset(void *, int, size_t); ...@@ -7,7 +7,4 @@ extern void * memset(void *, int, size_t);
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
void * memcpy(void * dest,const void *src,size_t count); void * memcpy(void * dest,const void *src,size_t count);
#define __HAVE_ARCH_BCOPY
void bcopy(const void * srcp, void * destp, size_t count);
#endif #endif
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#define __HAVE_ARCH_STRCMP #define __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRCAT #define __HAVE_ARCH_STRCAT
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMCMP #define __HAVE_ARCH_MEMCMP
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#define __HAVE_ARCH_STRCMP #define __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRCAT #define __HAVE_ARCH_STRCAT
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMCMP #define __HAVE_ARCH_MEMCMP
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/types.h> #include <linux/types.h>
#endif #endif
#define __HAVE_ARCH_BCOPY /* arch function */
#define __HAVE_ARCH_MEMCHR /* inline & arch function */ #define __HAVE_ARCH_MEMCHR /* inline & arch function */
#define __HAVE_ARCH_MEMCMP /* arch function */ #define __HAVE_ARCH_MEMCMP /* arch function */
#define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */ #define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */
......
...@@ -124,7 +124,4 @@ extern void *memchr(const void *__s, int __c, size_t __n); ...@@ -124,7 +124,4 @@ extern void *memchr(const void *__s, int __c, size_t __n);
#define __HAVE_ARCH_STRLEN #define __HAVE_ARCH_STRLEN
extern size_t strlen(const char *); extern size_t strlen(const char *);
/* Don't build bcopy at all ... */
#define __HAVE_ARCH_BCOPY
#endif /* __ASM_SH_STRING_H */ #endif /* __ASM_SH_STRING_H */
...@@ -22,7 +22,6 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t); ...@@ -22,7 +22,6 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t);
#ifndef EXPORT_SYMTAB_STROPS #ifndef EXPORT_SYMTAB_STROPS
/* First the mem*() things. */ /* First the mem*() things. */
#define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
#undef memmove #undef memmove
#define memmove(_to, _from, _n) \ #define memmove(_to, _from, _n) \
......
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
#ifndef __V850_STRING_H__ #ifndef __V850_STRING_H__
#define __V850_STRING_H__ #define __V850_STRING_H__
#define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE
extern void *memcpy (void *, const void *, __kernel_size_t); extern void *memcpy (void *, const void *, __kernel_size_t);
extern void bcopy (const char *, char *, int);
extern void *memset (void *, int, __kernel_size_t); extern void *memset (void *, int, __kernel_size_t);
extern void *memmove (void *, const void *, __kernel_size_t); extern void *memmove (void *, const void *, __kernel_size_t);
......
...@@ -454,30 +454,6 @@ void * memset(void * s,int c,size_t count) ...@@ -454,30 +454,6 @@ void * memset(void * s,int c,size_t count)
EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memset);
#endif #endif
#ifndef __HAVE_ARCH_BCOPY
/**
* bcopy - Copy one area of memory to another
* @srcp: Where to copy from
* @destp: Where to copy to
* @count: The size of the area.
*
* Note that this is the same as memcpy(), with the arguments reversed.
* memcpy() is the standard, bcopy() is a legacy BSD function.
*
* You should not use this function to access IO space, use memcpy_toio()
* or memcpy_fromio() instead.
*/
void bcopy(const void * srcp, void * destp, size_t count)
{
const char *src = srcp;
char *dest = destp;
while (count--)
*dest++ = *src++;
}
EXPORT_SYMBOL(bcopy);
#endif
#ifndef __HAVE_ARCH_MEMCPY #ifndef __HAVE_ARCH_MEMCPY
/** /**
* memcpy - Copy one area of memory to another * memcpy - Copy one area of memory to another
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment