Blame view
arch/mips/lib/strncpy_user.S
1.31 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 |
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 1996, 1999 by Ralf Baechle */ #include <linux/errno.h> #include <asm/asm.h> |
048eb582f kbuild: mips use ... |
10 |
#include <asm/asm-offsets.h> |
1da177e4c Linux-2.6.12-rc2 |
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include <asm/regdef.h> #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ PTR 9b, handler; \ .previous /* * Returns: -EFAULT if exception before terminator, N if the entire * buffer filled, else strlen. */ /* * Ugly special case have to check: we might get passed a user space * pointer which wraps into the kernel space. We don't deal with that. If * it happens at most some bytes of the exceptions handlers will be copied. */ LEAF(__strncpy_from_user_asm) LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok? and v0, a1 |
c5ec1983e [MIPS] Eleminate ... |
33 |
bnez v0, .Lfault |
1da177e4c Linux-2.6.12-rc2 |
34 35 36 37 38 |
FEXPORT(__strncpy_from_user_nocheck_asm) move v0, zero move v1, a1 .set noreorder |
c5ec1983e [MIPS] Eleminate ... |
39 |
1: EX(lbu, t0, (v1), .Lfault) |
1da177e4c Linux-2.6.12-rc2 |
40 |
PTR_ADDIU v1, 1 |
930bff882 [MIPS] IP28: adde... |
41 |
R10KCBARRIER(0(ra)) |
1da177e4c Linux-2.6.12-rc2 |
42 43 44 |
beqz t0, 2f sb t0, (a0) PTR_ADDIU v0, 1 |
1da177e4c Linux-2.6.12-rc2 |
45 |
.set reorder |
619b6e18f [MIPS] R4000/R440... |
46 47 |
PTR_ADDIU a0, 1 bne v0, a2, 1b |
1da177e4c Linux-2.6.12-rc2 |
48 49 |
2: PTR_ADDU t0, a1, v0 xor t0, a1 |
c5ec1983e [MIPS] Eleminate ... |
50 |
bltz t0, .Lfault |
1da177e4c Linux-2.6.12-rc2 |
51 52 |
jr ra # return n END(__strncpy_from_user_asm) |
c5ec1983e [MIPS] Eleminate ... |
53 |
.Lfault: li v0, -EFAULT |
1da177e4c Linux-2.6.12-rc2 |
54 55 56 |
jr ra .section __ex_table,"a" |
c5ec1983e [MIPS] Eleminate ... |
57 |
PTR 1b, .Lfault |
1da177e4c Linux-2.6.12-rc2 |
58 |
.previous |