MIPS: microMIPS: Optimise 'strncpy' core library function.
Optimise 'strncpy' to use microMIPS instructions and/or optimisations for binary size reduction. When the microMIPS ISA is not being used, the library function compiles to the original binary code. Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
This commit is contained in:
parent
26c5e07d14
commit
0131f2b2c9
@ -3,7 +3,8 @@
|
|||||||
* License. See the file "COPYING" in the main directory of this archive
|
* License. See the file "COPYING" in the main directory of this archive
|
||||||
* for more details.
|
* for more details.
|
||||||
*
|
*
|
||||||
* Copyright (c) 1996, 1999 by Ralf Baechle
|
* Copyright (C) 1996, 1999 by Ralf Baechle
|
||||||
|
* Copyright (C) 2011 MIPS Technologies, Inc.
|
||||||
*/
|
*/
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <asm/asm.h>
|
#include <asm/asm.h>
|
||||||
@ -33,26 +34,27 @@ LEAF(__strncpy_from_user_asm)
|
|||||||
bnez v0, .Lfault
|
bnez v0, .Lfault
|
||||||
|
|
||||||
FEXPORT(__strncpy_from_user_nocheck_asm)
|
FEXPORT(__strncpy_from_user_nocheck_asm)
|
||||||
move v0, zero
|
|
||||||
move v1, a1
|
|
||||||
.set noreorder
|
.set noreorder
|
||||||
1: EX(lbu, t0, (v1), .Lfault)
|
move t0, zero
|
||||||
|
move v1, a1
|
||||||
|
1: EX(lbu, v0, (v1), .Lfault)
|
||||||
PTR_ADDIU v1, 1
|
PTR_ADDIU v1, 1
|
||||||
R10KCBARRIER(0(ra))
|
R10KCBARRIER(0(ra))
|
||||||
beqz t0, 2f
|
beqz v0, 2f
|
||||||
sb t0, (a0)
|
sb v0, (a0)
|
||||||
PTR_ADDIU v0, 1
|
PTR_ADDIU t0, 1
|
||||||
.set reorder
|
bne t0, a2, 1b
|
||||||
PTR_ADDIU a0, 1
|
PTR_ADDIU a0, 1
|
||||||
bne v0, a2, 1b
|
2: PTR_ADDU v0, a1, t0
|
||||||
2: PTR_ADDU t0, a1, v0
|
xor v0, a1
|
||||||
xor t0, a1
|
bltz v0, .Lfault
|
||||||
bltz t0, .Lfault
|
nop
|
||||||
jr ra # return n
|
jr ra # return n
|
||||||
|
move v0, t0
|
||||||
END(__strncpy_from_user_asm)
|
END(__strncpy_from_user_asm)
|
||||||
|
|
||||||
.Lfault: li v0, -EFAULT
|
.Lfault: jr ra
|
||||||
jr ra
|
li v0, -EFAULT
|
||||||
|
|
||||||
.section __ex_table,"a"
|
.section __ex_table,"a"
|
||||||
PTR 1b, .Lfault
|
PTR 1b, .Lfault
|
||||||
|
Loading…
Reference in New Issue
Block a user