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