diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 6802dd1cf33123ed954aba45f6e747e78203919e..5999807322354e061944682f78fdbf8b65fa7f5c 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -708,7 +708,7 @@ void ·_Cfunc_CString(String s, int8 *p) { p = runtime·cmalloc(s.len+1); - runtime·mcpy((byte*)p, s.str, s.len); + runtime·memmove((byte*)p, s.str, s.len); p[s.len] = 0; FLUSH(&p); } diff --git a/src/pkg/runtime/386/closure.c b/src/pkg/runtime/386/closure.c index b0d4cc41a983b58104d6bf23d987205e81588ea9..b4d86771140d1d9e5cfb3b334b3e4238d33dfb78 100644 --- a/src/pkg/runtime/386/closure.c +++ b/src/pkg/runtime/386/closure.c @@ -45,7 +45,7 @@ runtime·closure(int32 siz, byte *fn, byte *arg0) q = p + n - siz; if(siz > 0) { - runtime·mcpy(q, (byte*)&arg0, siz); + runtime·memmove(q, (byte*)&arg0, siz); // SUBL $siz, SP *p++ = 0x81; diff --git a/src/pkg/runtime/386/memmove.s b/src/pkg/runtime/386/memmove.s index 471553ba2166e243b2a1e1bbbb54add60b74f9da..203a8187c0887a2fc90e19bc7a9f6957eae79c82 100644 --- a/src/pkg/runtime/386/memmove.s +++ b/src/pkg/runtime/386/memmove.s @@ -27,9 +27,6 @@ TEXT runtime·memmove(SB), 7, $0 MOVL to+0(FP), DI MOVL fr+4(FP), SI MOVL n+8(FP), BX - CMPL BX, $0 - JLT fault - /* * check and set for backwards */ @@ -87,12 +84,3 @@ back: MOVL to+0(FP),AX RET -/* - * if called with negative count, - * treat as error rather than - * rotating all of memory - */ -fault: - MOVL $0,SI - MOVL 0(SI), AX - RET diff --git a/src/pkg/runtime/amd64/closure.c b/src/pkg/runtime/amd64/closure.c index 5033468d289ba173bf353194462615c73d72b05e..481b4a88825aeafe71846ad8ca31890c0534a356 100644 --- a/src/pkg/runtime/amd64/closure.c +++ b/src/pkg/runtime/amd64/closure.c @@ -45,7 +45,7 @@ runtime·closure(int32 siz, byte *fn, byte *arg0) q = p + n - siz; if(siz > 0) { - runtime·mcpy(q, (byte*)&arg0, siz); + runtime·memmove(q, (byte*)&arg0, siz); // SUBQ $siz, SP *p++ = 0x48; diff --git a/src/pkg/runtime/amd64/memmove.s b/src/pkg/runtime/amd64/memmove.s index fc9573f72e15cadf4cfa358c5217e68b246ae48b..e78be814551f5d01886ee07cf9cd5ad3110cfdd3 100644 --- a/src/pkg/runtime/amd64/memmove.s +++ b/src/pkg/runtime/amd64/memmove.s @@ -28,8 +28,6 @@ TEXT runtime·memmove(SB), 7, $0 MOVQ to+0(FP), DI MOVQ fr+8(FP), SI MOVLQSX n+16(FP), BX - CMPQ BX, $0 - JLT fault /* * check and set for backwards @@ -88,12 +86,3 @@ back: MOVQ to+0(FP),AX RET -/* - * if called with negative count, - * treat as error rather than - * rotating all of memory - */ -fault: - MOVQ $0,SI - MOVQ 0(SI), AX - RET diff --git a/src/pkg/runtime/arm/closure.c b/src/pkg/runtime/arm/closure.c index 36a93bc53216617d3c1c4b64dd57c2e25e6eb85f..119e91b6114c3a00fe191348a1d472219f7ca775 100644 --- a/src/pkg/runtime/arm/closure.c +++ b/src/pkg/runtime/arm/closure.c @@ -83,7 +83,7 @@ runtime·closure(int32 siz, byte *fn, byte *arg0) *pc++ = 0xe52de000 | (siz + 4); if(siz > 0) { - runtime·mcpy(q, (byte*)&arg0, siz); + runtime·memmove(q, (byte*)&arg0, siz); // MOVW $vars(PC), R0 *pc = 0xe28f0000 | (int32)(q - (byte*)pc - 8); diff --git a/src/pkg/runtime/hashmap.h b/src/pkg/runtime/hashmap.h index d0fd3527fc55203c55c5e969e93c65e7091ce467..19ff41697079b85a1f534267d849020ab85b565e 100644 --- a/src/pkg/runtime/hashmap.h +++ b/src/pkg/runtime/hashmap.h @@ -65,7 +65,7 @@ #define malloc runtime·mal #define memset(a,b,c) runtime·memclr((byte*)(a), (uint32)(c)) -#define memcpy(a,b,c) runtime·mcpy((byte*)(a),(byte*)(b),(uint32)(c)) +#define memcpy(a,b,c) runtime·memmove((byte*)(a),(byte*)(b),(uint32)(c)) #define assert(a) if(!(a)) runtime·throw("assert") #define free(x) runtime·free(x) #define memmove(a,b,c) runtime·memmove(a, b, c) diff --git a/src/pkg/runtime/plan9/thread.c b/src/pkg/runtime/plan9/thread.c index ef9a23e8e2e177a6e5bbe314e7483cd44fb2157a..d428e7fcde9142c8ba133e7b7b17c9033d8295c6 100644 --- a/src/pkg/runtime/plan9/thread.c +++ b/src/pkg/runtime/plan9/thread.c @@ -47,11 +47,11 @@ runtime·exit(int32) pid = pid/10; } p = buf; - runtime·mcpy((void*)p, (void*)"/proc/", 6); + runtime·memmove((void*)p, (void*)"/proc/", 6); p += 6; for(q--; q >= tmp;) *p++ = *q--; - runtime·mcpy((void*)p, (void*)"/notepg", 7); + runtime·memmove((void*)p, (void*)"/notepg", 7); /* post interrupt note */ fd = runtime·open(buf, OWRITE); diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 17397ca821c1ada6744fd26187c03e7f2fb1c04a..1524a627da8a0b2bd47c9df0c3d8cfb7e85cba55 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -720,7 +720,7 @@ runtime·oldstack(void) argsize = old.argsize; if(argsize > 0) { sp -= argsize; - runtime·mcpy(top->argp, sp, argsize); + runtime·memmove(top->argp, sp, argsize); } goid = old.gobuf.g->goid; // fault if g is bad, before gogo USED(goid); @@ -802,7 +802,7 @@ runtime·newstack(void) sp = (byte*)top; if(argsize > 0) { sp -= argsize; - runtime·mcpy(sp, m->moreargp, argsize); + runtime·memmove(sp, m->moreargp, argsize); } if(thechar == '5') { // caller would have saved its LR below args. @@ -903,7 +903,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc) sp = newg->stackbase; sp -= siz; - runtime·mcpy(sp, argp, narg); + runtime·memmove(sp, argp, narg); if(thechar == '5') { // caller's LR sp -= sizeof(void*); @@ -941,7 +941,7 @@ runtime·deferproc(int32 siz, byte* fn, ...) d->argp = (byte*)(&fn+2); // skip caller's saved link register else d->argp = (byte*)(&fn+1); - runtime·mcpy(d->args, d->argp, d->siz); + runtime·memmove(d->args, d->argp, d->siz); d->link = g->defer; g->defer = d; @@ -968,7 +968,7 @@ runtime·deferreturn(uintptr arg0) argp = (byte*)&arg0; if(d->argp != argp) return; - runtime·mcpy(argp, d->args, d->siz); + runtime·memmove(argp, d->args, d->siz); g->defer = d->link; fn = d->fn; runtime·free(d); @@ -1367,11 +1367,11 @@ os·setenv_c(String k, String v) return; arg[0] = runtime·malloc(k.len + 1); - runtime·mcpy(arg[0], k.str, k.len); + runtime·memmove(arg[0], k.str, k.len); arg[0][k.len] = 0; arg[1] = runtime·malloc(v.len + 1); - runtime·mcpy(arg[1], v.str, v.len); + runtime·memmove(arg[1], v.str, v.len); arg[1][v.len] = 0; runtime·asmcgocall(libcgo_setenv, arg); diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index 83af8dc5e2f680a4a10c2d473c654b54be9a02b4..7e37d66d4109a5286f68ddc76006d1ea87bb1070 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -116,17 +116,6 @@ runtime·panicstring(int8 *s) runtime·panic(err); } -void -runtime·mcpy(byte *t, byte *f, uint32 n) -{ - while(n > 0) { - *t = *f; - t++; - f++; - n--; - } -} - int32 runtime·mcmp(byte *s1, byte *s2, uint32 n) { diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index de0a21b9566502d3614b41343cee4979f865792f..ef17b72d6930f3eddfd2bb55537680340b6d154e 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -406,7 +406,6 @@ uint32 runtime·rnd(uint32, uint32); void runtime·prints(int8*); void runtime·printf(int8*, ...); byte* runtime·mchr(byte*, byte, byte*); -void runtime·mcpy(byte*, byte*, uint32); int32 runtime·mcmp(byte*, byte*, uint32); void runtime·memmove(void*, void*, uint32); void* runtime·mal(uintptr); diff --git a/src/pkg/runtime/string.goc b/src/pkg/runtime/string.goc index 15b3459adaf72c7063e0092b022ad982886faa76..34b167791e436e667e44042f6d62b0be2dd7ed3a 100644 --- a/src/pkg/runtime/string.goc +++ b/src/pkg/runtime/string.goc @@ -60,7 +60,7 @@ runtime·gostring(byte *str) l = runtime·findnull(str); s = runtime·gostringsize(l); - runtime·mcpy(s.str, str, l); + runtime·memmove(s.str, str, l); return s; } @@ -70,7 +70,7 @@ runtime·gostringn(byte *str, int32 l) String s; s = runtime·gostringsize(l); - runtime·mcpy(s.str, str, l); + runtime·memmove(s.str, str, l); return s; } @@ -113,8 +113,8 @@ runtime·catstring(String s1, String s2) return s1; s3 = runtime·gostringsize(s1.len + s2.len); - runtime·mcpy(s3.str, s1.str, s1.len); - runtime·mcpy(s3.str+s1.len, s2.str, s2.len); + runtime·memmove(s3.str, s1.str, s1.len); + runtime·memmove(s3.str+s1.len, s2.str, s2.len); return s3; } @@ -134,7 +134,7 @@ concatstring(int32 n, String *s) out = runtime·gostringsize(l); l = 0; for(i=0; i<n; i++) { - runtime·mcpy(out.str+l, s[i].str, s[i].len); + runtime·memmove(out.str+l, s[i].str, s[i].len); l += s[i].len; } return out; @@ -225,14 +225,14 @@ func intstring(v int64) (s String) { func slicebytetostring(b Slice) (s String) { s = runtime·gostringsize(b.len); - runtime·mcpy(s.str, b.array, s.len); + runtime·memmove(s.str, b.array, s.len); } func stringtoslicebyte(s String) (b Slice) { b.array = runtime·mallocgc(s.len, FlagNoPointers, 1, 1); b.len = s.len; b.cap = s.len; - runtime·mcpy(b.array, s.str, s.len); + runtime·memmove(b.array, s.str, s.len); } func sliceinttostring(b Slice) (s String) { diff --git a/src/pkg/runtime/symtab.c b/src/pkg/runtime/symtab.c index da4579734fda4ad0ea4cfe6ceeb4b860e1789381..ffa042e6f729ea52d07c9bf2146c7857f2677196 100644 --- a/src/pkg/runtime/symtab.c +++ b/src/pkg/runtime/symtab.c @@ -159,7 +159,7 @@ makepath(byte *buf, int32 nbuf, byte *path) break; if(p > buf && p[-1] != '/') *p++ = '/'; - runtime·mcpy(p, q, len+1); + runtime·memmove(p, q, len+1); p += len; } }