repo.or.cz
/
linux
/
fpc-iii.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Linux 4.13.16
[linux/fpc-iii.git]
/
arch
/
h8300
/
lib
/
memset.S
blob
18d4e709b5f4bb7b6b046f9e11a1bcd44fa3e5d7
1
/* memset.S */
2
3
#include <asm/linkage.h>
4
5
#if defined(CONFIG_CPU_H8300H)
6
.h8300h
7
#endif
8
#if defined(CONFIG_CPU_H8S)
9
.h8300s
10
#endif
11
.text
12
13
.global memset
14
.global clear_user
15
16
;;void *memset(*ptr, int c, size_t count)
17
;; ptr = er0
18
;; c = er1(r1l)
19
;; count = er2
20
memset:
21
btst #0,r0l
22
beq 2f
23
24
;; odd address
25
1:
26
mov.b r1l,@er0
27
adds #1,er0
28
dec.l #1,er2
29
beq 6f
30
31
;; even address
32
2:
33
mov.l er2,er3
34
cmp.l #4,er2
35
blo 4f
36
;; count>=4 -> count/4
37
#if defined(CONFIG_CPU_H8300H)
38
shlr.l er2
39
shlr.l er2
40
#endif
41
#if defined(CONFIG_CPU_H8S)
42
shlr.l #2,er2
43
#endif
44
;; byte -> long
45
mov.b r1l,r1h
46
mov.w r1,e1
47
3:
48
mov.l er1,@er0
49
adds #4,er0
50
dec.l #1,er2
51
bne 3b
52
4:
53
;; count % 4
54
and.b #3,r3l
55
beq 6f
56
5:
57
mov.b r1l,@er0
58
adds #1,er0
59
dec.b r3l
60
bne 5b
61
6:
62
rts
63
64
clear_user:
65
mov.l er1, er2
66
sub.l er1, er1
67
bra memset
68
69
.end