1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* |
---|
4 | * Optimized access routines for SPARC. |
---|
5 | * |
---|
6 | * Note the difference between byteorder.h (inlined functions) and access.S |
---|
7 | * where the functions will be declared in the library archive librtemscpu.a. |
---|
8 | * Function names starting with _ are in library and can be referenced by |
---|
9 | * function pointers. |
---|
10 | * |
---|
11 | * _ldN, _stN standard machine endianess access (SPARC: big-endian) |
---|
12 | * _ld_beN, _st_beN forced big-endian |
---|
13 | * _ld_leN, _st_leN forced little-endian (defined in access_le.C) |
---|
14 | * |
---|
15 | * This file is written in assembly because the big-endian functions maps to |
---|
16 | * machine dependant access methods, i.e. same function has two names. |
---|
17 | * |
---|
18 | * COPYRIGHT (c) 2011 |
---|
19 | * Aeroflex Gaisler. |
---|
20 | * |
---|
21 | * Redistribution and use in source and binary forms, with or without |
---|
22 | * modification, are permitted provided that the following conditions |
---|
23 | * are met: |
---|
24 | * 1. Redistributions of source code must retain the above copyright |
---|
25 | * notice, this list of conditions and the following disclaimer. |
---|
26 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
27 | * notice, this list of conditions and the following disclaimer in the |
---|
28 | * documentation and/or other materials provided with the distribution. |
---|
29 | * |
---|
30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
31 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
32 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
33 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
34 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
36 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
37 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
38 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
39 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
40 | * POSSIBILITY OF SUCH DAMAGE. |
---|
41 | */ |
---|
42 | |
---|
43 | #include <rtems/asm.h> |
---|
44 | |
---|
45 | .align 4 |
---|
46 | .section ".text" |
---|
47 | PUBLIC(_ld8) |
---|
48 | PUBLIC(_ld16) |
---|
49 | PUBLIC(_ld32) |
---|
50 | PUBLIC(_ld64) |
---|
51 | PUBLIC(_st8) |
---|
52 | PUBLIC(_st16) |
---|
53 | PUBLIC(_st32) |
---|
54 | PUBLIC(_st64) |
---|
55 | PUBLIC(_ld_be16) |
---|
56 | PUBLIC(_ld_be32) |
---|
57 | PUBLIC(_ld_be64) |
---|
58 | PUBLIC(_st_be16) |
---|
59 | PUBLIC(_st_be32) |
---|
60 | PUBLIC(_st_be64) |
---|
61 | |
---|
62 | SYM(_ld8): |
---|
63 | retl |
---|
64 | ldub [%o0], %o0 |
---|
65 | |
---|
66 | SYM(_ld_be16): |
---|
67 | SYM(_ld16): |
---|
68 | retl |
---|
69 | lduh [%o0], %o0 |
---|
70 | |
---|
71 | SYM(_ld_be32): |
---|
72 | SYM(_ld32): |
---|
73 | retl |
---|
74 | ld [%o0], %o0 |
---|
75 | |
---|
76 | SYM(_ld_be64): |
---|
77 | SYM(_ld64): |
---|
78 | retl |
---|
79 | ldd [%o0], %o0 |
---|
80 | |
---|
81 | #if defined(__FIX_LEON3FT_B2BST) |
---|
82 | |
---|
83 | SYM(_st8): |
---|
84 | stub %o1, [%o0] |
---|
85 | retl |
---|
86 | nop |
---|
87 | |
---|
88 | SYM(_st_be16): |
---|
89 | SYM(_st16): |
---|
90 | stuh %o1, [%o0] |
---|
91 | retl |
---|
92 | nop |
---|
93 | |
---|
94 | SYM(_st_be32): |
---|
95 | SYM(_st32): |
---|
96 | st %o1, [%o0] |
---|
97 | retl |
---|
98 | nop |
---|
99 | |
---|
100 | SYM(_st_be64): |
---|
101 | SYM(_st64): |
---|
102 | mov %o2, %o3 |
---|
103 | mov %o1, %o2 |
---|
104 | std %o2, [%o0] |
---|
105 | retl |
---|
106 | nop |
---|
107 | |
---|
108 | #else |
---|
109 | |
---|
110 | SYM(_st8): |
---|
111 | retl |
---|
112 | stb %o1, [%o0] |
---|
113 | |
---|
114 | SYM(_st_be16): |
---|
115 | SYM(_st16): |
---|
116 | retl |
---|
117 | sth %o1, [%o0] |
---|
118 | |
---|
119 | SYM(_st_be32): |
---|
120 | SYM(_st32): |
---|
121 | retl |
---|
122 | st %o1, [%o0] |
---|
123 | |
---|
124 | SYM(_st_be64): |
---|
125 | SYM(_st64): |
---|
126 | mov %o2, %o3 |
---|
127 | mov %o1, %o2 |
---|
128 | retl |
---|
129 | std %o2, [%o0] |
---|
130 | #endif |
---|