1// Copyright 2017 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "asm.h"
6
7// %rax = memcpy(%rdi, %rsi, %rdx)
8ENTRY(memcpy)
9    // Save return value.
10    mov %rdi, %rax
11
12    mov %rdx, %rcx
13    rep movsb // while (rcx-- > 0) *rdi++ = *rsi++;
14
15    ret
16END(memcpy)
17
18ALIAS(memcpy, __unsanitized_memcpy)
19ASAN_WEAK_ALIAS(memcpy)
20ALIAS(memcpy, __memcpy_fwd)
21.hidden __memcpy_fwd
22