diff --git a/src/pkg/runtime/386/asm.s b/src/pkg/runtime/386/asm.s index c6df4f069a7..add14be964f 100644 --- a/src/pkg/runtime/386/asm.s +++ b/src/pkg/runtime/386/asm.s @@ -479,12 +479,16 @@ TEXT runtime·stackcheck(SB), 7, $0 TEXT runtime·memclr(SB),7,$0 MOVL 4(SP), DI // arg 1 addr MOVL 8(SP), CX // arg 2 count - ADDL $3, CX + MOVL CX, BX + ANDL $3, BX SHRL $2, CX MOVL $0, AX CLD REP STOSL + MOVL BX, CX + REP + STOSB RET TEXT runtime·getcallerpc(SB),7,$0 diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s index 2b16587f8cf..6ac84c408d6 100644 --- a/src/pkg/runtime/amd64/asm.s +++ b/src/pkg/runtime/amd64/asm.s @@ -527,12 +527,16 @@ TEXT runtime·stackcheck(SB), 7, $0 TEXT runtime·memclr(SB),7,$0 MOVQ 8(SP), DI // arg 1 addr MOVQ 16(SP), CX // arg 2 count - ADDQ $7, CX + MOVQ CX, BX + ANDQ $7, BX SHRQ $3, CX MOVQ $0, AX CLD REP STOSQ + MOVQ BX, CX + REP + STOSB RET TEXT runtime·getcallerpc(SB),7,$0 diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index a16ca417e6f..00116c001a0 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -381,18 +381,11 @@ memprint(uint32 s, void *a) static void memcopy(uint32 s, void *a, void *b) { - byte *ba, *bb; - uint32 i; - - ba = a; - bb = b; - if(bb == nil) { - for(i=0; i