]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libc/386/memset.s
audiohda: make it work with sb600 onboard sound
[plan9front.git] / sys / src / libc / 386 / memset.s
1         TEXT    memset(SB),$0
2
3         CLD
4         MOVL    p+0(FP), DI
5         MOVBLZX c+4(FP), AX
6         MOVL    n+8(FP), BX
7 /*
8  * if not enough bytes, just set bytes
9  */
10         CMPL    BX, $9
11         JLS     c3
12 /*
13  * build word in AX
14  */
15         MOVB    AL, AH
16         MOVL    AX, CX
17         SHLL    $16, CX
18         ORL     CX, AX
19 /*
20  * set whole longs
21  */
22 c1:
23         MOVL    BX, CX
24         SHRL    $2, CX
25         ANDL    $3, BX
26         REP;    STOSL
27 /*
28  * set the rest, by bytes
29  */
30 c3:
31         MOVL    BX, CX
32         REP;    STOSB
33 ret:
34         MOVL    p+0(FP),AX
35         RET