Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!kithrup.com!sef From: sef@kithrup.com (Sean Eric Fagan) Newsgroups: gnu.gcc Subject: inline assembly question Message-ID: <9003012211.AA00298@ucscc.UCSC.EDU> Date: 1 Mar 90 22:07:56 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 23 I would like to write an inline assembly memcpy function for the i386. For the lucky uninitiated, the '386 requires that the source address be in esi, destination address be in edi, and the number of {bytes,words,long words} to copied be in ecx. Now, how do I write a function to do that? I initially had something like: void *memcpy (void *dest, void *src, unsigned int count) { void *td, *ts; unsigned int len; asm ("mov%z1 %0, %1" : "S" (ts) : "g" (src)); asm ("mov%z1 %0, %1" : "D" (td) : "g" (dest)); asm ("mov%z1 %0, %1" : "c" (len) : "g" (count)); asm ("rep ; movsb"); return (dest); } but this did not quite do what I wanted. Anybody have any suggestions? Thanks, Sean.