1
2
3
4
5
6
7
8#include <linux/errno.h>
9#include <asm/asm.h>
10#include <asm/asm-offsets.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19
20
21
22
23
24
25
26
27
28
29
30LEAF(__strncpy_from_user_asm)
31 LONG_L v0, TI_ADDR_LIMIT($28)
32 and v0, a1
33 bnez v0, .Lfault
34
35FEXPORT(__strncpy_from_user_nocheck_asm)
36 move v0, zero
37 move v1, a1
38 .set noreorder
391: EX(lbu, t0, (v1), .Lfault)
40 PTR_ADDIU v1, 1
41 R10KCBARRIER(0(ra))
42 beqz t0, 2f
43 sb t0, (a0)
44 PTR_ADDIU v0, 1
45 .set reorder
46 PTR_ADDIU a0, 1
47 bne v0, a2, 1b
482: PTR_ADDU t0, a1, v0
49 xor t0, a1
50 bltz t0, .Lfault
51 jr ra
52 END(__strncpy_from_user_asm)
53
54.Lfault: li v0, -EFAULT
55 jr ra
56
57 .section __ex_table,"a"
58 PTR 1b, .Lfault
59 .previous
60