exec/memory_ldst_phys: extract memory_ldst_phys declarations from cpu-all.h

They are now accessible through exec/memory.h instead, and we make sure
all variants are available for common or target dependent code.

Move stl_phys_notdirty function as well.
Cached endianness agnostic version rely on st/ld*_p, which is available
through tswap.h.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250317183417.285700-5-pierrick.bouvier@linaro.org>
This commit is contained in:
Pierrick Bouvier 2025-03-17 11:34:03 -07:00 committed by Richard Henderson
parent 3dd08a6920
commit 713b5e1dcc
3 changed files with 11 additions and 35 deletions

View file

@ -25,37 +25,6 @@
#include "exec/memory.h" #include "exec/memory.h"
#include "exec/tswap.h" #include "exec/tswap.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
/* MMU memory access macros */
#if !defined(CONFIG_USER_ONLY)
#include "exec/hwaddr.h"
static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val)
{
address_space_stl_notdirty(as, addr, val,
MEMTXATTRS_UNSPECIFIED, NULL);
}
#define SUFFIX
#define ARG1 as
#define ARG1_DECL AddressSpace *as
#define TARGET_ENDIANNESS
#include "exec/memory_ldst_phys.h.inc"
/* Inline fast path for direct RAM access. */
#define ENDIANNESS
#include "exec/memory_ldst_cached.h.inc"
#define SUFFIX _cached
#define ARG1 cache
#define ARG1_DECL MemoryRegionCache *cache
#define TARGET_ENDIANNESS
#include "exec/memory_ldst_phys.h.inc"
#endif
/* page related stuff */
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "exec/target_page.h" #include "exec/target_page.h"

View file

@ -21,6 +21,7 @@
#include "exec/memattrs.h" #include "exec/memattrs.h"
#include "exec/memop.h" #include "exec/memop.h"
#include "exec/ramlist.h" #include "exec/ramlist.h"
#include "exec/tswap.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/queue.h" #include "qemu/queue.h"
#include "qemu/int128.h" #include "qemu/int128.h"
@ -2732,6 +2733,12 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
#define ARG1_DECL AddressSpace *as #define ARG1_DECL AddressSpace *as
#include "exec/memory_ldst.h.inc" #include "exec/memory_ldst.h.inc"
static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val)
{
address_space_stl_notdirty(as, addr, val,
MEMTXATTRS_UNSPECIFIED, NULL);
}
#define SUFFIX #define SUFFIX
#define ARG1 as #define ARG1 as
#define ARG1_DECL AddressSpace *as #define ARG1_DECL AddressSpace *as
@ -2798,6 +2805,9 @@ static inline void address_space_stb_cached(MemoryRegionCache *cache,
} }
} }
#define ENDIANNESS
#include "exec/memory_ldst_cached.h.inc"
#define ENDIANNESS _le #define ENDIANNESS _le
#include "exec/memory_ldst_cached.h.inc" #include "exec/memory_ldst_cached.h.inc"

View file

@ -19,7 +19,6 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef TARGET_ENDIANNESS
static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
{ {
return glue(address_space_lduw, SUFFIX)(ARG1, addr, return glue(address_space_lduw, SUFFIX)(ARG1, addr,
@ -55,7 +54,7 @@ static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
glue(address_space_stq, SUFFIX)(ARG1, addr, val, glue(address_space_stq, SUFFIX)(ARG1, addr, val,
MEMTXATTRS_UNSPECIFIED, NULL); MEMTXATTRS_UNSPECIFIED, NULL);
} }
#else
static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
{ {
return glue(address_space_ldub, SUFFIX)(ARG1, addr, return glue(address_space_ldub, SUFFIX)(ARG1, addr,
@ -139,9 +138,7 @@ static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t va
glue(address_space_stq_be, SUFFIX)(ARG1, addr, val, glue(address_space_stq_be, SUFFIX)(ARG1, addr, val,
MEMTXATTRS_UNSPECIFIED, NULL); MEMTXATTRS_UNSPECIFIED, NULL);
} }
#endif
#undef ARG1_DECL #undef ARG1_DECL
#undef ARG1 #undef ARG1
#undef SUFFIX #undef SUFFIX
#undef TARGET_ENDIANNESS