]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/score/lib/string.S
reboot: Use power off rather than busy spinning when halt is requested
[mirror_ubuntu-artful-kernel.git] / arch / score / lib / string.S
1 /*
2 * arch/score/lib/string.S
3 *
4 * Score Processor version.
5 *
6 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
7 * Chen Liqin <liqin.chen@sunplusct.com>
8 * Lennox Wu <lennox.wu@sunplusct.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see the file COPYING, or write
22 * to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #include <linux/linkage.h>
27 #include <asm-generic/errno.h>
28
29 .text
30 .align 2
31 ENTRY(__strncpy_from_user)
32 cmpi.c r6, 0
33 mv r9, r6
34 ble .L2
35 0: lbu r7, [r5]
36 ldi r8, 0
37 1: sb r7, [r4]
38 2: lb r6, [r5]
39 cmp.c r6, r8
40 beq .L2
41
42 .L5:
43 addi r8, 1
44 cmp.c r8, r9
45 beq .L7
46 3: lbu r6, [r5, 1]+
47 4: sb r6, [r4, 1]+
48 5: lb r7, [r5]
49 cmpi.c r7, 0
50 bne .L5
51 .L7:
52 mv r4, r8
53 br r3
54 .L2:
55 ldi r8, 0
56 mv r4, r8
57 br r3
58 .section .fixup, "ax"
59 99:
60 ldi r4, -EFAULT
61 br r3
62 .previous
63 .section __ex_table, "a"
64 .align 2
65 .word 0b ,99b
66 .word 1b ,99b
67 .word 2b ,99b
68 .word 3b ,99b
69 .word 4b ,99b
70 .word 5b ,99b
71 .previous
72
73 .align 2
74 ENTRY(__strnlen_user)
75 cmpi.c r5, 0
76 ble .L11
77 0: lb r6, [r4]
78 ldi r7, 0
79 cmp.c r6, r7
80 beq .L11
81 .L15:
82 addi r7, 1
83 cmp.c r7, r5
84 beq .L23
85 1: lb r6, [r4,1]+
86 cmpi.c r6, 0
87 bne .L15
88 .L23:
89 addri r4, r7, 1
90 br r3
91
92 .L11:
93 ldi r4, 1
94 br r3
95 .section .fixup, "ax"
96 99:
97 ldi r4, 0
98 br r3
99
100 .section __ex_table,"a"
101 .align 2
102 .word 0b, 99b
103 .word 1b, 99b
104 .previous
105
106 .align 2
107 ENTRY(__copy_tofrom_user)
108 cmpi.c r6, 0
109 mv r10,r6
110 beq .L32
111 ldi r9, 0
112 .L34:
113 add r6, r5, r9
114 0: lbu r8, [r6]
115 add r7, r4, r9
116 1: sb r8, [r7]
117 addi r9, 1
118 cmp.c r9, r10
119 bne .L34
120 .L32:
121 ldi r4, 0
122 br r3
123 .section .fixup, "ax"
124 99:
125 sub r4, r10, r9
126 br r3
127 .previous
128 .section __ex_table, "a"
129 .align 2
130 .word 0b, 99b
131 .word 1b, 99b
132 .previous
133
134 .align 2
135 ENTRY(__clear_user)
136 cmpi.c r5, 0
137 beq .L38
138 ldi r6, 0
139 mv r7, r6
140 .L40:
141 addi r6, 1
142 0: sb r7, [r4]+, 1
143 cmp.c r6, r5
144 bne .L40
145 .L38:
146 ldi r4, 0
147 br r3
148
149 .section .fixup, "ax"
150 99:
151 br r3
152 .previous
153 .section __ex_table, "a"
154 .align 2
155 .word 0b, 99b
156 .previous