diff options
Diffstat (limited to 'src/pkg/runtime/386/memmove.s')
-rw-r--r-- | src/pkg/runtime/386/memmove.s | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/386/memmove.s b/src/pkg/runtime/386/memmove.s index 38a0652b5..471553ba2 100644 --- a/src/pkg/runtime/386/memmove.s +++ b/src/pkg/runtime/386/memmove.s @@ -32,7 +32,6 @@ TEXT runtime·memmove(SB), 7, $0 /* * check and set for backwards - * should we look closer for overlap? */ CMPL SI, DI JLS back @@ -40,6 +39,7 @@ TEXT runtime·memmove(SB), 7, $0 /* * forward copy loop */ +forward: MOVL BX, CX SHRL $2, CX ANDL $3, BX @@ -51,10 +51,18 @@ TEXT runtime·memmove(SB), 7, $0 MOVL to+0(FP),AX RET /* + * check overlap + */ +back: + MOVL SI, CX + ADDL BX, CX + CMPL CX, DI + JLS forward +/* * whole thing backwards has * adjusted addresses */ -back: + ADDL BX, DI ADDL BX, SI STD |