source: rtems/bsps/powerpc/mpc55xxevb/start/copy.S

Last change on this file was bcef89f2, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 06:18:25

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup mpc55xx_asm
7 *
8 * @brief Memory copy functions.
9 */
10
11/*
12 * Copyright (c) 2008 embedded brains GmbH & Co. KG
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#include <libcpu/powerpc-utility.h>
36#include <bspopts.h>
37
38        .section ".bsp_start_text", "ax"
39
40/**
41 * @fn int mpc55xx_copy_8( const void *src, void *dest, size_t n)
42 *
43 * @brief Copy @a n bytes from @a src to @a dest with 8 byte reads and writes.
44 *
45 * The memory areas should not overlap.  The addresses @a src and @a dest have
46 * to be aligned on 8 byte boundaries.  The size @a n must be evenly divisible by 8.
47 * The SPE operations @b evxor, @b evlddx and @b evstddx will be used.
48 */
49#if       ((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517))
50GLOBAL_FUNCTION mpc55xx_copy_8
51#endif /* ((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517)) */
52GLOBAL_FUNCTION mpc55xx_copy_4
53        /* Loop counter = data size / 4 */
54        srwi. r5, r5, 2
55        beqlr
56        mtctr r5
57        xor   r5,r5,r5
58copy_data4:
59        lwzx  r6, r5, r3
60        stwx  r6, r5, r4
61        addi r5, r5, 4
62        bdnz copy_data4
63
64        /* Return */
65        blr
66
67#if  !((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517))
68/**
69 * @fn int mpc55xx_copy_8( const void *src, void *dest, size_t n)
70 *
71 * @brief Copy @a n bytes from @a src to @a dest with 8 byte reads and writes.
72 *
73 * The memory areas should not overlap.  The addresses @a src and @a dest have
74 * to be aligned on 8 byte boundaries.  The size @a n must be evenly divisible by 8.
75 * The SPE operations @b evxor, @b evlddx and @b evstddx will be used.
76 */
77GLOBAL_FUNCTION mpc55xx_copy_8
78        /* Loop counter = data size / 8 */
79        srwi. r5, r5, 3
80        beqlr
81        mtctr r5
82
83        /* Set offset */
84        evxor r5, r5, r5
85
86copy_data:
87        evlddx r6, r3, r5
88        evstddx r6, r4, r5
89        addi r5, r5, 8
90        bdnz copy_data
91
92        /* Return */
93        blr
94#endif /*!((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517))*/
Note: See TracBrowser for help on using the repository browser.