MIPS: Export memcpy & memset functions alongside their definitions

Now that EXPORT_SYMBOL can be used from assembly source, move the
EXPORT_SYMBOL invocations for the memcpy & memset functions & variants
thereof to be alongside their definitions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14514/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Paul Burton 2016-11-07 11:14:15 +00:00 committed by Ralf Baechle
parent d6cb671589
commit 576a2f0c5c
4 changed files with 19 additions and 24 deletions

View File

@ -15,6 +15,7 @@
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/export.h>
#include <asm/regdef.h> #include <asm/regdef.h>
#define dst a0 #define dst a0
@ -142,6 +143,7 @@
* t7 is used as a flag to note inatomic mode. * t7 is used as a flag to note inatomic mode.
*/ */
LEAF(__copy_user_inatomic) LEAF(__copy_user_inatomic)
EXPORT_SYMBOL(__copy_user_inatomic)
b __copy_user_common b __copy_user_common
li t7, 1 li t7, 1
END(__copy_user_inatomic) END(__copy_user_inatomic)
@ -154,9 +156,11 @@ LEAF(__copy_user_inatomic)
*/ */
.align 5 .align 5
LEAF(memcpy) /* a0=dst a1=src a2=len */ LEAF(memcpy) /* a0=dst a1=src a2=len */
EXPORT_SYMBOL(memcpy)
move v0, dst /* return value */ move v0, dst /* return value */
__memcpy: __memcpy:
FEXPORT(__copy_user) FEXPORT(__copy_user)
EXPORT_SYMBOL(__copy_user)
li t7, 0 /* not inatomic */ li t7, 0 /* not inatomic */
__copy_user_common: __copy_user_common:
/* /*
@ -459,6 +463,7 @@ s_exc:
.align 5 .align 5
LEAF(memmove) LEAF(memmove)
EXPORT_SYMBOL(memmove)
ADD t0, a0, a2 ADD t0, a0, a2
ADD t1, a1, a2 ADD t1, a1, a2
sltu t0, a1, t0 # dst + len <= src -> memcpy sltu t0, a1, t0 # dst + len <= src -> memcpy

View File

@ -17,32 +17,8 @@
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/msa.h> #include <asm/msa.h>
extern void *__bzero_kernel(void *__s, size_t __count);
extern void *__bzero(void *__s, size_t __count);
/*
* String functions
*/
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memmove);
/* /*
* Functions that operate on entire pages. Mostly used by memory management. * Functions that operate on entire pages. Mostly used by memory management.
*/ */
EXPORT_SYMBOL(clear_page); EXPORT_SYMBOL(clear_page);
EXPORT_SYMBOL(copy_page); EXPORT_SYMBOL(copy_page);
/*
* Userspace access stuff.
*/
EXPORT_SYMBOL(__copy_user);
EXPORT_SYMBOL(__copy_user_inatomic);
#ifdef CONFIG_EVA
EXPORT_SYMBOL(__copy_from_user_eva);
EXPORT_SYMBOL(__copy_in_user_eva);
EXPORT_SYMBOL(__copy_to_user_eva);
EXPORT_SYMBOL(__copy_user_inatomic_eva);
EXPORT_SYMBOL(__bzero_kernel);
#endif
EXPORT_SYMBOL(__bzero);

View File

@ -31,6 +31,7 @@
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/export.h>
#include <asm/regdef.h> #include <asm/regdef.h>
#define dst a0 #define dst a0
@ -622,6 +623,7 @@ SEXC(1)
.align 5 .align 5
LEAF(memmove) LEAF(memmove)
EXPORT_SYMBOL(memmove)
ADD t0, a0, a2 ADD t0, a0, a2
ADD t1, a1, a2 ADD t1, a1, a2
sltu t0, a1, t0 # dst + len <= src -> memcpy sltu t0, a1, t0 # dst + len <= src -> memcpy
@ -674,6 +676,7 @@ LEAF(__rmemcpy) /* a0=dst a1=src a2=len */
* t6 is used as a flag to note inatomic mode. * t6 is used as a flag to note inatomic mode.
*/ */
LEAF(__copy_user_inatomic) LEAF(__copy_user_inatomic)
EXPORT_SYMBOL(__copy_user_inatomic)
b __copy_user_common b __copy_user_common
li t6, 1 li t6, 1
END(__copy_user_inatomic) END(__copy_user_inatomic)
@ -686,9 +689,11 @@ LEAF(__copy_user_inatomic)
*/ */
.align 5 .align 5
LEAF(memcpy) /* a0=dst a1=src a2=len */ LEAF(memcpy) /* a0=dst a1=src a2=len */
EXPORT_SYMBOL(memcpy)
move v0, dst /* return value */ move v0, dst /* return value */
.L__memcpy: .L__memcpy:
FEXPORT(__copy_user) FEXPORT(__copy_user)
EXPORT_SYMBOL(__copy_user)
li t6, 0 /* not inatomic */ li t6, 0 /* not inatomic */
__copy_user_common: __copy_user_common:
/* Legacy Mode, user <-> user */ /* Legacy Mode, user <-> user */
@ -704,6 +709,7 @@ __copy_user_common:
*/ */
LEAF(__copy_user_inatomic_eva) LEAF(__copy_user_inatomic_eva)
EXPORT_SYMBOL(__copy_user_inatomic_eva)
b __copy_from_user_common b __copy_from_user_common
li t6, 1 li t6, 1
END(__copy_user_inatomic_eva) END(__copy_user_inatomic_eva)
@ -713,6 +719,7 @@ LEAF(__copy_user_inatomic_eva)
*/ */
LEAF(__copy_from_user_eva) LEAF(__copy_from_user_eva)
EXPORT_SYMBOL(__copy_from_user_eva)
li t6, 0 /* not inatomic */ li t6, 0 /* not inatomic */
__copy_from_user_common: __copy_from_user_common:
__BUILD_COPY_USER EVA_MODE USEROP KERNELOP __BUILD_COPY_USER EVA_MODE USEROP KERNELOP
@ -725,6 +732,7 @@ END(__copy_from_user_eva)
*/ */
LEAF(__copy_to_user_eva) LEAF(__copy_to_user_eva)
EXPORT_SYMBOL(__copy_to_user_eva)
__BUILD_COPY_USER EVA_MODE KERNELOP USEROP __BUILD_COPY_USER EVA_MODE KERNELOP USEROP
END(__copy_to_user_eva) END(__copy_to_user_eva)
@ -733,6 +741,7 @@ END(__copy_to_user_eva)
*/ */
LEAF(__copy_in_user_eva) LEAF(__copy_in_user_eva)
EXPORT_SYMBOL(__copy_in_user_eva)
__BUILD_COPY_USER EVA_MODE USEROP USEROP __BUILD_COPY_USER EVA_MODE USEROP USEROP
END(__copy_in_user_eva) END(__copy_in_user_eva)

View File

@ -10,6 +10,7 @@
*/ */
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/export.h>
#include <asm/regdef.h> #include <asm/regdef.h>
#if LONGSIZE == 4 #if LONGSIZE == 4
@ -270,6 +271,7 @@
*/ */
LEAF(memset) LEAF(memset)
EXPORT_SYMBOL(memset)
beqz a1, 1f beqz a1, 1f
move v0, a0 /* result */ move v0, a0 /* result */
@ -285,13 +287,16 @@ LEAF(memset)
1: 1:
#ifndef CONFIG_EVA #ifndef CONFIG_EVA
FEXPORT(__bzero) FEXPORT(__bzero)
EXPORT_SYMBOL(__bzero)
#else #else
FEXPORT(__bzero_kernel) FEXPORT(__bzero_kernel)
EXPORT_SYMBOL(__bzero_kernel)
#endif #endif
__BUILD_BZERO LEGACY_MODE __BUILD_BZERO LEGACY_MODE
#ifdef CONFIG_EVA #ifdef CONFIG_EVA
LEAF(__bzero) LEAF(__bzero)
EXPORT_SYMBOL(__bzero)
__BUILD_BZERO EVA_MODE __BUILD_BZERO EVA_MODE
END(__bzero) END(__bzero)
#endif #endif