Bug 207422 - sys/amd64/amd64/support.S mempcy does not return dest
Summary: sys/amd64/amd64/support.S mempcy does not return dest
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Many People
Assignee: Konstantin Belousov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-22 20:48 UTC by Kenan
Modified: 2016-04-04 07:47 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenan 2016-02-22 20:48:54 UTC
I've checked the i386 and arm paths, and they appear to return dest in memcpy. This is consistent with libc version of memcpy. For some reason, the amd64 version does not. Shouldn't we do something like:

ENTRY(memcpy)
        PUSH_FRAME_POINTER
        movq    %rdi,%rax                       /* return dst pointer */
        movq    %rdx,%rcx
        shrq    $3,%rcx                         /* copy by 64-bit words */
        cld                                     /* copy forwards */
        rep
        movsq
        movq    %rdx,%rcx
        andq    $7,%rcx                         /* any bytes left? */
        rep
        movsb
        POP_FRAME_POINTER
        ret
END(memcpy)
Comment 1 commit-hook freebsd_committer 2016-02-24 11:58:45 UTC
A commit references this bug:

Author: kib
Date: Wed Feb 24 11:58:15 UTC 2016
New revision: 295966
URL: https://svnweb.freebsd.org/changeset/base/295966

Log:
  Return dst as the result from memcpy(9) on amd64.

  PR:	207422
  MFC after:	1 week

Changes:
  head/sys/amd64/amd64/support.S
Comment 2 commit-hook freebsd_committer 2016-03-09 10:22:10 UTC
A commit references this bug:

Author: kib
Date: Wed Mar  9 10:21:13 UTC 2016
New revision: 296562
URL: https://svnweb.freebsd.org/changeset/base/296562

Log:
  MFC r295966:
  Return dst as the result from memcpy(9) on amd64.

  PR:	207422

Changes:
_U  stable/10/
  stable/10/sys/amd64/amd64/support.S
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2016-04-04 07:47:20 UTC
Already committed by kib.