target/mips: Move physical addressing code to sysemu/physaddr.c
[qemu/ar7.git] / include / exec / memory_ldst_phys.h.inc
blobb9dd53c389d7baf7a35e97f05ec071f264af728f
1 /*
2  *  Physical memory access templates
3  *
4  *  Copyright (c) 2003 Fabrice Bellard
5  *  Copyright (c) 2015 Linaro, Inc.
6  *  Copyright (c) 2016 Red Hat, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20  */
22 #ifdef TARGET_ENDIANNESS
23 static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
25     return glue(address_space_ldl, SUFFIX)(ARG1, addr,
26                                            MEMTXATTRS_UNSPECIFIED, NULL);
29 static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
31     return glue(address_space_ldq, SUFFIX)(ARG1, addr,
32                                            MEMTXATTRS_UNSPECIFIED, NULL);
35 static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
37     return glue(address_space_lduw, SUFFIX)(ARG1, addr,
38                                             MEMTXATTRS_UNSPECIFIED, NULL);
41 static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
43     glue(address_space_stl, SUFFIX)(ARG1, addr, val,
44                                     MEMTXATTRS_UNSPECIFIED, NULL);
47 static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
49     glue(address_space_stw, SUFFIX)(ARG1, addr, val,
50                                     MEMTXATTRS_UNSPECIFIED, NULL);
53 static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
55     glue(address_space_stq, SUFFIX)(ARG1, addr, val,
56                                     MEMTXATTRS_UNSPECIFIED, NULL);
58 #else
59 static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
61     return glue(address_space_ldl_le, SUFFIX)(ARG1, addr,
62                                               MEMTXATTRS_UNSPECIFIED, NULL);
65 static inline uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
67     return glue(address_space_ldl_be, SUFFIX)(ARG1, addr,
68                                               MEMTXATTRS_UNSPECIFIED, NULL);
71 static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
73     return glue(address_space_ldq_le, SUFFIX)(ARG1, addr,
74                                               MEMTXATTRS_UNSPECIFIED, NULL);
77 static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
79     return glue(address_space_ldq_be, SUFFIX)(ARG1, addr,
80                                               MEMTXATTRS_UNSPECIFIED, NULL);
83 static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
85     return glue(address_space_ldub, SUFFIX)(ARG1, addr,
86                                             MEMTXATTRS_UNSPECIFIED, NULL);
89 static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
91     return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
92                                                MEMTXATTRS_UNSPECIFIED, NULL);
95 static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
97     return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
98                                                MEMTXATTRS_UNSPECIFIED, NULL);
101 static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
103     glue(address_space_stl_le, SUFFIX)(ARG1, addr, val,
104                                        MEMTXATTRS_UNSPECIFIED, NULL);
107 static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
109     glue(address_space_stl_be, SUFFIX)(ARG1, addr, val,
110                                        MEMTXATTRS_UNSPECIFIED, NULL);
113 static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
115     glue(address_space_stb, SUFFIX)(ARG1, addr, val,
116                                     MEMTXATTRS_UNSPECIFIED, NULL);
119 static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
121     glue(address_space_stw_le, SUFFIX)(ARG1, addr, val,
122                                        MEMTXATTRS_UNSPECIFIED, NULL);
125 static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
127     glue(address_space_stw_be, SUFFIX)(ARG1, addr, val,
128                                        MEMTXATTRS_UNSPECIFIED, NULL);
131 static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
133     glue(address_space_stq_le, SUFFIX)(ARG1, addr, val,
134                                        MEMTXATTRS_UNSPECIFIED, NULL);
137 static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
139     glue(address_space_stq_be, SUFFIX)(ARG1, addr, val,
140                                        MEMTXATTRS_UNSPECIFIED, NULL);
142 #endif
144 #undef ARG1_DECL
145 #undef ARG1
146 #undef SUFFIX
147 #undef TARGET_ENDIANNESS