diff options
Diffstat (limited to 'libkern/memset-386.s')
| -rw-r--r-- | libkern/memset-386.s | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libkern/memset-386.s b/libkern/memset-386.s new file mode 100644 index 00000000..dacb2f5f --- /dev/null +++ b/libkern/memset-386.s @@ -0,0 +1,35 @@ + TEXT memset(SB),$0 + + CLD + MOVL p+0(FP), DI + MOVBLZX c+4(FP), AX + MOVL n+8(FP), BX +/* + * if not enough bytes, just copy + */ + CMPL BX, $9 + JLS c3 +/* + * build word in AX + */ + MOVB AL, AH + MOVL AX, CX + SHLL $16, CX + ORL CX, AX +/* + * copy whole longs + */ +c1: + MOVL BX, CX + SHRL $2, CX + ANDL $3, BX + REP; STOSL +/* + * copy the rest, by bytes + */ +c3: + MOVL BX, CX + REP; STOSB +ret: + MOVL p+0(FP),AX + RET |
