Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/ape/lib/ap/sparc/memset.s – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
	TEXT	memset(SB),$0
2
 
3
/*
4
 * performance:
5
 *	(tba)
6
 */
7
 
8
MOVW	R7, 0(FP)
9
	MOVW	n+8(FP), R9		/* R9 is count */
10
	MOVW	p+0(FP), R10		/* R10 is pointer */
11
	MOVW	c+4(FP), R11		/* R11 is char */
12
	ADD	R9,R10, R12		/* R12 is end pointer */
13
 
14
/*
15
 * if not at least 4 chars,
16
 * dont even mess around.
17
 * 3 chars to guarantee any
18
 * rounding up to a word
19
 * boundary and 4 characters
20
 * to get at least maybe one
21
 * full word store.
22
 */
23
	SUBCC	$4,R9, R0
24
	BL	out
25
 
26
/*
27
 * turn R11 into a word of characters
28
 */
29
	AND	$0xff, R11
30
	SLL	$8,R11, R7
31
	OR	R7, R11
32
	SLL	$16,R11, R7
33
	OR	R7, R11
34
 
35
/*
36
 * store one byte at a time until pointer
37
 * is alligned on a word boundary
38
 */
39
l1:
40
	ANDCC	$3,R10, R0
41
	BE	l2
42
	MOVB	R11, 0(R10)
43
	ADD	$1, R10
44
	JMP	l1
45
 
46
/*
47
 * turn R9 into end pointer-15
48
 * store 16 at a time while theres room
49
 */
50
l2:
51
	ADD	$-15,R12, R9
52
	SUBCC	R10,R9, R0
53
	BLEU	l4
54
l3:
55
	MOVW	R11, 0(R10)
56
	MOVW	R11, 4(R10)
57
	ADD	$16, R10
58
	SUBCC	R10,R9, R0
59
	MOVW	R11, -8(R10)
60
	MOVW	R11, -4(R10)
61
	BGU	l3
62
 
63
/*
64
 * turn R9 into end pointer-3
65
 * store 4 at a time while theres room
66
 */
67
l4:
68
	ADD	$-3,R12, R9
69
l5:
70
	SUBCC	R10,R9, R0
71
	BLEU	out
72
	MOVW	R11, 0(R10)
73
	ADD	$4, R10
74
	JMP	l5
75
 
76
/*
77
 * last loop, store byte at a time
78
 */
79
out:
80
	SUBCC	R10,R12, R0
81
	BLEU	ret
82
	MOVB	R11, 0(R10)
83
	ADD	$1, R10
84
	JMP	out
85
 
86
ret:
87
	MOVW	s1+0(FP), R7
88
	RETURN