Misc single binary patches for 2026-01-12
Subsystems (2)
The following changes since commit 81f1fc471c053c9d3915c3e1f8b37503bd9a9cb7:
Merge tag 'pull-loongarch-20260112' of https://github.com/bibo-mao/qemu into staging (2026-01-13 08:23:10 +1100)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/single-binary-20260112
for you to fetch changes up to f445b4a4b6fa5b03503bc8fdfa4c336e13afc48f:
target/arm/gdbstub: make compilation unit common (2026-01-12 23:47:57 +0100)
----------------------------------------------------------------
Various patches related to single binary effort:
- Endianness cleanups in memory core subsystem and for various targets
- Few cleanups around target_ulong type
- Build various compilation units as common
----------------------------------------------------------------
Alex Bennée (1):
target/sh4: drop cpu_reset from realizefn
Anton Johansson (1):
target/alpha: Introduce alpha_phys_addr_space_bits()
Philippe Mathieu-Daudé (56):
MAINTAINERS: Cover 'system/memory_ldst*.h.inc' files docs/devel/loads-stores: Fix ld/stn_*_p() regexp
bswap: Consistently use builtin bswap() functions tests/qtest: Remove unnecessary 'qemu/bswap.h' include system/physmem: Inline and remove leul_to_cpu() system/physmem: Convert DEBUG_SUBPAGE printf() to trace events system/memory: Split MemoryRegionCache API to 'memory_cached.h' system/memory: Inline address_space_stq_internal() system/ioport: Declare x86-specific I/O port in little-endian order system/ioport: Do not open-code address_space_ld/st_le() methods
meson: Allow system binaries to not have target-specific units hw/alpha: Use explicit little-endian LD/ST API target/alpha: Inline cpu_ldl_code() call in do_unaligned_access() target/alpha: Inline translator_ldl()
target/avr: Inline translator_lduw()
target/hexagon: Inline translator_ldl()
target/hexagon: Use little-endian variant of cpu_ld/st_data*() target/hppa: Use big-endian variant of cpu_ld/st_data*() target/hppa: Remove unnecessary @cpu variable by using cpu_env() target/hppa: Use explicit big-endian LD/ST API target/hppa: Inline translator_ldl()
target/hppa: Avoid target-specific migration headers in machine.c target/hppa: Remove target_ulong use in disas_log() handler hw/loongarch: Use explicit little-endian LD/ST API target/loongarch: Replace target_ulong -> uint64_t for DMW and
TLBRBADV
target/loongarch: Use hwaddr type for physical addresses target/loongarch: Replace MO_TE -> MO_LE
target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt() target/loongarch: Use explicit little-endian LD/ST API target/loongarch: Inline translator_ldl()
target/m68k: Replace MD_TLONG -> MD_I32 in monitor.c target/microblaze: Directly check endianness via CPUConfig::endi flag target/microblaze: Avoid target-specific migration headers in
machine.c
target/microblaze: Build system files once
hw/microblaze: Replace TARGET_BIG_ENDIAN -> target_big_endian() hw/microblaze: Build files once
hw/intc: Mark OpenRISC-specific peripheral as big-endian target/openrisc: Use explicit big-endian LD/ST API target/openrisc: Inline translator_ldl()
target/openrisc: Remove unused 'gdbstub/helpers.h' header in helper.c target/openrisc: Avoid target-specific migration headers in machine.c target/openrisc: Build system units in common source set target/rx: Use little-endian variant of cpu_ld/st_data*() target/rx: Use explicit little-endian LD/ST API
target/rx: Inline translator_lduw() and translator_ldl() target/rx: Build system units in common source set target/sh4: Build system units in common source set hw/sparc: Mark SPARC-specific peripherals as big-endian hw/sparc: Use explicit big-endian LD/ST API
target/sparc: Use explicit big-endian LD/ST API target/sparc: Inline translator_ldl()
target/sparc: Inline cpu_ldl_code() call in cpu_do_interrupt() target/tricore: Use little-endian variant of cpu_ld/st_data*() target/tricore: Inline translator_lduw()
target/tricore: Build system units in common source set accel/tcg: Un-inline WatchPoint API user-emulation stubs
Pierrick Bouvier (3):
gdbstub/helpers.h: allow header to be called from common code target/arm/gdbstub: extract aarch64_cpu_register_gdb_regs_for_features target/arm/gdbstub: make compilation unit common
MAINTAINERS | 2 + docs/devel/loads-stores.rst | 8 +- meson.build | 8 +- include/accel/tcg/cpu-ops.h | 17 -- include/exec/watchpoint.h | 23 -- include/gdbstub/helpers.h | 9 +- include/hw/virtio/virtio-access.h | 1 + include/qemu/bswap.h | 11 - include/qemu/host-utils.h | 6 +- include/qemu/int128.h | 5 +- include/system/memory.h | 185 --------------- include/system/memory_cached.h | 210 ++++++++++++++++++ linux-user/alpha/target_proc.h | 23 +- target/arm/internals.h | 1 + target/hexagon/macros.h | 6 +- tests/qtest/pnv-xive2-common.h | 1 - accel/tcg/user-exec-stub.c | 33 +++ hw/alpha/dp264.c | 11 +- hw/alpha/typhoon.c | 4 +- hw/audio/cs4231.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/display/cg3.c | 2 +- hw/display/tcx.c | 14 +- hw/dma/sparc32_dma.c | 2 +- hw/intc/grlib_irqmp.c | 2 +- hw/intc/ompic.c | 2 +- hw/intc/slavio_intctl.c | 4 +- hw/loongarch/virt.c | 18 +- hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 +- hw/misc/eccmemctl.c | 2 +- hw/misc/slavio_misc.c | 16 +- hw/rtc/sun4v-rtc.c | 2 +- hw/sparc/leon3.c | 42 ++-- hw/sparc/sun4m.c | 6 +- hw/sparc64/sun4u.c | 6 +- hw/timer/grlib_gptimer.c | 2 +- hw/timer/slavio_timer.c | 2 +- system/ioport.c | 34 ++- system/physmem.c | 35 +-- target/alpha/mem_helper.c | 4 +- target/alpha/translate.c | 4 +- target/arm/cpu32-stubs.c | 21 ++ target/arm/gdbstub.c | 61 +---- target/arm/gdbstub64.c | 57 +++++ target/avr/translate.c | 2 +- target/hexagon/op_helper.c | 6 +- target/hexagon/translate.c | 11 +- target/hppa/gdbstub.c | 8 +- target/hppa/int_helper.c | 2 +- target/hppa/machine.c | 3 +- target/hppa/op_helper.c | 44 ++-- target/hppa/translate.c | 5 +- target/loongarch/cpu_helper.c | 12 +- target/loongarch/tcg/iocsr_helper.c | 24 +- target/loongarch/tcg/tcg_cpu.c | 4 +- target/loongarch/tcg/tlb_helper.c | 10 +- target/loongarch/tcg/translate.c | 3 +- target/m68k/monitor.c | 60 ++--- target/microblaze/machine.c | 3 +- target/microblaze/translate.c | 8 +- target/openrisc/gdbstub.c | 2 +- target/openrisc/interrupt.c | 1 - target/openrisc/machine.c | 3 +- target/openrisc/mmu.c | 1 - target/openrisc/translate.c | 3 +- target/rx/cpu.c | 2 +- target/rx/gdbstub.c | 24 +- target/rx/helper.c | 14 +- target/rx/op_helper.c | 6 +- target/rx/translate.c | 10 +- target/sh4/cpu.c | 1 - target/sparc/int32_helper.c | 4 +- target/sparc/ldst_helper.c | 36 +-- target/sparc/mmu_helper.c | 32 +-- target/sparc/translate.c | 2 +- target/tricore/op_helper.c | 152 ++++++------- target/tricore/translate.c | 9 +- tests/qtest/aspeed_smc-test.c | 1 - tests/qtest/ast2700-smc-test.c | 1 - tests/qtest/endianness-test.c | 10 +- tests/qtest/libqos/fw_cfg.c | 1 - tests/qtest/libqos/i2c-omap.c | 1 - tests/qtest/libqtest.c | 13 +- tests/qtest/pnv-spi-seeprom-test.c | 1 - system/memory_ldst.c.inc | 2 +- .../tcg/insn_trans/trans_atomic.c.inc | 80 +++---- .../tcg/insn_trans/trans_fmemory.c.inc | 32 +-- .../tcg/insn_trans/trans_memory.c.inc | 64 +++--- .../loongarch/tcg/insn_trans/trans_vec.c.inc | 16 +- hw/microblaze/meson.build | 2 +- system/trace-events | 6 + target/arm/meson.build | 12 +- target/microblaze/meson.build | 2 +- target/openrisc/meson.build | 2 +- target/rx/meson.build | 2 +- target/sh4/meson.build | 2 +- target/tricore/meson.build | 2 +- 97 files changed, 863 insertions(+), 806 deletions(-) create mode 100644 include/system/memory_cached.h
Signature · 1 line
2.52.0
[PULL 01/61] MAINTAINERS: Cover 'system/memory_ldst*.h.inc' files
Missed in commit c611228c0ed ("include: move memory_ldst* to include/system").
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -3285,6 +3285,7 @@ F: include/system/ioport.h F: include/exec/memop.h F: include/system/ram_addr.h F: include/system/memory.h +F: include/system/memory_ldst* F: include/system/physmem.h F: include/system/ramblock.h F: include/system/memory_mapping.h
Signature · 1 line
2.52.0
[PULL 03/61] bswap: Consistently use builtin bswap() functions
In reply to Philippe Mathieu-DaudéSince these headers use some __builtin_bswap*(), use it consistently in all the cases, allowing to remove the "qemu/bswap.h" inclusion (which only defines bswap* to the builtin equivalent).
Message-ID: <[email protected]>
--- include/qemu/host-utils.h | 6 +++--- include/qemu/int128.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-)
include/qemu/host-utils.h +3 -3
@@ -380,7 +380,7 @@ static inline uint16_t revbit16(uint16_t x)return __builtin_bitreverse16 (x);#else /* Assign the correct byte position. */ - x =bswap16 (x); + x =__builtin_bswap16 (x);/* Assign the correct nibble position. */ x = ((x &0xf0f0 ) >>4 ) | ((x &0x0f0f ) <<4 );
@@ -403,7 +403,7 @@ static inline uint32_t revbit32(uint32_t x)return __builtin_bitreverse32 (x);#else /* Assign the correct byte position. */ - x =bswap32 (x); + x =__builtin_bswap32 (x);/* Assign the correct nibble position. */ x = ((x &0xf0f0f0f0u ) >>4 ) | ((x &0x0f0f0f0fu ) <<4 );
@@ -426,7 +426,7 @@ static inline uint64_t revbit64(uint64_t x)return __builtin_bitreverse64 (x);#else /* Assign the correct byte position. */ - x =bswap64 (x); + x =__builtin_bswap64 (x);/* Assign the correct nibble position. */ x = ((x &0xf0f0f0f0f0f0f0f0ull ) >>4 ) | ((x &0x0f0f0f0f0f0f0f0full ) <<4 );
include/qemu/int128.h +3 -2
@@ -189,7 +189,8 @@ static inline Int128 bswap128(Int128 a)#if __has_builtin (__builtin_bswap128)return __builtin_bswap128 (a);#else -return int128_make128 (bswap64 (int128_gethi (a)),bswap64 (int128_getlo (a))); +return int128_make128 (__builtin_bswap64 (int128_gethi (a)), +__builtin_bswap64 (int128_getlo (a)));#endif }
@@ -451,7 +452,7 @@ static inline void int128_subfrom(Int128 *a, Int128 b)static inline Int128 bswap128 (Int128 a) { -return int128_make128 (bswap64 (a.hi),bswap64 (a.lo)); +return int128_make128 (__builtin_bswap64 (a.hi),__builtin_bswap64 (a.lo)); }static inline int clz128 (Int128 a)
Signature · 1 line
2.52.0
[PULL 08/61] system/memory: Inline address_space_stq_internal()
In reply to Philippe Mathieu-DaudéAs its name suggests, address_space_stq_internal() is an internal method which can be inlined like all the other ones in this file.
Message-ID: <[email protected]>
--- system/memory_ldst.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
system/memory_ldst.c.inc +1 -1
@@ -422,7 +422,7 @@ void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, +static inline void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) {
Signature · 1 line
2.52.0
[PULL 04/61] tests/qtest: Remove unnecessary 'qemu/bswap.h' include
In reply to Philippe Mathieu-DaudéNone of these files use API declared in "qemu/bswap.h", remove the unnecessary inclusion.
Message-ID: <[email protected]>
--- tests/qtest/pnv-xive2-common.h | 1 - tests/qtest/aspeed_smc-test.c | 1 - tests/qtest/ast2700-smc-test.c | 1 - tests/qtest/libqos/fw_cfg.c | 1 - tests/qtest/libqos/i2c-omap.c | 1 - tests/qtest/pnv-spi-seeprom-test.c | 1 - 6 files changed, 6 deletions(-)
tests/qtest/pnv-xive2-common.h +0 -1
@@ -15,7 +15,6 @@#define PPC_BITMASK (bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))#define PPC_BITMASK32 (bs, be) ((PPC_BIT32(bs) - PPC_BIT32(be)) | \ PPC_BIT32(bs)) -#include "qemu/bswap.h" #include "hw/intc/pnv_xive2_regs.h" #include "hw/ppc/xive_regs.h" #include "hw/ppc/xive2_regs.h"
tests/qtest/aspeed_smc-test.c +0 -1
@@ -24,7 +24,6 @@*/ #include "qemu/osdep.h" -#include "qemu/bswap.h" #include "libqtest-single.h" #include "qemu/bitops.h" #include "aspeed-smc-utils.h"
tests/qtest/ast2700-smc-test.c +0 -1
@@ -7,7 +7,6 @@*/ #include "qemu/osdep.h" -#include "qemu/bswap.h" #include "libqtest-single.h" #include "qemu/bitops.h" #include "aspeed-smc-utils.h"
tests/qtest/libqos/fw_cfg.c +0 -1
@@ -17,7 +17,6 @@#include "malloc-pc.h" #include "libqos-malloc.h" #include "../libqtest.h" -#include "qemu/bswap.h" #include "hw/nvram/fw_cfg.h" void qfw_cfg_select (QFWCFG *fw_cfg,uint16_t key)
tests/qtest/libqos/i2c-omap.c +0 -1
@@ -10,7 +10,6 @@#include "i2c.h" -#include "qemu/bswap.h" #include "../libqtest.h" enum OMAPI2CRegisters {
tests/qtest/pnv-spi-seeprom-test.c +0 -1
@@ -7,7 +7,6 @@*/ #include "qemu/osdep.h" #include "libqtest.h" -#include "qemu/bswap.h" #include "hw/ssi/pnv_spi_regs.h" #include "pnv-xscom.h"
Signature · 1 line
2.52.0
[PULL 05/61] system/physmem: Inline and remove leul_to_cpu()
In reply to Philippe Mathieu-Daudéleul_to_cpu() is only used within physmem.c: inline it and remove.
Since @bitmap is of 'unsigned long' type, use its size with ldn_le_p() instead of using HOST_LONG_BITS.
Message-ID: <[email protected]>
--- include/qemu/bswap.h | 11 ----------- system/physmem.c | 5 +++-- 2 files changed, 3 insertions(+), 13 deletions(-)
include/qemu/bswap.h +0 -11
@@ -375,17 +375,6 @@ static inline void stq_be_p(void *ptr, uint64_t v)stq_he_p (ptr,be_bswap (v,64 )); } -static inline unsigned long leul_to_cpu (unsigned long v) -{ -#if HOST_LONG_BITS ==32 -return le_bswap (v,32 ); -#elif HOST_LONG_BITS ==64 -return le_bswap (v,64 ); -#else -# error Unknown sizeof long -#endif -} -/* Store v to p as a sz byte value in host order */ #define DO_STN_LDN_P (END ) \ static inline void stn_## END ## _p(void *ptr, int sz, uint64_t v) \
system/physmem.c +3 -2
@@ -1272,7 +1272,8 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,for (k =0 ; k < nr; k++) {if (bitmap[k]) { -unsigned long temp =leul_to_cpu (bitmap[k]); +unsigned long temp =ldn_le_p (&bitmap[k], +sizeof (bitmap[k])); nbits =ctpopl (temp);qatomic_or (&blocks[DIRTY_MEMORY_VGA ][idx][offset], temp);
@@ -1319,7 +1320,7 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,*/ for (i =0 ; i < len; i++) {if (bitmap[i] !=0 ) { - c =leul_to_cpu (bitmap[i]); + c =ldn_le_p (&bitmap[i],sizeof (bitmap[i])); nbits =ctpopl (c);if (unlikely (global_dirty_tracking &GLOBAL_DIRTY_DIRTY_RATE )) { total_dirty_pages += nbits;
Signature · 1 line
2.52.0
[PULL 09/61] system/ioport: Declare x86-specific I/O port in little-endian order
In reply to Philippe Mathieu-DaudéX86 in/out port (related to ISA bus) uses little endianness:
- enforce little endianness in x86 cpu_in/out() accessors,
- serialize QTest in/out port accesses as little-endian.
Message-ID: <[email protected]>
--- system/ioport.c | 10 +++++----- tests/qtest/endianness-test.c | 10 ++++++---- tests/qtest/libqtest.c | 13 +++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-)
system/ioport.c +5 -5
@@ -56,7 +56,7 @@ static void unassigned_io_write(void *opaque, hwaddr addr, uint64_t val,const MemoryRegionOps unassigned_io_ops = { .read = unassigned_io_read, .write = unassigned_io_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , };void cpu_outb (uint32_t addr,uint8_t val)
@@ -71,7 +71,7 @@ void cpu_outw(uint32_t addr, uint16_t val)uint8_t buf[2 ];trace_cpu_out (addr,'w' , val); -stw_p (buf, val); +stw_le_p (buf, val);address_space_write (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,2 ); }
@@ -81,7 +81,7 @@ void cpu_outl(uint32_t addr, uint32_t val)uint8_t buf[4 ];trace_cpu_out (addr,'l' , val); -stl_p (buf, val); +stl_le_p (buf, val);address_space_write (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,4 ); }
@@ -102,7 +102,7 @@ uint16_t cpu_inw(uint32_t addr)uint16_t val;address_space_read (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,2 ); - val =lduw_p (buf); + val =lduw_le_p (buf);trace_cpu_in (addr,'w' , val);return val; }
@@ -113,7 +113,7 @@ uint32_t cpu_inl(uint32_t addr)uint32_t val;address_space_read (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,4 ); - val =ldl_p (buf); + val =ldl_le_p (buf);trace_cpu_in (addr,'l' , val);return val; }
tests/qtest/endianness-test.c +6 -4
@@ -65,8 +65,9 @@ static uint16_t isa_inw(QTestState *qts, const TestCase *test, uint16_t addr) value =qtest_inw (qts, addr); }else { value =qtest_readw (qts, test->isa_base + addr); + value = test->bswap ?bswap16 (value) : value; } -return test->bswap ?bswap16 (value) : value; +return value; }static uint32_t isa_inl (QTestState *qts,const TestCase *test,uint16_t addr)
@@ -76,8 +77,9 @@ static uint32_t isa_inl(QTestState *qts, const TestCase *test, uint16_t addr) value =qtest_inl (qts, addr); }else { value =qtest_readl (qts, test->isa_base + addr); + value = test->bswap ?bswap32 (value) : value; } -return test->bswap ?bswap32 (value) : value; +return value; } static void isa_outb(QTestState *qts, const TestCase *test, uint16_t addr,
@@ -93,10 +95,10 @@ static void isa_outb(QTestState *qts, const TestCase *test, uint16_t addr,static void isa_outw (QTestState *qts,const TestCase *test,uint16_t addr,uint16_t value) { - value = test->bswap ?bswap16 (value) : value;if (test->isa_base ==-1 ) {qtest_outw (qts, addr, value); }else { + value = test->bswap ?bswap16 (value) : value;qtest_writew (qts, test->isa_base + addr, value); } }
@@ -104,10 +106,10 @@ static void isa_outw(QTestState *qts, const TestCase *test, uint16_t addr,static void isa_outl (QTestState *qts,const TestCase *test,uint16_t addr,uint32_t value) { - value = test->bswap ?bswap32 (value) : value;if (test->isa_base ==-1 ) {qtest_outl (qts, addr, value); }else { + value = test->bswap ?bswap32 (value) : value;qtest_writel (qts, test->isa_base + addr, value); } }
tests/qtest/libqtest.c +9 -4
@@ -31,6 +31,7 @@#include "libqtest.h" #include "libqmp.h" #include "qemu/accel.h" +#include "qemu/bswap.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/exit-with-parent.h"
@@ -1190,12 +1191,12 @@ void qtest_outb(QTestState *s, uint16_t addr, uint8_t value)void qtest_outw (QTestState *s,uint16_t addr,uint16_t value) { -qtest_out (s,"outw" , addr, value); +qtest_out (s,"outw" , addr,qtest_big_endian (s) ?bswap16 (value) : value); }void qtest_outl (QTestState *s,uint16_t addr,uint32_t value) { -qtest_out (s,"outl" , addr, value); +qtest_out (s,"outl" , addr,qtest_big_endian (s) ?bswap32 (value) : value); }static uint32_t qtest_in (QTestState *s,const char *cmd,uint16_t addr)
@@ -1220,12 +1221,16 @@ uint8_t qtest_inb(QTestState *s, uint16_t addr)uint16_t qtest_inw (QTestState *s,uint16_t addr) { -return qtest_in (s,"inw" , addr); +uint16_t v =qtest_in (s,"inw" , addr); + +return qtest_big_endian (s) ?bswap16 (v) : v; }uint32_t qtest_inl (QTestState *s,uint16_t addr) { -return qtest_in (s,"inl" , addr); +uint32_t v =qtest_in (s,"inl" , addr); + +return qtest_big_endian (s) ?bswap32 (v) : v; } static void qtest_write(QTestState *s, const char *cmd, uint64_t addr,
Signature · 1 line
2.52.0
[PULL 02/61] docs/devel/loads-stores: Fix ld/stn_*_p() regexp
In reply to Philippe Mathieu-DaudéMessage-ID: <[email protected]>
--- docs/devel/loads-stores.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
docs/devel/loads-stores.rst +4 -4
@@ -52,12 +52,12 @@ files which are built per-target. There are also functions which take the size as an argument: -load: ``ldn{endian}_p(ptr, sz)`` +load: ``ldn_{endian}_p(ptr, sz)`` which performs an unsigned load of ``sz`` bytes from ``ptr`` as an ``{endian}`` order value and returns it in a uint64_t. -store: ``stn{endian}_p(ptr, sz, val)`` +store: ``stn_{endian}_p(ptr, sz, val)`` which stores ``val`` to ``ptr`` as an ``{endian}`` order value of size ``sz`` bytes.
@@ -67,8 +67,8 @@ Regexes for git grep: - ``\<ld[us]\?[bwlq]\(_[hbl]e\)\?_p\>`` - ``\<st[bwlq]\(_[hbl]e\)\?_p\>`` - ``\<st24\(_[hbl]e\)\?_p\>`` - - ``\<ldn_\([hbl]e\)\?_p\>`` - - ``\<stn_\([hbl]e\)\?_p\>`` + - ``\<ldn\(_[hbl]e\)\?_p\>`` + - ``\<stn\(_[hbl]e\)\?_p\>`` ``cpu_{ld,st}*_mmu`` ~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.52.0
[PULL 07/61] system/memory: Split MemoryRegionCache API to 'memory_cached.h'
In reply to Philippe Mathieu-DaudéWe have 115 direct inclusions of "system/memory.h", and 91 headers in include/ use it: hundreds of files have to process it. However only one single header really uses the MemoryRegionCache
API: "hw/virtio/virtio-access.h". Split it out to a new header, avoiding processing unused inlined functions hundreds of times.
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + include/hw/virtio/virtio-access.h | 1 + include/system/memory.h | 185 -------------------------- include/system/memory_cached.h | 210 ++++++++++++++++++++++++++++++ system/physmem.c | 1 + 5 files changed, 213 insertions(+), 185 deletions(-) create mode 100644 include/system/memory_cached.h
MAINTAINERS +1 -0
@@ -3285,6 +3285,7 @@ F: include/system/ioport.h F: include/exec/memop.h F: include/system/ram_addr.h F: include/system/memory.h +F: include/system/memory_cached.h F: include/system/memory_ldst* F: include/system/physmem.h F: include/system/ramblock.h
include/hw/virtio/virtio-access.h +1 -0
@@ -17,6 +17,7 @@#define QEMU_VIRTIO_ACCESS_H #include "exec/hwaddr.h" +#include "system/memory_cached.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h"
include/system/memory.h +0 -185
203 lines not on this page · raw message
include/system/memory_cached.h new file +210 -0
210 lines not on this page · raw message
system/physmem.c +1 -0
@@ -53,6 +53,7 @@#include "qemu/memalign.h" #include "qemu/memfd.h" #include "system/memory.h" +#include "system/memory_cached.h" #include "system/ioport.h" #include "system/dma.h" #include "system/hostmem.h"
Signature · 1 line
2.52.0
[PULL 12/61] hw/alpha: Use explicit little-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe Alpha architecture uses little endianness. Directly use the little-endian LD/ST API.
Mechanical change running:
$ for a in uw w l q; do \
sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \
$(git grep -wlE '(ld|st)u?[wlq]_p' hw/alpha/);
doneMessage-ID: <[email protected]>
--- hw/alpha/dp264.c | 11 +++++------ hw/alpha/typhoon.c | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-)
hw/alpha/dp264.c +5 -6
@@ -194,12 +194,11 @@ static void clipper_init(MachineState *machine)load_image_targphys (initrd_filename, initrd_base, ram_size - initrd_base,NULL ); -address_space_stq (&address_space_memory, param_offset +0x100 , - initrd_base +0xfffffc0000000000ULL , -MEMTXATTRS_UNSPECIFIED , -NULL ); -address_space_stq (&address_space_memory, param_offset +0x108 , - initrd_size,MEMTXATTRS_UNSPECIFIED ,NULL ); +address_space_stq_le (&address_space_memory, param_offset +0x100 , + initrd_base +0xfffffc0000000000ULL , +MEMTXATTRS_UNSPECIFIED ,NULL ); +address_space_stq_le (&address_space_memory, param_offset +0x108 , + initrd_size,MEMTXATTRS_UNSPECIFIED ,NULL ); } } }
hw/alpha/typhoon.c +2 -2
@@ -622,8 +622,8 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret)translation, given the address of the PTE. */ static bool pte_translate (hwaddr pte_addr,IOMMUTLBEntry *ret) { -uint64_t pte =address_space_ldq (&address_space_memory, pte_addr, -MEMTXATTRS_UNSPECIFIED ,NULL ); +uint64_t pte =address_space_ldq_le (&address_space_memory, pte_addr, +MEMTXATTRS_UNSPECIFIED ,NULL );/* Check valid bit. */ if ((pte &1 ) ==0 ) {
Signature · 1 line
2.52.0
[PULL 06/61] system/physmem: Convert DEBUG_SUBPAGE printf() to trace events
In reply to Philippe Mathieu-DaudéDefining DEBUG_SUBPAGE allows to use raw printf() statements to print information about some events; convert these to tracepoints.
Message-ID: <[email protected]>
--- system/physmem.c | 29 ++++++----------------------- system/trace-events | 6 ++++++ 2 files changed, 12 insertions(+), 23 deletions(-)
system/physmem.c +6 -23
@@ -91,8 +91,6 @@#include "memory-internal.h" -//#define DEBUG_SUBPAGE -/* ram_list is read under rcu_read_lock()/rcu_read_unlock(). Writes * are protected by the ramlist lock. */
@@ -2921,10 +2919,7 @@ static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,uint8_t buf[8 ];MemTxResult res; -#if defined(DEBUG_SUBPAGE ) -printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx"\n" , __func__, - subpage, len, addr); -#endif +trace_subpage_read (subpage, len, addr); res =flatview_read (subpage->fv, addr + subpage->base, attrs, buf, len);if (res) {return res;
@@ -2939,11 +2934,7 @@ static MemTxResult subpage_write(void *opaque, hwaddr addr,subpage_t *subpage = opaque;uint8_t buf[8 ]; -#if defined(DEBUG_SUBPAGE ) -printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx -" value %" PRIx64"\n" , - __func__, subpage, len, addr, value); -#endif +trace_subpage_write (subpage, len, addr, value);stn_p (buf, len, value);return flatview_write (subpage->fv, addr + subpage->base, attrs, buf, len); }
@@ -2953,10 +2944,8 @@ static bool subpage_accepts(void *opaque, hwaddr addr, MemTxAttrs attrs) {subpage_t *subpage = opaque; -#if defined(DEBUG_SUBPAGE ) -printf ("%s: subpage %p %c len %u addr " HWADDR_FMT_plx"\n" , - __func__, subpage, is_write ?'w' :'r' , len, addr); -#endif + +trace_subpage_accepts (subpage, is_write ?'w' :'r' , len, addr);return flatview_access_valid (subpage->fv, addr + subpage->base, len, is_write, attrs);
@@ -2982,10 +2971,7 @@ static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,return -1 ; idx =SUBPAGE_IDX (start); eidx =SUBPAGE_IDX (end); -#if defined(DEBUG_SUBPAGE ) -printf ("%s: %p start %08x end %08x idx %08x eidx %08x section %d\n" , - __func__, mmio, start, end, idx, eidx, section); -#endif +trace_subpage_register (mmio, start, end, idx, eidx, section);for (; idx <= eidx; idx++) { mmio->sub_section[idx] = section; }
@@ -3004,10 +2990,7 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base)memory_region_init_io (&mmio->iomem,NULL , &subpage_ops, mmio,NULL ,TARGET_PAGE_SIZE ); mmio->iomem.subpage = true; -#if defined(DEBUG_SUBPAGE ) -printf ("%s: %p base " HWADDR_FMT_plx" len %08x\n" , __func__, - mmio, base,TARGET_PAGE_SIZE ); -#endif +trace_subpage_init (mmio, base,TARGET_PAGE_SIZE );return mmio; }
system/trace-events +6 -0
@@ -35,6 +35,12 @@ find_ram_offset_loop(uint64_t size, uint64_t candidate, uint64_t offset, uint64_ ram_block_discard_range(const char *rbname, void *hva, size_t length, bool need_madvise, bool need_fallocate, int ret) "%s@%p + 0x%zx: madvise: %d fallocate: %d ret: %d" qemu_ram_alloc_shared(const char *name, size_t size, size_t max_size, int fd, void *host) "%s size %zu max_size %zu fd %d host %p" +subpage_register(void *subpage, uint32_t start, uint32_t end, int idx, int eidx, uint16_t section) "subpage %p start 0x%08x end 0x%08x idx 0x%08x eidx 0x%08x section %u" +subpage_init(void *subpage, uint64_t base, uint64_t len) "subpage %p base 0x%08" PRIx64 " len 0x%08" PRIx64 +subpage_accepts(void *subpage, char access, unsigned len, uint64_t addr) "subpage %p %c len %u addr 0x%" PRIx64 +subpage_read(void *subpage, unsigned len, uint64_t addr) "subpage %p len %u addr 0x%" PRIx64 +subpage_write(void *subpage, unsigned len, uint64_t addr, uint64_t value) "subpage %p len %u addr 0x%" PRIx64 " value 0x%" PRIx64 + # cpus.c vm_stop_flush_all(int ret) "ret %d"
Signature · 1 line
2.52.0
[PULL 10/61] system/ioport: Do not open-code address_space_ld/st_le() methods
In reply to Philippe Mathieu-DaudéWhen a variable size is known, prefer the address_space_ld/st() API. Keep address_space_read/write() for blobs.
Message-ID: <[email protected]>
--- system/ioport.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
system/ioport.c +12 -20
@@ -62,58 +62,50 @@ const MemoryRegionOps unassigned_io_ops = {void cpu_outb (uint32_t addr,uint8_t val) {trace_cpu_out (addr,'b' , val); -address_space_write (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , - &val,1 ); +address_space_stb (&address_space_io, addr, val, +MEMTXATTRS_UNSPECIFIED ,NULL ); }void cpu_outw (uint32_t addr,uint16_t val) { -uint8_t buf[2 ]; -trace_cpu_out (addr,'w' , val); -stw_le_p (buf, val); -address_space_write (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , - buf,2 ); +address_space_stw_le (&address_space_io, addr, val, +MEMTXATTRS_UNSPECIFIED ,NULL ); }void cpu_outl (uint32_t addr,uint32_t val) { -uint8_t buf[4 ]; -trace_cpu_out (addr,'l' , val); -stl_le_p (buf, val); -address_space_write (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , - buf,4 ); +address_space_stl_le (&address_space_io, addr, val, +MEMTXATTRS_UNSPECIFIED ,NULL ); }uint8_t cpu_inb (uint32_t addr) {uint8_t val; -address_space_read (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , - &val,1 ); + val =address_space_ldub (&address_space_io, addr, +MEMTXATTRS_UNSPECIFIED ,NULL );trace_cpu_in (addr,'b' , val);return val; }uint16_t cpu_inw (uint32_t addr) { -uint8_t buf[2 ];uint16_t val; -address_space_read (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,2 ); - val =lduw_le_p (buf); + val =address_space_lduw_le (&address_space_io, addr, +MEMTXATTRS_UNSPECIFIED ,NULL );trace_cpu_in (addr,'w' , val);return val; }uint32_t cpu_inl (uint32_t addr) { -uint8_t buf[4 ];uint32_t val; -address_space_read (&address_space_io, addr,MEMTXATTRS_UNSPECIFIED , buf,4 ); - val =ldl_le_p (buf); + val =address_space_ldl_le (&address_space_io, addr, +MEMTXATTRS_UNSPECIFIED ,NULL );trace_cpu_in (addr,'l' , val);return val; }
Signature · 1 line
2.52.0
[PULL 13/61] target/alpha: Inline cpu_ldl_code() call in do_unaligned_access()
In reply to Philippe Mathieu-DaudéIn preparation of removing the cpu_ldl_code wrapper, inline it. Use the return address argument.
Since Alpha instructions are always stored in little-endian order, replace MO_TE -> MO_LE.
Message-ID: <[email protected]>
--- target/alpha/mem_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/alpha/mem_helper.c +3 -1
@@ -24,13 +24,15 @@static void do_unaligned_access (CPUAlphaState *env,vaddr addr,uintptr_t retaddr) { +CPUState *cs =env_cpu (env); +MemOpIdx oi =make_memop_idx (MO_LEUL ,cpu_mmu_index (cs, true));uint64_t pc;uint32_t insn;cpu_restore_state (env_cpu (env), retaddr); pc = env->pc; - insn =cpu_ldl_code (env, pc); + insn =cpu_ldl_code_mmu (env, pc, oi, retaddr); env->trap_arg0 = addr; env->trap_arg1 = insn >>26 ;/* opcode */
Signature · 1 line
2.52.0
[PULL 17/61] target/hexagon: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> MO_LE since Hexagon use little-endian order.
Message-ID: <[email protected]>
--- target/hexagon/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
target/hexagon/translate.c +7 -4
@@ -207,8 +207,9 @@ static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,memset (words,0 ,PACKET_WORDS_MAX *sizeof (uint32_t ));for (nwords =0 ; !found_end && nwords <PACKET_WORDS_MAX ; nwords++) { words[nwords] = -translator_ldl (env, &ctx->base, - ctx->base.pc_next + nwords *sizeof (uint32_t )); +translator_ldl_end (env, &ctx->base, + ctx->base.pc_next + nwords *sizeof (uint32_t ), +MO_LE ); found_end =is_packet_end (words[nwords]); }if (!found_end) {
@@ -987,8 +988,10 @@ static bool pkt_crosses_page(CPUHexagonState *env, DisasContext *ctx)int nwords;for (nwords =0 ; !found_end && nwords <PACKET_WORDS_MAX ; nwords++) { -uint32_t word =translator_ldl (env, &ctx->base, - ctx->base.pc_next + nwords *sizeof (uint32_t )); +uint32_t word =translator_ldl_end (env, &ctx->base, + ctx->base.pc_next + + nwords *sizeof (uint32_t ), +MO_LE ); found_end =is_packet_end (word); }uint32_t next_ptr = ctx->base.pc_next + nwords *sizeof (uint32_t );
Signature · 1 line
2.52.0
[PULL 11/61] meson: Allow system binaries to not have target-specific units
In reply to Philippe Mathieu-DaudéAs we are moving toward a single binary, targets might end without any target-specific objects (all objects being in the 'common' source set). Allow this by checking the target_system_arch[] dictionary contains the target key before using it.
Message-ID: <[email protected]>
--- meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
meson.build +5 -3
@@ -4284,9 +4284,11 @@ foreach target : target_dirs endif if target.endswith('-softmmu') target_type='system' - t = target_system_arch[target_base_arch].apply(config_target, strict: false) - arch_srcs += t.sources() - arch_deps += t.dependencies() + if target_base_arch in target_system_arch + t = target_system_arch[target_base_arch].apply(config_target, strict: false) + arch_srcs += t.sources() + arch_deps += t.dependencies() + endif hw_dir = target_name == 'sparc64' ? 'sparc64' : target_base_arch if hw_arch.has_key(hw_dir)
Signature · 1 line
2.52.0
[PULL 16/61] target/avr: Inline translator_lduw()
In reply to Philippe Mathieu-Daudétranslator_lduw() is defined in "exec/translator.h" as:
192 static inline uint16_t
193 translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) 194 {
195 return translator_lduw_end(env, db, pc, MO_TE);
196 }
Directly use the inlined form, expanding MO_TE -> MO_LE since AVR only exists in little-endian.
Message-ID: <[email protected]>
--- target/avr/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/avr/translate.c +1 -1
@@ -173,7 +173,7 @@ static int to_regs_00_30_by_two(DisasContext *ctx, int indx)static uint16_t next_word (DisasContext *ctx) { -return translator_lduw (ctx->env, &ctx->base, ctx->npc++ *2 ); +return translator_lduw_end (ctx->env, &ctx->base, ctx->npc++ *2 ,MO_LE ); }static int append_16 (DisasContext *ctx,int x)
Signature · 1 line
2.52.0
[PULL 15/61] target/alpha: Introduce alpha_phys_addr_space_bits()
In reply to Philippe Mathieu-DaudéFrom: Anton Johansson <[email protected]>
In preparation for dropping TARGET_PHYS_ADDR_SPACE_BITS, add a a runtime function to correctly represent the size of the physical address space for EV4-6 based on the current CPU version.
Message-ID: <[email protected]>
--- linux-user/alpha/target_proc.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
linux-user/alpha/target_proc.h +22 -1
@@ -6,6 +6,27 @@#ifndef ALPHA_TARGET_PROC_H #define ALPHA_TARGET_PROC_H +#include "qemu/osdep.h" +#include "target/alpha/cpu.h" + +static uint8_t alpha_phys_addr_space_bits (CPUAlphaState *env) +{ +switch (env->implver) { +case IMPLVER_2106x: +/* EV4 */ +return 34 ; +case IMPLVER_21164 : +/* EV5 */ +return 40 ; +case IMPLVER_21264 : +case IMPLVER_21364 : +/* EV6 and EV7*/ +return 44 ; +default : +g_assert_not_reached (); + } +} +static int open_cpuinfo (CPUArchState *cpu_env,int fd) {int max_cpus =sysconf (_SC_NPROCESSORS_CONF);
@@ -57,7 +78,7 @@ static int open_cpuinfo(CPUArchState *cpu_env, int fd)"L1 Dcache\t\t: n/a\n" "L2 cache\t\t: n/a\n" "L3 cache\t\t: n/a\n" , - model,TARGET_PAGE_SIZE ,TARGET_PHYS_ADDR_SPACE_BITS , + model,TARGET_PAGE_SIZE ,alpha_phys_addr_space_bits (cpu_env), max_cpus, num_cpus, cpu_mask);return 0 ;
Signature · 1 line
2.52.0
[PULL 18/61] target/hexagon: Use little-endian variant of cpu_ld/st_data*()
In reply to Philippe Mathieu-DaudéWe only build the Hexagon target using little endianness order, therefore the cpu_ld/st_data*() definitions expand to the little endian declarations. Use the explicit little-endian variants.
Mechanical change running:
$ tgt=hexagon; \
end=le; \
for op in data mmuidx_ra; do \
for ac in uw sw l q; do \
sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
for ac in w l q; do \
sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
doneMessage-ID: <[email protected]>
--- target/hexagon/macros.h | 6 +++--- target/hexagon/op_helper.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
target/hexagon/macros.h +3 -3
@@ -519,9 +519,9 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)#define fLOAD (NUM ,SIZE ,SIGN ,EA ,DST ) MEM_LOAD##SIZE##SIGN(DST, EA)#else #define MEM_LOAD1 cpu_ldub_data_ra -#define MEM_LOAD2 cpu_lduw_data_ra -#define MEM_LOAD4 cpu_ldl_data_ra -#define MEM_LOAD8 cpu_ldq_data_ra +#define MEM_LOAD2 cpu_lduw_le_data_ra +#define MEM_LOAD4 cpu_ldl_le_data_ra +#define MEM_LOAD8 cpu_ldq_le_data_ra#define fLOAD (NUM ,SIZE ,SIGN ,EA ,DST ) \ do { \
target/hexagon/op_helper.c +3 -3
@@ -77,13 +77,13 @@ static void commit_store(CPUHexagonState *env, int slot_num, uintptr_t ra)cpu_stb_data_ra (env, va, env->mem_log_stores[slot_num].data32, ra);break ;case 2 : -cpu_stw_data_ra (env, va, env->mem_log_stores[slot_num].data32, ra); +cpu_stw_le_data_ra (env, va, env->mem_log_stores[slot_num].data32, ra);break ;case 4 : -cpu_stl_data_ra (env, va, env->mem_log_stores[slot_num].data32, ra); +cpu_stl_le_data_ra (env, va, env->mem_log_stores[slot_num].data32, ra);break ;case 8 : -cpu_stq_data_ra (env, va, env->mem_log_stores[slot_num].data64, ra); +cpu_stq_le_data_ra (env, va, env->mem_log_stores[slot_num].data64, ra);break ;default :g_assert_not_reached ();
Signature · 1 line
2.52.0
[PULL 19/61] target/hppa: Use big-endian variant of cpu_ld/st_data*()
In reply to Philippe Mathieu-DaudéWe only build the HPPA target using big endianness order, therefore the cpu_ld/st_data*() definitions expand to the big endian declarations. Use the explicit big-endian variants.
Mechanical change running:
$ tgt=hppa; \
end=be; \
for op in data mmuidx_ra; do \
for ac in uw sw l q; do \
sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
for ac in w l q; do \
sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
doneMessage-ID: <[email protected]>
--- target/hppa/op_helper.c | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
target/hppa/op_helper.c +22 -22
@@ -107,7 +107,7 @@ static void do_stby_b(CPUHPPAState *env, target_ulong addr, target_ulong val,cpu_stb_data_ra (env, addr, val, ra);break ;case 2 : -cpu_stw_data_ra (env, addr, val, ra); +cpu_stw_be_data_ra (env, addr, val, ra);break ;case 1 :/* The 3 byte store must appear atomic. */
@@ -115,11 +115,11 @@ static void do_stby_b(CPUHPPAState *env, target_ulong addr, target_ulong val,atomic_store_mask32 (env, addr, val,0x00ffffffu , ra); }else {cpu_stb_data_ra (env, addr, val >>16 , ra); -cpu_stw_data_ra (env, addr +1 , val, ra); +cpu_stw_be_data_ra (env, addr +1 , val, ra); }break ;default : -cpu_stl_data_ra (env, addr, val, ra); +cpu_stl_be_data_ra (env, addr, val, ra);break ; } }
@@ -132,7 +132,7 @@ static void do_stdby_b(CPUHPPAState *env, target_ulong addr, uint64_t val,cpu_stb_data_ra (env, addr, val, ra);break ;case 6 : -cpu_stw_data_ra (env, addr, val, ra); +cpu_stw_be_data_ra (env, addr, val, ra);break ;case 5 :/* The 3 byte store must appear atomic. */
@@ -140,11 +140,11 @@ static void do_stdby_b(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask32 (env, addr, val,0x00ffffffu , ra); }else {cpu_stb_data_ra (env, addr, val >>16 , ra); -cpu_stw_data_ra (env, addr +1 , val, ra); +cpu_stw_be_data_ra (env, addr +1 , val, ra); }break ;case 4 : -cpu_stl_data_ra (env, addr, val, ra); +cpu_stl_be_data_ra (env, addr, val, ra);break ;case 3 :/* The 5 byte store must appear atomic. */
@@ -152,7 +152,7 @@ static void do_stdby_b(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask64 (env, addr, val,0x000000ffffffffffull ,5 , ra); }else {cpu_stb_data_ra (env, addr, val >>32 , ra); -cpu_stl_data_ra (env, addr +1 , val, ra); +cpu_stl_be_data_ra (env, addr +1 , val, ra); }break ;case 2 :
@@ -160,8 +160,8 @@ static void do_stdby_b(CPUHPPAState *env, target_ulong addr, uint64_t val,if (parallel) {atomic_store_mask64 (env, addr, val,0x0000ffffffffffffull ,6 , ra); }else { -cpu_stw_data_ra (env, addr, val >>32 , ra); -cpu_stl_data_ra (env, addr +2 , val, ra); +cpu_stw_be_data_ra (env, addr, val >>32 , ra); +cpu_stl_be_data_ra (env, addr +2 , val, ra); }break ;case 1 :
@@ -170,12 +170,12 @@ static void do_stdby_b(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask64 (env, addr, val,0x00ffffffffffffffull ,7 , ra); }else {cpu_stb_data_ra (env, addr, val >>48 , ra); -cpu_stw_data_ra (env, addr +1 , val >>32 , ra); -cpu_stl_data_ra (env, addr +3 , val, ra); +cpu_stw_be_data_ra (env, addr +1 , val >>32 , ra); +cpu_stl_be_data_ra (env, addr +3 , val, ra); }break ;default : -cpu_stq_data_ra (env, addr, val, ra); +cpu_stq_be_data_ra (env, addr, val, ra);break ; } }
@@ -211,12 +211,12 @@ static void do_stby_e(CPUHPPAState *env, target_ulong addr, target_ulong val,if (parallel) {atomic_store_mask32 (env, addr -3 , val,0xffffff00u , ra); }else { -cpu_stw_data_ra (env, addr -3 , val >>16 , ra); +cpu_stw_be_data_ra (env, addr -3 , val >>16 , ra);cpu_stb_data_ra (env, addr -1 , val >>8 , ra); }break ;case 2 : -cpu_stw_data_ra (env, addr -2 , val >>16 , ra); +cpu_stw_be_data_ra (env, addr -2 , val >>16 , ra);break ;case 1 :cpu_stb_data_ra (env, addr -1 , val >>24 , ra);
@@ -239,8 +239,8 @@ static void do_stdby_e(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask64 (env, addr -7 , val,0xffffffffffffff00ull ,7 , ra); }else { -cpu_stl_data_ra (env, addr -7 , val >>32 , ra); -cpu_stw_data_ra (env, addr -3 , val >>16 , ra); +cpu_stl_be_data_ra (env, addr -7 , val >>32 , ra); +cpu_stw_be_data_ra (env, addr -3 , val >>16 , ra);cpu_stb_data_ra (env, addr -1 , val >>8 , ra); }break ;
@@ -250,8 +250,8 @@ static void do_stdby_e(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask64 (env, addr -6 , val,0xffffffffffff0000ull ,6 , ra); }else { -cpu_stl_data_ra (env, addr -6 , val >>32 , ra); -cpu_stw_data_ra (env, addr -2 , val >>16 , ra); +cpu_stl_be_data_ra (env, addr -6 , val >>32 , ra); +cpu_stw_be_data_ra (env, addr -2 , val >>16 , ra); }break ;case 5 :
@@ -260,24 +260,24 @@ static void do_stdby_e(CPUHPPAState *env, target_ulong addr, uint64_t val,atomic_store_mask64 (env, addr -5 , val,0xffffffffff000000ull ,5 , ra); }else { -cpu_stl_data_ra (env, addr -5 , val >>32 , ra); +cpu_stl_be_data_ra (env, addr -5 , val >>32 , ra);cpu_stb_data_ra (env, addr -1 , val >>24 , ra); }break ;case 4 : -cpu_stl_data_ra (env, addr -4 , val >>32 , ra); +cpu_stl_be_data_ra (env, addr -4 , val >>32 , ra);break ;case 3 :/* The 3 byte store must appear atomic. */ if (parallel) {atomic_store_mask32 (env, addr -3 , val >>32 ,0xffffff00u , ra); }else { -cpu_stw_data_ra (env, addr -3 , val >>48 , ra); +cpu_stw_be_data_ra (env, addr -3 , val >>48 , ra);cpu_stb_data_ra (env, addr -1 , val >>40 , ra); }break ;case 2 : -cpu_stw_data_ra (env, addr -2 , val >>48 , ra); +cpu_stw_be_data_ra (env, addr -2 , val >>48 , ra);break ;case 1 :cpu_stb_data_ra (env, addr -1 , val >>56 , ra);
Signature · 1 line
2.52.0
[PULL 20/61] target/hppa: Remove unnecessary @cpu variable by using cpu_env()
In reply to Philippe Mathieu-DaudéPartly revert changes introduced by commit b2c2d00f48c ("target/hppa:
add 64 bit support to gdbstub"), restoring the cpu_env() call and removing the unused @cpu argument.
Message-ID: <[email protected]>
--- target/hppa/gdbstub.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
target/hppa/gdbstub.c +2 -4
@@ -33,8 +33,7 @@ static int hppa_reg_size(CPUHPPAState *env)int hppa_cpu_gdb_read_register (CPUState *cs,GByteArray *mem_buf,int n) { -HPPACPU *cpu =HPPA_CPU (cs); -CPUHPPAState *env = &cpu->env; +CPUHPPAState *env =cpu_env (cs);target_ulong val;if (n >=hppa_num_regs (env)) {
@@ -162,8 +161,7 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)int hppa_cpu_gdb_write_register (CPUState *cs,uint8_t *mem_buf,int n) { -HPPACPU *cpu =HPPA_CPU (cs); -CPUHPPAState *env = &cpu->env; +CPUHPPAState *env =cpu_env (cs);target_ulong val;if (n >=hppa_num_regs (env)) {
Signature · 1 line
2.52.0
[PULL 14/61] target/alpha: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form.
Message-ID: <[email protected]>
--- target/alpha/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/alpha/translate.c +2 -2
@@ -2904,8 +2904,8 @@ static void alpha_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)static void alpha_tr_translate_insn (DisasContextBase *dcbase,CPUState *cpu) {DisasContext *ctx =container_of (dcbase, DisasContext, base); -uint32_t insn =translator_ldl (cpu_env (cpu), &ctx->base, - ctx->base.pc_next); +uint32_t insn =translator_ldl_end (cpu_env (cpu), &ctx->base, + ctx->base.pc_next,MO_TE ); ctx->base.pc_next +=4 ; ctx->base.is_jmp =translate_one (ctx, insn);
Signature · 1 line
2.52.0
[PULL 21/61] target/hppa: Use explicit big-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe HPPA architecture uses big endianness. Directly use the big-endian LD/ST API.
Mechanical change using:
$ end=be; \
for acc in uw w l q tul; do \
sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
-e "s/st${acc}_p(/st${acc}_${end}_p(/" \
$(git grep -wlE '(ld|st)t?u?[wlq]_p' target/hppa/); \
doneMessage-ID: <[email protected]>
--- target/hppa/gdbstub.c | 2 +- target/hppa/int_helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/hppa/gdbstub.c +1 -1
@@ -168,7 +168,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)return 0 ; } - val =ldn_p (mem_buf,hppa_reg_size (env)); + val =ldn_be_p (mem_buf,hppa_reg_size (env));switch (n) {case 0 :
target/hppa/int_helper.c +1 -1
@@ -178,7 +178,7 @@ void hppa_cpu_do_interrupt(CPUState *cs)break ; } } - env->cr[CR_IIR ] =ldl_phys (cs->as, paddr); + env->cr[CR_IIR ] =ldl_be_phys (cs->as, paddr);if (i ==EXCP_ASSIST ) {/* stuff insn code into bits of FP exception register #1 */ env->fr[0 ] |= (env->cr[CR_IIR ] &0x03ffffff );
Signature · 1 line
2.52.0
[PULL 22/61] target/hppa: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> mo_endian().
Message-ID: <[email protected]>
--- target/hppa/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/hppa/translate.c +2 -1
@@ -4737,7 +4737,8 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) {/* Always fetch the insn, even if nullified, so that we check the page permissions for execute. */ -uint32_t insn =translator_ldl (env, &ctx->base, ctx->base.pc_next); +uint32_t insn =translator_ldl_end (env, &ctx->base, ctx->base.pc_next, +mo_endian (ctx));/* * Set up the IA queue for the next insn.
Signature · 1 line
2.52.0
[PULL 23/61] target/hppa: Avoid target-specific migration headers in machine.c
In reply to Philippe Mathieu-Daudémachine.c doesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum header required:
"migration/qemu-file-types.h" and "migration/vmstate.h", which are not target-specific.
Message-ID: <[email protected]>
--- target/hppa/machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/hppa/machine.c +2 -1
@@ -19,7 +19,8 @@#include "qemu/osdep.h" #include "cpu.h" -#include "migration/cpu.h" +#include "migration/qemu-file-types.h" +#include "migration/vmstate.h" static int get_psw(QEMUFile *f, void *opaque, size_t size,
Signature · 1 line
2.52.0
[PULL 24/61] target/hppa: Remove target_ulong use in disas_log() handler
In reply to Philippe Mathieu-DaudéSince commit 85c19af63e7 ("include/exec: Use vaddr in DisasContextBase virtual addresses") the DisasContextBase::pc_first field is a vaddr type.
Message-ID: <[email protected]>
--- target/hppa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/translate.c +1 -1
@@ -4864,7 +4864,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)static bool hppa_tr_disas_log (const DisasContextBase *dcbase,CPUState *cs,FILE *logfile) { -target_ulong pc = dcbase->pc_first; +vaddr pc = dcbase->pc_first;switch (pc) {case 0x00 :
Signature · 1 line
2.52.0
[PULL 25/61] hw/loongarch: Use explicit little-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe LoongArch architecture uses little endianness. Directly use the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
for acc in uw w l q tul; do \
sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
-e "s/st${acc}_p(/st${acc}_${end}_p(/" \
$(git grep -wlE '(ld|st)t?u?[wlq]_p' hw/loongarch/); \
doneMessage-ID: <[email protected]>
--- hw/loongarch/virt.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
hw/loongarch/virt.c +9 -9
@@ -740,9 +740,9 @@ static MemTxResult virt_iocsr_misc_write(void *opaque, hwaddr addr, lvms->misc_status |=BIT_ULL (IOCSRM_DMSI_EN ); } - features =address_space_ldl (&lvms->as_iocsr, -EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , - attrs,NULL ); + features =address_space_ldl_le (&lvms->as_iocsr, +EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , + attrs,NULL );if (val &BIT_ULL (IOCSRM_EXTIOI_EN )) { features |=BIT (EXTIOI_ENABLE ); }
@@ -750,9 +750,9 @@ static MemTxResult virt_iocsr_misc_write(void *opaque, hwaddr addr, features |=BIT (EXTIOI_ENABLE_INT_ENCODE ); } -address_space_stl (&lvms->as_iocsr, -EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , - features, attrs,NULL ); +address_space_stl_le (&lvms->as_iocsr, +EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , + features, attrs,NULL );break ;default :g_assert_not_reached ();
@@ -798,9 +798,9 @@ static MemTxResult virt_iocsr_misc_read(void *opaque, hwaddr addr,break ; } - features =address_space_ldl (&lvms->as_iocsr, -EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , - attrs,NULL ); + features =address_space_ldl_le (&lvms->as_iocsr, +EXTIOI_VIRT_BASE +EXTIOI_VIRT_CONFIG , + attrs,NULL );if (features &BIT (EXTIOI_ENABLE )) { ret |=BIT_ULL (IOCSRM_EXTIOI_EN ); }
Signature · 1 line
2.52.0
[PULL 27/61] target/loongarch: Use hwaddr type for physical addresses
In reply to Philippe Mathieu-DaudéReplace variables used with get_physical_address(), which expect a physical addresses, by the 'hwaddr' type, instead of the 'target_ulong' one.
Message-ID: <[email protected]>
--- target/loongarch/cpu_helper.c | 2 +- target/loongarch/tcg/tlb_helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/loongarch/cpu_helper.c +1 -1
@@ -146,7 +146,7 @@ TLBRet loongarch_ptw(CPULoongArchState *env, MMUContext *context, int access_type, int mmu_idx, int debug) { CPUState *cs = env_cpu(env); -target_ulong index =0 , phys =0 ; +hwaddr index =0 , phys =0 ;uint64_t dir_base, dir_width;uint64_t base, pte;int level;
target/loongarch/tcg/tlb_helper.c +2 -2
@@ -691,7 +691,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base, {CPUState *cs =env_cpu (env);uint64_t badvaddr; -target_ulong index, phys; +hwaddr index, phys;uint64_t dir_base, dir_width;if (unlikely ((level ==0 ) || (level >4 ))) {
@@ -726,7 +726,7 @@ void helper_ldpte(CPULoongArchState *env, target_ulong base, target_ulong odd, uint32_t mem_idx) {CPUState *cs =env_cpu (env); -target_ulong phys, tmp0, ptindex, ptoffset0, ptoffset1; +hwaddr phys, tmp0, ptindex, ptoffset0, ptoffset1;uint64_t badv;uint64_t ptbase =FIELD_EX64 (env->CSR_PWCL,CSR_PWCL ,PTBASE );uint64_t ptwidth =FIELD_EX64 (env->CSR_PWCL,CSR_PWCL ,PTWIDTH );
Signature · 1 line
2.52.0
[PULL 26/61] target/loongarch: Replace target_ulong -> uint64_t for DMW and TLBRBADV
In reply to Philippe Mathieu-DaudéThe Direct Mapping Configuration Window and Bad Virtual Address CSR registers are declared as uint64_t since their introduction in commit 398cecb9c3e ("target/loongarch: Add CSRs definition"):
296 typedef struct CPUArchState {
...
345 uint64_t CSR_TLBRBADV;
...
359 uint64_t CSR_DMW[4];
...
385 } CPULoongArchState;
Use the proper uint64_t type instead of target_ulong (which would otherwise be truncated on 32-bit builds).
Message-Id: <[email protected]>
--- target/loongarch/cpu_helper.c | 2 +- target/loongarch/tcg/tlb_helper.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
target/loongarch/cpu_helper.c +1 -1
@@ -289,7 +289,7 @@ static TLBRet loongarch_map_address(CPULoongArchState *env,return TLBRET_NOMATCH ; } -static hwaddr dmw_va2pa (CPULoongArchState *env,vaddr va,target_ulong dmw) +static hwaddr dmw_va2pa (CPULoongArchState *env,vaddr va,uint64_t dmw) {if (is_la64 (env)) {return va &TARGET_VIRT_MASK ;
target/loongarch/tcg/tlb_helper.c +4 -2
@@ -690,7 +690,8 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base, uint32_t level, uint32_t mem_idx) {CPUState *cs =env_cpu (env); -target_ulong badvaddr, index, phys; +uint64_t badvaddr; +target_ulong index, phys;uint64_t dir_base, dir_width;if (unlikely ((level ==0 ) || (level >4 ))) {
@@ -725,7 +726,8 @@ void helper_ldpte(CPULoongArchState *env, target_ulong base, target_ulong odd, uint32_t mem_idx) {CPUState *cs =env_cpu (env); -target_ulong phys, tmp0, ptindex, ptoffset0, ptoffset1, badv; +target_ulong phys, tmp0, ptindex, ptoffset0, ptoffset1; +uint64_t badv;uint64_t ptbase =FIELD_EX64 (env->CSR_PWCL,CSR_PWCL ,PTBASE );uint64_t ptwidth =FIELD_EX64 (env->CSR_PWCL,CSR_PWCL ,PTWIDTH );uint64_t dir_base, dir_width;
Signature · 1 line
2.52.0
[PULL 31/61] target/loongarch: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> MO_LE since LoongArch use little-endian order.
Message-ID: <[email protected]>
--- target/loongarch/tcg/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/loongarch/tcg/translate.c +2 -1
@@ -286,7 +286,8 @@ static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base); - ctx->opcode =translator_ldl (cpu_env (cs), &ctx->base, ctx->base.pc_next); + ctx->opcode =translator_ldl_end (cpu_env (cs), &ctx->base, + ctx->base.pc_next,MO_LE );if (!decode (ctx, ctx->opcode)) { qemu_log_mask(LOG_UNIMP, "Error: unknown opcode. "
Signature · 1 line
2.52.0
[PULL 32/61] target/m68k: Replace MD_TLONG -> MD_I32 in monitor.c
In reply to Philippe Mathieu-Daudém68k's monitor_defs[] array implicitly uses type=MD_TLONG for all its entries. Since we only build this target as 32-bit, use the explicit MD_I32 type to avoid an indirect target_long use.
Message-ID: <[email protected]>
--- target/m68k/monitor.c | 60 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
target/m68k/monitor.c +30 -30
@@ -23,36 +23,36 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) }static const MonitorDef monitor_defs[] = { - { "d0", offsetof(CPUM68KState, dregs[0]) }, - { "d1", offsetof(CPUM68KState, dregs[1]) }, - { "d2", offsetof(CPUM68KState, dregs[2]) }, - { "d3", offsetof(CPUM68KState, dregs[3]) }, - { "d4", offsetof(CPUM68KState, dregs[4]) }, - { "d5", offsetof(CPUM68KState, dregs[5]) }, - { "d6", offsetof(CPUM68KState, dregs[6]) }, - { "d7", offsetof(CPUM68KState, dregs[7]) }, - { "a0", offsetof(CPUM68KState, aregs[0]) }, - { "a1", offsetof(CPUM68KState, aregs[1]) }, - { "a2", offsetof(CPUM68KState, aregs[2]) }, - { "a3", offsetof(CPUM68KState, aregs[3]) }, - { "a4", offsetof(CPUM68KState, aregs[4]) }, - { "a5", offsetof(CPUM68KState, aregs[5]) }, - { "a6", offsetof(CPUM68KState, aregs[6]) }, - { "a7", offsetof(CPUM68KState, aregs[7]) }, - {"pc" , offsetof(CPUM68KState , pc) }, - {"sr" , offsetof(CPUM68KState , sr) }, - { "ssp", offsetof(CPUM68KState, sp[0]) }, - { "usp", offsetof(CPUM68KState, sp[1]) }, - { "isp", offsetof(CPUM68KState, sp[2]) }, - {"sfc" , offsetof(CPUM68KState , sfc) }, - {"dfc" , offsetof(CPUM68KState , dfc) }, - { "urp", offsetof(CPUM68KState, mmu.urp) }, - { "srp", offsetof(CPUM68KState, mmu.srp) }, - { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) }, - { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) }, - { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) }, - { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) }, - { "mmusr", offsetof(CPUM68KState, mmu.mmusr) }, + { "d0", offsetof(CPUM68KState, dregs[0]), NULL, MD_I32 }, + { "d1", offsetof(CPUM68KState, dregs[1]), NULL, MD_I32 }, + { "d2", offsetof(CPUM68KState, dregs[2]), NULL, MD_I32 }, + { "d3", offsetof(CPUM68KState, dregs[3]), NULL, MD_I32 }, + { "d4", offsetof(CPUM68KState, dregs[4]), NULL, MD_I32 }, + { "d5", offsetof(CPUM68KState, dregs[5]), NULL, MD_I32 }, + { "d6", offsetof(CPUM68KState, dregs[6]), NULL, MD_I32 }, + { "d7", offsetof(CPUM68KState, dregs[7]), NULL, MD_I32 }, + { "a0", offsetof(CPUM68KState, aregs[0]), NULL, MD_I32 }, + { "a1", offsetof(CPUM68KState, aregs[1]), NULL, MD_I32 }, + { "a2", offsetof(CPUM68KState, aregs[2]), NULL, MD_I32 }, + { "a3", offsetof(CPUM68KState, aregs[3]), NULL, MD_I32 }, + { "a4", offsetof(CPUM68KState, aregs[4]), NULL, MD_I32 }, + { "a5", offsetof(CPUM68KState, aregs[5]), NULL, MD_I32 }, + { "a6", offsetof(CPUM68KState, aregs[6]), NULL, MD_I32 }, + { "a7", offsetof(CPUM68KState, aregs[7]), NULL, MD_I32 }, + {"pc" , offsetof(CPUM68KState , pc),NULL ,MD_I32 }, + {"sr" , offsetof(CPUM68KState , sr),NULL ,MD_I32 }, + { "ssp", offsetof(CPUM68KState, sp[0]), NULL, MD_I32 }, + { "usp", offsetof(CPUM68KState, sp[1]), NULL, MD_I32 }, + { "isp", offsetof(CPUM68KState, sp[2]), NULL, MD_I32 }, + {"sfc" , offsetof(CPUM68KState , sfc),NULL ,MD_I32 }, + {"dfc" , offsetof(CPUM68KState , dfc),NULL ,MD_I32 }, + { "urp", offsetof(CPUM68KState, mmu.urp), NULL, MD_I32 }, + { "srp", offsetof(CPUM68KState, mmu.srp), NULL, MD_I32 }, + { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_I32 }, + { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_I32 }, + { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_I32 }, + { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_I32 }, + { "mmusr", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_I32 }, {NULL }, };
Signature · 1 line
2.52.0
[PULL 33/61] target/microblaze: Directly check endianness via CPUConfig::endi flag
In reply to Philippe Mathieu-DaudéThe MicroBlazeCPUConfig::endi flag reports whether the CPU is configure in little endianness. Directly use this knowledge instead of evaluating MemOp from mo_endian().
Message-ID: <[email protected]>
--- target/microblaze/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
target/microblaze/translate.c +4 -4
@@ -794,7 +794,7 @@ static bool trans_lhuea(DisasContext *dc, arg_typea *arg)#else TCGv_i64 addr =compute_ldst_addr_ea (dc, arg->ra, arg->rb);gen_alignment_check_ea (dc, addr, arg->rb, arg->rd,MO_16 , false); - (mo_endian (dc) ==MO_BE ? gen_helper_lhuea_be : gen_helper_lhuea_le) + (dc->cfg->endi ? gen_helper_lhuea_le : gen_helper_lhuea_be) (reg_for_write (dc, arg->rd), tcg_env, addr);return true;#endif
@@ -828,7 +828,7 @@ static bool trans_lwea(DisasContext *dc, arg_typea *arg)#else TCGv_i64 addr =compute_ldst_addr_ea (dc, arg->ra, arg->rb);gen_alignment_check_ea (dc, addr, arg->rb, arg->rd,MO_32 , false); - (mo_endian (dc) ==MO_BE ? gen_helper_lwea_be : gen_helper_lwea_le) + (dc->cfg->endi ? gen_helper_lwea_le : gen_helper_lwea_be) (reg_for_write (dc, arg->rd), tcg_env, addr);return true;#endif
@@ -954,7 +954,7 @@ static bool trans_shea(DisasContext *dc, arg_typea *arg)#else TCGv_i64 addr =compute_ldst_addr_ea (dc, arg->ra, arg->rb);gen_alignment_check_ea (dc, addr, arg->rb, arg->rd,MO_16 , true); - (mo_endian (dc) ==MO_BE ? gen_helper_shea_be : gen_helper_shea_le) + (dc->cfg->endi ? gen_helper_shea_le : gen_helper_shea_be) (tcg_env,reg_for_read (dc, arg->rd), addr);return true;#endif
@@ -988,7 +988,7 @@ static bool trans_swea(DisasContext *dc, arg_typea *arg)#else TCGv_i64 addr =compute_ldst_addr_ea (dc, arg->ra, arg->rb);gen_alignment_check_ea (dc, addr, arg->rb, arg->rd,MO_32 , true); - (mo_endian (dc) ==MO_BE ? gen_helper_swea_be : gen_helper_swea_le) + (dc->cfg->endi ? gen_helper_swea_le : gen_helper_swea_be) (tcg_env,reg_for_read (dc, arg->rd), addr);return true;#endif
Signature · 1 line
2.52.0
[PULL 34/61] target/microblaze: Avoid target-specific migration headers in machine.c
In reply to Philippe Mathieu-Daudémachine.c doesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum header requiered:
"migration/qemu-file-types.h" and "migration/vmstate.h", which are not target-specific.
Message-ID: <[email protected]>
--- target/microblaze/machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/microblaze/machine.c +2 -1
@@ -19,7 +19,8 @@#include "qemu/osdep.h" #include "cpu.h" -#include "migration/cpu.h" +#include "migration/qemu-file-types.h" +#include "migration/vmstate.h" static const VMStateField vmstate_mmu_fields[] = {
Signature · 1 line
2.52.0
[PULL 29/61] target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt()
In reply to Philippe Mathieu-DaudéIn preparation of removing the cpu_ldl_code wrapper, inline it.
Since LoongArch instructions are always stored in little-endian order, replace MO_TE -> MO_LE.
Message-Id: <[email protected]>
--- target/loongarch/tcg/tcg_cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/loongarch/tcg/tcg_cpu.c +3 -1
@@ -140,7 +140,9 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) }if (update_badinstr) { - env->CSR_BADI =cpu_ldl_code (env, env->pc); +MemOpIdx oi =make_memop_idx (MO_LEUL ,cpu_mmu_index (cs, true)); + + env->CSR_BADI =cpu_ldl_code_mmu (env, env->pc, oi,0 ); }/* Save PLV and IE */
Signature · 1 line
2.52.0
[PULL 30/61] target/loongarch: Use explicit little-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe LoongArch architecture uses little endianness. Directly use the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
for acc in uw w l q tul; do \
sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
-e "s/st${acc}_p(/st${acc}_${end}_p(/" \
$(git grep -wlE '(ld|st)t?u?[wlq]_p' target/loongarch/); \
doneMessage-ID: <[email protected]>
--- target/loongarch/cpu_helper.c | 8 ++++---- target/loongarch/tcg/iocsr_helper.c | 24 ++++++++++++------------ target/loongarch/tcg/tlb_helper.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-)
target/loongarch/cpu_helper.c +4 -4
@@ -172,7 +172,7 @@ TLBRet loongarch_ptw(CPULoongArchState *env, MMUContext *context,/* get next level page directory */ index = (address >> dir_base) & ((1 << dir_width) -1 ); phys = base | index <<3 ; - base =ldq_phys (cs->as, phys); + base =ldq_le_phys (cs->as, phys);if (level) {if (FIELD_EX64 (base,TLBENTRY ,HUGE )) {/* base is a huge pte */
@@ -204,8 +204,8 @@ restart: }else if (cpu_has_ptw (env)) { index &=1 ; context->pte_buddy[index] = base; - context->pte_buddy[1 - index] =ldq_phys (cs->as, - phys +8 * (1 -2 * index)); + context->pte_buddy[1 - index] =ldq_le_phys (cs->as, + phys +8 * (1 -2 * index)); } context->ps = dir_base;
@@ -237,7 +237,7 @@ restart: ret1 =loongarch_cmpxchg_phys (cs, phys, pte, base);/* PTE updated by other CPU, reload PTE entry */ if (ret1 ==MEMTX_DECODE_ERROR ) { - base =ldq_phys (cs->as, phys); + base =ldq_le_phys (cs->as, phys); goto restart; }
target/loongarch/tcg/iocsr_helper.c +12 -12
@@ -22,20 +22,20 @@ uint64_t helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr)uint64_t helper_iocsrrd_h (CPULoongArchState *env,target_ulong r_addr) { -return address_space_lduw (env->address_space_iocsr, r_addr, -GET_MEMTXATTRS (env),NULL ); +return address_space_lduw_le (env->address_space_iocsr, r_addr, +GET_MEMTXATTRS (env),NULL ); }uint64_t helper_iocsrrd_w (CPULoongArchState *env,target_ulong r_addr) { -return address_space_ldl (env->address_space_iocsr, r_addr, -GET_MEMTXATTRS (env),NULL ); +return address_space_ldl_le (env->address_space_iocsr, r_addr, +GET_MEMTXATTRS (env),NULL ); }uint64_t helper_iocsrrd_d (CPULoongArchState *env,target_ulong r_addr) { -return address_space_ldq (env->address_space_iocsr, r_addr, -GET_MEMTXATTRS (env),NULL ); +return address_space_ldq_le (env->address_space_iocsr, r_addr, +GET_MEMTXATTRS (env),NULL ); } void helper_iocsrwr_b(CPULoongArchState *env, target_ulong w_addr,
@@ -48,20 +48,20 @@ void helper_iocsrwr_b(CPULoongArchState *env, target_ulong w_addr,void helper_iocsrwr_h (CPULoongArchState *env,target_ulong w_addr,target_ulong val) { -address_space_stw (env->address_space_iocsr, w_addr, - val,GET_MEMTXATTRS (env),NULL ); +address_space_stw_le (env->address_space_iocsr, w_addr, + val,GET_MEMTXATTRS (env),NULL ); }void helper_iocsrwr_w (CPULoongArchState *env,target_ulong w_addr,target_ulong val) { -address_space_stl (env->address_space_iocsr, w_addr, - val,GET_MEMTXATTRS (env),NULL ); +address_space_stl_le (env->address_space_iocsr, w_addr, + val,GET_MEMTXATTRS (env),NULL ); }void helper_iocsrwr_d (CPULoongArchState *env,target_ulong w_addr,target_ulong val) { -address_space_stq (env->address_space_iocsr, w_addr, - val,GET_MEMTXATTRS (env),NULL ); +address_space_stq_le (env->address_space_iocsr, w_addr, + val,GET_MEMTXATTRS (env),NULL ); }
target/loongarch/tcg/tlb_helper.c +2 -2
@@ -719,7 +719,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,get_dir_base_width (env, &dir_base, &dir_width, level); index = (badvaddr >> dir_base) & ((1 << dir_width) -1 ); phys = base | index <<3 ; -return ldq_phys (cs->as, phys) &TARGET_PHYS_MASK ; +return ldq_le_phys (cs->as, phys) &TARGET_PHYS_MASK ; } void helper_ldpte(CPULoongArchState *env, target_ulong base, target_ulong odd,
@@ -781,7 +781,7 @@ void helper_ldpte(CPULoongArchState *env, target_ulong base, target_ulong odd, ptoffset0 = ptindex <<3 ; ptoffset1 = (ptindex +1 ) <<3 ; phys = base | (odd ? ptoffset1 : ptoffset0); - tmp0 =ldq_phys (cs->as, phys) &TARGET_PHYS_MASK ; + tmp0 =ldq_le_phys (cs->as, phys) &TARGET_PHYS_MASK ; ps = ptbase; }
Signature · 1 line
2.52.0
[PULL 38/61] hw/intc: Mark OpenRISC-specific peripheral as big-endian
In reply to Philippe Mathieu-DaudéThe Open Multi-Processor Interrupt Controller (ompic) is only used by the OpenRISC target, which is only built as big-endian. Therefore the DEVICE_NATIVE_ENDIAN definition expand to DEVICE_BIG_ENDIAN (besides, the DEVICE_LITTLE_ENDIAN case isn't tested). Simplify directly using DEVICE_BIG_ENDIAN.
Message-ID: <[email protected]>
--- hw/intc/ompic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/ompic.c +1 -1
@@ -96,7 +96,7 @@ static void ompic_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)static const MemoryRegionOps ompic_ops = { .read = ompic_read, .write = ompic_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .impl = { .max_access_size =8 , },
Signature · 1 line
2.52.0
[PULL 37/61] hw/microblaze: Build files once
In reply to Philippe Mathieu-DaudéPrevious commit removed the last target-specific use in hw model units, we can now build them once.
Message-ID: <[email protected]>
--- hw/microblaze/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/microblaze/meson.build +1 -1
@@ -4,4 +4,4 @@ microblaze_ss.add(when: 'CONFIG_PETALOGIX_S3ADSP1800', if_true: files('petalogix microblaze_ss.add(when: 'CONFIG_PETALOGIX_ML605', if_true: files('petalogix_ml605_mmu.c')) microblaze_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-zynqmp-pmu.c')) -hw_arch += {'microblaze': microblaze_ss} +hw_common_arch += {'microblaze': microblaze_ss}
Signature · 1 line
2.52.0
[PULL 28/61] target/loongarch: Replace MO_TE -> MO_LE
In reply to Philippe Mathieu-DaudéWe only build the LoongArch target using little endianness order, therefore the MO_TE definitions expand to the little endian one. Use the latter which is more explicit.
Mechanical change running:
$ sed -i -e s/MO_TE/MO_LE/ \
$(git grep -wl MO_TE target/loongarch/)Message-ID: <[email protected]>
--- .../tcg/insn_trans/trans_atomic.c.inc | 80 +++++++++---------- .../tcg/insn_trans/trans_fmemory.c.inc | 32 ++++---- .../tcg/insn_trans/trans_memory.c.inc | 64 +++++++-------- .../loongarch/tcg/insn_trans/trans_vec.c.inc | 16 ++-- 4 files changed, 96 insertions(+), 96 deletions(-)
target/loongarch/tcg/insn_trans/trans_atomic.c.inc +40 -40
@@ -69,43 +69,43 @@ static bool gen_am(DisasContext *ctx, arg_rrr *a, return true; } -TRANS(ll_w, ALL, gen_ll, MO_TESL) -TRANS(sc_w, ALL, gen_sc, MO_TESL) -TRANS(ll_d, 64, gen_ll, MO_TEUQ) -TRANS(sc_d, 64, gen_sc, MO_TEUQ) -TRANS(amswap_w, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_TESL) -TRANS64(amswap_d, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_TEUQ) -TRANS(amadd_w, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_TESL) -TRANS64(amadd_d, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_TEUQ) -TRANS(amand_w, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_TESL) -TRANS64(amand_d, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_TEUQ) -TRANS(amor_w, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_TESL) -TRANS64(amor_d, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_TEUQ) -TRANS(amxor_w, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_TESL) -TRANS64(amxor_d, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_TEUQ) -TRANS(ammax_w, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_TESL) -TRANS64(ammax_d, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_TEUQ) -TRANS(ammin_w, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_TESL) -TRANS64(ammin_d, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_TEUQ) -TRANS(ammax_wu, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_TESL) -TRANS64(ammax_du, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_TEUQ) -TRANS(ammin_wu, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_TESL) -TRANS64(ammin_du, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_TEUQ) -TRANS(amswap_db_w, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_TESL) -TRANS64(amswap_db_d, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_TEUQ) -TRANS(amadd_db_w, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_TESL) -TRANS64(amadd_db_d, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_TEUQ) -TRANS(amand_db_w, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_TESL) -TRANS64(amand_db_d, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_TEUQ) -TRANS(amor_db_w, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_TESL) -TRANS64(amor_db_d, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_TEUQ) -TRANS(amxor_db_w, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_TESL) -TRANS64(amxor_db_d, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_TEUQ) -TRANS(ammax_db_w, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_TESL) -TRANS64(ammax_db_d, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_TEUQ) -TRANS(ammin_db_w, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_TESL) -TRANS64(ammin_db_d, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_TEUQ) -TRANS(ammax_db_wu, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_TESL) -TRANS64(ammax_db_du, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_TEUQ) -TRANS(ammin_db_wu, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_TESL) -TRANS64(ammin_db_du, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_TEUQ) +TRANS(ll_w, ALL, gen_ll, MO_LESL) +TRANS(sc_w, ALL, gen_sc, MO_LESL) +TRANS(ll_d, 64, gen_ll, MO_LEUQ) +TRANS(sc_d, 64, gen_sc, MO_LEUQ) +TRANS(amswap_w, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_LESL) +TRANS64(amswap_d, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_LEUQ) +TRANS(amadd_w, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_LESL) +TRANS64(amadd_d, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_LEUQ) +TRANS(amand_w, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_LESL) +TRANS64(amand_d, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_LEUQ) +TRANS(amor_w, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_LESL) +TRANS64(amor_d, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_LEUQ) +TRANS(amxor_w, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_LESL) +TRANS64(amxor_d, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_LEUQ) +TRANS(ammax_w, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_LESL) +TRANS64(ammax_d, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_LEUQ) +TRANS(ammin_w, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_LESL) +TRANS64(ammin_d, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_LEUQ) +TRANS(ammax_wu, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_LESL) +TRANS64(ammax_du, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_LEUQ) +TRANS(ammin_wu, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_LESL) +TRANS64(ammin_du, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_LEUQ) +TRANS(amswap_db_w, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_LESL) +TRANS64(amswap_db_d, LAM, gen_am, tcg_gen_atomic_xchg_tl, MO_LEUQ) +TRANS(amadd_db_w, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_LESL) +TRANS64(amadd_db_d, LAM, gen_am, tcg_gen_atomic_fetch_add_tl, MO_LEUQ) +TRANS(amand_db_w, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_LESL) +TRANS64(amand_db_d, LAM, gen_am, tcg_gen_atomic_fetch_and_tl, MO_LEUQ) +TRANS(amor_db_w, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_LESL) +TRANS64(amor_db_d, LAM, gen_am, tcg_gen_atomic_fetch_or_tl, MO_LEUQ) +TRANS(amxor_db_w, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_LESL) +TRANS64(amxor_db_d, LAM, gen_am, tcg_gen_atomic_fetch_xor_tl, MO_LEUQ) +TRANS(ammax_db_w, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_LESL) +TRANS64(ammax_db_d, LAM, gen_am, tcg_gen_atomic_fetch_smax_tl, MO_LEUQ) +TRANS(ammin_db_w, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_LESL) +TRANS64(ammin_db_d, LAM, gen_am, tcg_gen_atomic_fetch_smin_tl, MO_LEUQ) +TRANS(ammax_db_wu, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_LESL) +TRANS64(ammax_db_du, LAM, gen_am, tcg_gen_atomic_fetch_umax_tl, MO_LEUQ) +TRANS(ammin_db_wu, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_LESL) +TRANS64(ammin_db_du, LAM, gen_am, tcg_gen_atomic_fetch_umin_tl, MO_LEUQ)
target/loongarch/tcg/insn_trans/trans_fmemory.c.inc +16 -16
@@ -140,19 +140,19 @@ static bool gen_fstore_le(DisasContext *ctx, arg_frr *a, MemOp mop) return true; } -TRANS(fld_s, FP_SP, gen_fload_i, MO_TEUL) -TRANS(fst_s, FP_SP, gen_fstore_i, MO_TEUL) -TRANS(fld_d, FP_DP, gen_fload_i, MO_TEUQ) -TRANS(fst_d, FP_DP, gen_fstore_i, MO_TEUQ) -TRANS(fldx_s, FP_SP, gen_floadx, MO_TEUL) -TRANS(fldx_d, FP_DP, gen_floadx, MO_TEUQ) -TRANS(fstx_s, FP_SP, gen_fstorex, MO_TEUL) -TRANS(fstx_d, FP_DP, gen_fstorex, MO_TEUQ) -TRANS64(fldgt_s, FP_SP, gen_fload_gt, MO_TEUL) -TRANS64(fldgt_d, FP_DP, gen_fload_gt, MO_TEUQ) -TRANS64(fldle_s, FP_SP, gen_fload_le, MO_TEUL) -TRANS64(fldle_d, FP_DP, gen_fload_le, MO_TEUQ) -TRANS64(fstgt_s, FP_SP, gen_fstore_gt, MO_TEUL) -TRANS64(fstgt_d, FP_DP, gen_fstore_gt, MO_TEUQ) -TRANS64(fstle_s, FP_SP, gen_fstore_le, MO_TEUL) -TRANS64(fstle_d, FP_DP, gen_fstore_le, MO_TEUQ) +TRANS(fld_s, FP_SP, gen_fload_i, MO_LEUL) +TRANS(fst_s, FP_SP, gen_fstore_i, MO_LEUL) +TRANS(fld_d, FP_DP, gen_fload_i, MO_LEUQ) +TRANS(fst_d, FP_DP, gen_fstore_i, MO_LEUQ) +TRANS(fldx_s, FP_SP, gen_floadx, MO_LEUL) +TRANS(fldx_d, FP_DP, gen_floadx, MO_LEUQ) +TRANS(fstx_s, FP_SP, gen_fstorex, MO_LEUL) +TRANS(fstx_d, FP_DP, gen_fstorex, MO_LEUQ) +TRANS64(fldgt_s, FP_SP, gen_fload_gt, MO_LEUL) +TRANS64(fldgt_d, FP_DP, gen_fload_gt, MO_LEUQ) +TRANS64(fldle_s, FP_SP, gen_fload_le, MO_LEUL) +TRANS64(fldle_d, FP_DP, gen_fload_le, MO_LEUQ) +TRANS64(fstgt_s, FP_SP, gen_fstore_gt, MO_LEUL) +TRANS64(fstgt_d, FP_DP, gen_fstore_gt, MO_LEUQ) +TRANS64(fstle_s, FP_SP, gen_fstore_le, MO_LEUL) +TRANS64(fstle_d, FP_DP, gen_fstore_le, MO_LEUQ)
target/loongarch/tcg/insn_trans/trans_memory.c.inc +32 -32
76 lines not on this page · raw message
target/loongarch/tcg/insn_trans/trans_vec.c.inc +8 -8
@@ -5279,7 +5279,7 @@ static bool trans_vld(DisasContext *ctx, arg_vr_i *a) addr = make_address_i(ctx, addr, a->imm); - tcg_gen_qemu_ld_i128(val, addr, ctx->mem_idx, MO_128 | MO_TE); + tcg_gen_qemu_ld_i128(val, addr, ctx->mem_idx, MO_128 | MO_LE); tcg_gen_extr_i128_i64(rl, rh, val); set_vreg64(rh, a->vd, 1); set_vreg64(rl, a->vd, 0);
@@ -5311,7 +5311,7 @@ static bool trans_vst(DisasContext *ctx, arg_vr_i *a) get_vreg64(ah, a->vd, 1); get_vreg64(al, a->vd, 0); tcg_gen_concat_i64_i128(val, al, ah); - tcg_gen_qemu_st_i128(val, addr, ctx->mem_idx, MO_128 | MO_TE); + tcg_gen_qemu_st_i128(val, addr, ctx->mem_idx, MO_128 | MO_LE); return true; }
@@ -5337,7 +5337,7 @@ static bool trans_vldx(DisasContext *ctx, arg_vrr *a) rh = tcg_temp_new_i64(); addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_ld_i128(val, addr, ctx->mem_idx, MO_128 | MO_TE); + tcg_gen_qemu_ld_i128(val, addr, ctx->mem_idx, MO_128 | MO_LE); tcg_gen_extr_i128_i64(rl, rh, val); set_vreg64(rh, a->vd, 1); set_vreg64(rl, a->vd, 0);
@@ -5369,7 +5369,7 @@ static bool trans_vstx(DisasContext *ctx, arg_vrr *a) get_vreg64(ah, a->vd, 1); get_vreg64(al, a->vd, 0); tcg_gen_concat_i64_i128(val, al, ah); - tcg_gen_qemu_st_i128(val, addr, ctx->mem_idx, MO_128 | MO_TE); + tcg_gen_qemu_st_i128(val, addr, ctx->mem_idx, MO_128 | MO_LE); return true; }
@@ -5478,12 +5478,12 @@ static void gen_xvld(DisasContext *ctx, int vreg, TCGv addr) TCGv temp = tcg_temp_new(); TCGv dest = tcg_temp_new(); - tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, MO_TEUQ); + tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, MO_LEUQ); set_vreg64(dest, vreg, 0); for (i = 1; i < 4; i++) { tcg_gen_addi_tl(temp, addr, 8 * i); - tcg_gen_qemu_ld_i64(dest, temp, ctx->mem_idx, MO_TEUQ); + tcg_gen_qemu_ld_i64(dest, temp, ctx->mem_idx, MO_LEUQ); set_vreg64(dest, vreg, i); } }
@@ -5495,12 +5495,12 @@ static void gen_xvst(DisasContext * ctx, int vreg, TCGv addr) TCGv dest = tcg_temp_new(); get_vreg64(dest, vreg, 0); - tcg_gen_qemu_st_i64(dest, addr, ctx->mem_idx, MO_TEUQ); + tcg_gen_qemu_st_i64(dest, addr, ctx->mem_idx, MO_LEUQ); for (i = 1; i < 4; i++) { tcg_gen_addi_tl(temp, addr, 8 * i); get_vreg64(dest, vreg, i); - tcg_gen_qemu_st_i64(dest, temp, ctx->mem_idx, MO_TEUQ); + tcg_gen_qemu_st_i64(dest, temp, ctx->mem_idx, MO_LEUQ); } }
Signature · 1 line
2.52.0
[PULL 39/61] target/openrisc: Use explicit big-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe OpenRISC architecture uses big endianness. Directly use the big-endian LD/ST API.
Mechanical change running:
$ for a in uw w l q; do \
sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
$(git grep -wlE '(ld|st)u?[wlq]_p' target/openrisc/);
doneMessage-ID: <[email protected]>
--- target/openrisc/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/openrisc/gdbstub.c +1 -1
@@ -50,7 +50,7 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)CPUOpenRISCState *env =cpu_env (cs);uint32_t tmp; - tmp =ldl_p (mem_buf); + tmp =ldl_be_p (mem_buf);if (n <32 ) {cpu_set_gpr (env, n, tmp);
Signature · 1 line
2.52.0
[PULL 36/61] hw/microblaze: Replace TARGET_BIG_ENDIAN -> target_big_endian()
In reply to Philippe Mathieu-DaudéCheck endianness at runtime to remove the target-specific TARGET_BIG_ENDIAN definition.
Message-ID: <[email protected]>
--- hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/microblaze/petalogix_s3adsp1800_mmu.c +3 -1
@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qemu/target-info.h" #include "qemu/units.h" #include "qapi/error.h" #include "cpu.h"
@@ -177,7 +178,8 @@ static void petalogix_s3adsp1800_machine_class_init(ObjectClass *oc, &EndianMode_lookup, machine_get_endianness, machine_set_endianness); -object_property_set_default_str (prop,TARGET_BIG_ENDIAN ?"big" :"little" ); +object_property_set_default_str (prop,target_big_endian () ?"big" + :"little" );object_class_property_set_description (oc,"endianness" ,"Defines whether the machine runs in big or little endian mode" ); }
Signature · 1 line
2.52.0
[PULL 43/61] target/openrisc: Build system units in common source set
In reply to Philippe Mathieu-DaudéSince previous 2 commits and range 2795bc52af4..5b67dbf1dc3 we remove all uses of the target_ulong type in target/rx/. Use the meson target_common_system_arch[] source set to prevent further uses of target-specific types.
Message-ID: <[email protected]>
--- target/openrisc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/openrisc/meson.build +1 -1
@@ -22,4 +22,4 @@ openrisc_system_ss.add(files( )) target_arch += {'openrisc': openrisc_ss} -target_system_arch += {'openrisc': openrisc_system_ss} +target_common_system_arch += {'openrisc': openrisc_system_ss}
Signature · 1 line
2.52.0
Re: [PULL 43/61] target/openrisc: Build system units in common source set
Quoted 2 lines · Philippe Mathieu-Daudé
Since previous 2 commits and range
2795bc52af4..5b67dbf1dc3we remove all uses of thetarget_ulongtype in target/rx/. Use the
Oops, in in target/openrisc/ ;)
Quoted 20 lines
meson target_common_system_arch[] source set to prevent further uses of target-specific types.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-ID: <[email protected]>
--- target/openrisc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/openrisc/meson.build +1
-1@@ -22,4 +22,4 @@ openrisc_system_ss.add(files( )) target_arch += {'openrisc': openrisc_ss} -target_system_arch += {'openrisc': openrisc_system_ss} +target_common_system_arch += {'openrisc': openrisc_system_ss}
[PULL 35/61] target/microblaze: Build system files once
In reply to Philippe Mathieu-DaudéPrevious commit removed the last target-specific use in system units, we can now build them once.
Message-ID: <[email protected]>
--- target/microblaze/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/microblaze/meson.build +1 -1
@@ -17,4 +17,4 @@ microblaze_system_ss.add(files( )) target_arch += {'microblaze': microblaze_ss} -target_system_arch += {'microblaze': microblaze_system_ss} +target_common_system_arch += {'microblaze': microblaze_system_ss}
Signature · 1 line
2.52.0
[PULL 41/61] target/openrisc: Remove unused 'gdbstub/helpers.h' header in helper.c
In reply to Philippe Mathieu-Daudé"gdbstub/helpers.h" uses target-specific symbols, but we don't need it, so remove it.
Message-ID: <[email protected]>
--- target/openrisc/interrupt.c | 1 - target/openrisc/mmu.c | 1 - 2 files changed, 2 deletions(-)
target/openrisc/interrupt.c +0 -1
@@ -20,7 +20,6 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "cpu.h" -#include "gdbstub/helpers.h" #include "qemu/host-utils.h" #ifndef CONFIG_USER_ONLY #include "hw/core/loader.h"
target/openrisc/mmu.c +0 -1
@@ -24,7 +24,6 @@#include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h" -#include "gdbstub/helpers.h" #include "qemu/host-utils.h" #include "hw/core/loader.h"
Signature · 1 line
2.52.0
[PULL 44/61] target/rx: Use little-endian variant of cpu_ld/st_data*()
In reply to Philippe Mathieu-DaudéWe only build the RX target using little endianness order, therefore the cpu_ld/st_data*() definitions expand to the little endian declarations. Use the explicit little-endian variants.
Mechanical change running:
$ tgt=rx; \
end=le; \
for op in data mmuidx_ra; do \
for ac in uw sw l q; do \
sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
for ac in w l q; do \
sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
doneMessage-ID: <[email protected]>
--- target/rx/helper.c | 14 +++++++------- target/rx/op_helper.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-)
target/rx/helper.c +7 -7
@@ -68,10 +68,10 @@ void rx_cpu_do_interrupt(CPUState *cs)qemu_log_mask (CPU_LOG_INT ,"fast interrupt raised\n" ); }else if (cpu_test_interrupt (cs,CPU_INTERRUPT_HARD )) { env->isp -=4 ; -cpu_stl_data (env, env->isp, save_psw); +cpu_stl_le_data (env, env->isp, save_psw); env->isp -=4 ; -cpu_stl_data (env, env->isp, env->pc); - env->pc =cpu_ldl_data (env, env->intb + env->ack_irq *4 ); +cpu_stl_le_data (env, env->isp, env->pc); + env->pc =cpu_ldl_le_data (env, env->intb + env->ack_irq *4 ); env->psw_ipl = env->ack_ipl;cpu_reset_interrupt (cs,CPU_INTERRUPT_HARD );qemu_set_irq (env->ack, env->ack_irq);
@@ -82,14 +82,14 @@ void rx_cpu_do_interrupt(CPUState *cs)const char *expname ="unknown exception" ; env->isp -=4 ; -cpu_stl_data (env, env->isp, save_psw); +cpu_stl_le_data (env, env->isp, save_psw); env->isp -=4 ; -cpu_stl_data (env, env->isp, env->pc); +cpu_stl_le_data (env, env->isp, env->pc);if (vec <0x100 ) { - env->pc =cpu_ldl_data (env,0xffffff80 + vec *4 ); + env->pc =cpu_ldl_le_data (env,0xffffff80 + vec *4 ); }else { - env->pc =cpu_ldl_data (env, env->intb + (vec &0xff ) *4 ); + env->pc =cpu_ldl_le_data (env, env->intb + (vec &0xff ) *4 ); }if (vec ==30 ) {
target/rx/op_helper.c +3 -3
@@ -217,20 +217,20 @@ void helper_scmpu(CPURXState *env)static uint32_t (*const cpu_ldufn[])(CPUArchState *env,abi_ptr ptr,uintptr_t retaddr) = { - cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra, + cpu_ldub_data_ra, cpu_lduw_le_data_ra, cpu_ldl_le_data_ra, };static uint32_t (*const cpu_ldfn[])(CPUArchState *env,abi_ptr ptr,uintptr_t retaddr) = { - cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra, + cpu_ldub_data_ra, cpu_lduw_le_data_ra, cpu_ldl_le_data_ra, };static void (*const cpu_stfn[])(CPUArchState *env,abi_ptr ptr,uint32_t val,uintptr_t retaddr) = { - cpu_stb_data_ra, cpu_stw_data_ra, cpu_stl_data_ra, + cpu_stb_data_ra, cpu_stw_le_data_ra, cpu_stl_le_data_ra, };void helper_sstr (CPURXState *env,uint32_t sz)
Signature · 1 line
2.52.0
[PULL 42/61] target/openrisc: Avoid target-specific migration headers in machine.c
In reply to Philippe Mathieu-Daudémachine.c doesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum header required:
"migration/qemu-file-types.h" and "migration/vmstate.h", which are not target-specific.
Message-ID: <[email protected]>
--- target/openrisc/machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/openrisc/machine.c +2 -1
@@ -19,7 +19,8 @@#include "qemu/osdep.h" #include "cpu.h" -#include "migration/cpu.h" +#include "migration/qemu-file-types.h" +#include "migration/vmstate.h" static const VMStateDescription vmstate_tlb_entry = { .name ="tlb_entry" ,
Signature · 1 line
2.52.0
[PULL 46/61] target/rx: Inline translator_lduw() and translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_lduw() and translator_ldl() are defined in "exec/translator.h" as:
192 static inline uint16_t
193 translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc)
194 {
195 return translator_lduw_end(env, db, pc, MO_TE);
196 }
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> mo_endian().
Message-ID: <[email protected]>
--- target/rx/translate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
target/rx/translate.c +6 -4
@@ -92,6 +92,7 @@ static uint32_t li(DisasContext *ctx, int sz) {vaddr addr;uint32_t tmp; +MemOp endian =mo_endian (ctx);CPURXState *env = ctx->env; addr = ctx->base.pc_next;
@@ -101,16 +102,16 @@ static uint32_t li(DisasContext *ctx, int sz)return (int8_t )translator_ldub (env, &ctx->base, addr);case 2 : ctx->base.pc_next +=2 ; -return (int16_t )translator_lduw (env, &ctx->base, addr); +return (int16_t )translator_lduw_end (env, &ctx->base, addr, endian);case 3 : ctx->base.pc_next +=3 ; tmp = (int8_t )translator_ldub (env, &ctx->base, addr +2 ); tmp <<=16 ; - tmp |=translator_lduw (env, &ctx->base, addr); + tmp |=translator_lduw_end (env, &ctx->base, addr, endian);return tmp;case 0 : ctx->base.pc_next +=4 ; -return translator_ldl (env, &ctx->base, addr); +return translator_ldl_end (env, &ctx->base, addr, endian);default :g_assert_not_reached (); }
@@ -206,7 +207,8 @@ static TCGv_i32 rx_index_addr(DisasContext *ctx, TCGv_i32 mem, ctx->base.pc_next +=1 ;return mem;case 2 : - dsp =translator_lduw (ctx->env, &ctx->base, ctx->base.pc_next) << size; + dsp =translator_lduw_end (ctx->env, &ctx->base, ctx->base.pc_next, +mo_endian (ctx)) << size;tcg_gen_addi_i32 (mem, cpu_regs[reg], dsp); ctx->base.pc_next +=2 ;return mem;
Signature · 1 line
2.52.0
[PULL 45/61] target/rx: Use explicit little-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe RX architecture uses little endianness. Directly use the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
for acc in uw w l q tul; do \
sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
-e "s/st${acc}_p(/st${acc}_${end}_p(/" \
$(git grep -wlE '(ld|st)t?u?[wlq]_p' target/rx/); \
doneMessage-ID: <[email protected]>
--- target/rx/cpu.c | 2 +- target/rx/gdbstub.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-)
target/rx/cpu.c +1 -1
@@ -99,7 +99,7 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) resetvec =rom_ptr (0xfffffffc ,4 );if (resetvec) {/* In the case of kernel, it is ignored because it is not set. */ - env->pc =ldl_p (resetvec); + env->pc =ldl_le_p (resetvec); }rx_cpu_unpack_psw (env,0 ,1 ); env->regs[0 ] = env->isp = env->usp =0 ;
target/rx/gdbstub.c +12 -12
@@ -56,7 +56,7 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)uint32_t psw;switch (n) { case 0 ... 15: - env->regs[n] =ldl_p (mem_buf); + env->regs[n] =ldl_le_p (mem_buf);if (n ==0 ) {if (env->psw_u) { env->usp = env->regs[0 ];
@@ -66,38 +66,38 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) }break ;case 16 : - env->usp =ldl_p (mem_buf); + env->usp =ldl_le_p (mem_buf);if (env->psw_u) { - env->regs[0 ] =ldl_p (mem_buf); + env->regs[0 ] =ldl_le_p (mem_buf); }break ;case 17 : - env->isp =ldl_p (mem_buf); + env->isp =ldl_le_p (mem_buf);if (!env->psw_u) { - env->regs[0 ] =ldl_p (mem_buf); + env->regs[0 ] =ldl_le_p (mem_buf); }break ;case 18 : - psw =ldl_p (mem_buf); + psw =ldl_le_p (mem_buf);rx_cpu_unpack_psw (env, psw,1 );break ;case 19 : - env->pc =ldl_p (mem_buf); + env->pc =ldl_le_p (mem_buf);break ;case 20 : - env->intb =ldl_p (mem_buf); + env->intb =ldl_le_p (mem_buf);break ;case 21 : - env->bpsw =ldl_p (mem_buf); + env->bpsw =ldl_le_p (mem_buf);break ;case 22 : - env->bpc =ldl_p (mem_buf); + env->bpc =ldl_le_p (mem_buf);break ;case 23 : - env->fintv =ldl_p (mem_buf); + env->fintv =ldl_le_p (mem_buf);break ;case 24 : - env->fpsw =ldl_p (mem_buf); + env->fpsw =ldl_le_p (mem_buf);break ;case 25 :return 8 ;
Signature · 1 line
2.52.0
[PULL 49/61] target/sh4: drop cpu_reset from realizefn
In reply to Philippe Mathieu-DaudéFrom: Alex Bennée <[email protected]>
Shuffle things around to ensure that gdb register creation was done after dependant peripherals had created their cpu interfaces.
Message-ID: <[email protected]>
--- target/sh4/cpu.c | 1 - 1 file changed, 1 deletion(-)
target/sh4/cpu.c +0 -1
@@ -255,7 +255,6 @@ static void superh_cpu_realizefn(DeviceState *dev, Error **errp)return ; } -cpu_reset (cs);qemu_init_vcpu (cs); scc->parent_realize (dev, errp);
Signature · 1 line
2.52.0
[PULL 47/61] target/rx: Build system units in common source set
In reply to Philippe Mathieu-DaudéSince commit range 2982b948a9f..86114e43ffd we remove all uses of the target_ulong type in target/rx/. Use the meson target_common_system_arch[] source set to prevent further uses of target-specific types.
Message-ID: <[email protected]>
--- target/rx/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/rx/meson.build +1 -1
@@ -13,4 +13,4 @@ rx_ss.add(files( 'disas.c')) target_arch += {'rx': rx_ss} -target_system_arch += {'rx': ss.source_set()} +target_common_system_arch += {'rx': ss.source_set()}
Signature · 1 line
2.52.0
[PULL 48/61] target/sh4: Build system units in common source set
In reply to Philippe Mathieu-DaudéSince commit range 42c90609b8f..82a1e739010 we remove all uses of the target_ulong type in target/rx/. Use the meson target_common_system_arch[] source set to prevent further uses of target-specific types.
Message-ID: <[email protected]>
--- target/sh4/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/sh4/meson.build +1 -1
@@ -11,4 +11,4 @@ sh4_system_ss = ss.source_set() sh4_system_ss.add(files('monitor.c')) target_arch += {'sh4': sh4_ss} -target_system_arch += {'sh4': sh4_system_ss} +target_common_system_arch += {'sh4': sh4_system_ss}
Signature · 1 line
2.52.0
[PULL 40/61] target/openrisc: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> mo_endian().
Message-ID: <[email protected]>
--- target/openrisc/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/openrisc/translate.c +2 -1
@@ -1558,7 +1558,8 @@ static void openrisc_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)static void openrisc_tr_translate_insn (DisasContextBase *dcbase,CPUState *cs) {DisasContext *dc =container_of (dcbase, DisasContext, base); -uint32_t insn =translator_ldl (cpu_env (cs), &dc->base, dc->base.pc_next); +uint32_t insn =translator_ldl_end (cpu_env (cs), &dc->base, + dc->base.pc_next,mo_endian (dc));if (!decode (dc, insn)) {gen_illegal_exception (dc);
Signature · 1 line
2.52.0
[PULL 52/61] target/sparc: Use explicit big-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe SPARC architecture uses big endianness. Directly use the big-endian LD/ST API.
Mechanical change running:
$ for a in uw w l q; do \
sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
$(git grep -wlE '(ld|st)u?[wlq]_p' target/sparc/);
doneMessage-ID: <[email protected]>
--- target/sparc/ldst_helper.c | 36 ++++++++++++++++++------------------ target/sparc/mmu_helper.c | 32 +++++++++++++++++--------------- 2 files changed, 35 insertions(+), 33 deletions(-)
target/sparc/ldst_helper.c +18 -18
@@ -707,17 +707,17 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr, MEMTXATTRS_UNSPECIFIED, &result);break ;case 2 : - ret =address_space_lduw (cs->as, access_addr, -MEMTXATTRS_UNSPECIFIED , &result); + ret =address_space_lduw_be (cs->as, access_addr, +MEMTXATTRS_UNSPECIFIED , &result);break ;default :case 4 : - ret =address_space_ldl (cs->as, access_addr, -MEMTXATTRS_UNSPECIFIED , &result); + ret =address_space_ldl_be (cs->as, access_addr, +MEMTXATTRS_UNSPECIFIED , &result);break ;case 8 : - ret =address_space_ldq (cs->as, access_addr, -MEMTXATTRS_UNSPECIFIED , &result); + ret =address_space_ldq_be (cs->as, access_addr, +MEMTXATTRS_UNSPECIFIED , &result);break ; }
@@ -878,10 +878,10 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,MemTxResult result;hwaddr access_addr = (env->mxccregs[0 ] &0xffffffffULL ) +8 * i; - env->mxccdata[i] =address_space_ldq (cs->as, - access_addr, -MEMTXATTRS_UNSPECIFIED , - &result); + env->mxccdata[i] =address_space_ldq_be (cs->as, + access_addr, +MEMTXATTRS_UNSPECIFIED , + &result);if (result !=MEMTX_OK ) {/* TODO: investigate whether this is the right behaviour */ sparc_raise_mmu_fault(cs, access_addr, false, false,
@@ -906,8 +906,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,MemTxResult result;hwaddr access_addr = (env->mxccregs[1 ] &0xffffffffULL ) +8 * i; -address_space_stq (cs->as, access_addr, env->mxccdata[i], -MEMTXATTRS_UNSPECIFIED , &result); +address_space_stq_be (cs->as, access_addr, env->mxccdata[i], +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {/* TODO: investigate whether this is the right behaviour */
@@ -1072,17 +1072,17 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val, MEMTXATTRS_UNSPECIFIED, &result);break ;case 2 : -address_space_stw (cs->as, access_addr, val, -MEMTXATTRS_UNSPECIFIED , &result); +address_space_stw_be (cs->as, access_addr, val, +MEMTXATTRS_UNSPECIFIED , &result);break ;case 4 :default : -address_space_stl (cs->as, access_addr, val, -MEMTXATTRS_UNSPECIFIED , &result); +address_space_stl_be (cs->as, access_addr, val, +MEMTXATTRS_UNSPECIFIED , &result);break ;case 8 : -address_space_stq (cs->as, access_addr, val, -MEMTXATTRS_UNSPECIFIED , &result); +address_space_stq_be (cs->as, access_addr, val, +MEMTXATTRS_UNSPECIFIED , &result);break ; }if (result !=MEMTX_OK ) {
target/sparc/mmu_helper.c +17 -15
@@ -102,7 +102,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,/* SPARC reference MMU table walk: Context table->L1->L2->PTE */ /* Context base + context number */ pde_ptr = (env->mmuregs[1 ] <<4 ) + (env->mmuregs[2 ] <<2 ); - pde =address_space_ldl (cs->as, pde_ptr,MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return 4 <<2 ;/* Translation fault, L = 0 */ }
@@ -117,8 +118,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,return 4 <<2 ;case 1 :/* L0 PDE */ pde_ptr = ((address >>22 ) & ~3 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return (1 <<8 ) | (4 <<2 );/* Translation fault, L = 1 */ }
@@ -131,8 +132,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,return (1 <<8 ) | (4 <<2 );case 1 :/* L1 PDE */ pde_ptr = ((address &0xfc0000 ) >>16 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return (2 <<8 ) | (4 <<2 );/* Translation fault, L = 2 */ }
@@ -145,8 +146,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,return (2 <<8 ) | (4 <<2 );case 1 :/* L2 PDE */ pde_ptr = ((address &0x3f000 ) >>10 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return (3 <<8 ) | (4 <<2 );/* Translation fault, L = 3 */ }
@@ -189,7 +190,7 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,if (is_dirty) { pde |=PG_MODIFIED_MASK ; } -stl_phys (cs->as, pde_ptr, pde); +stl_be_phys (cs->as, pde_ptr, pde); }/* the page can be put in the TLB */
@@ -276,7 +277,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)/* Context base + context number */ pde_ptr = (hwaddr)(env->mmuregs[1 ] <<4 ) + (env->mmuregs[2 ] <<2 ); - pde =address_space_ldl (cs->as, pde_ptr,MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return 0 ; }
@@ -292,8 +294,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)return pde; } pde_ptr = ((address >>22 ) & ~3 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return 0 ; }
@@ -310,8 +312,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)return pde; } pde_ptr = ((address &0xfc0000 ) >>16 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return 0 ; }
@@ -328,8 +330,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)return pde; } pde_ptr = ((address &0x3f000 ) >>10 ) + ((pde & ~3 ) <<4 ); - pde =address_space_ldl (cs->as, pde_ptr, -MEMTXATTRS_UNSPECIFIED , &result); + pde =address_space_ldl_be (cs->as, pde_ptr, +MEMTXATTRS_UNSPECIFIED , &result);if (result !=MEMTX_OK ) {return 0 ; }
Signature · 1 line
2.52.0
[PULL 50/61] hw/sparc: Mark SPARC-specific peripherals as big-endian
In reply to Philippe Mathieu-DaudéThese devices are only used by the SPARC target, which is only built as big-endian. Therefore the DEVICE_NATIVE_ENDIAN definition expand to DEVICE_BIG_ENDIAN (besides, the DEVICE_LITTLE_ENDIAN case isn't tested). Simplify directly using DEVICE_BIG_ENDIAN.
Message-ID: <[email protected]>
--- hw/audio/cs4231.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/display/cg3.c | 2 +- hw/display/tcx.c | 14 +++++++------- hw/dma/sparc32_dma.c | 2 +- hw/intc/grlib_irqmp.c | 2 +- hw/intc/slavio_intctl.c | 4 ++-- hw/misc/eccmemctl.c | 2 +- hw/misc/slavio_misc.c | 16 ++++++++-------- hw/rtc/sun4v-rtc.c | 2 +- hw/timer/grlib_gptimer.c | 2 +- hw/timer/slavio_timer.c | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-)
hw/audio/cs4231.c +1 -1
@@ -135,7 +135,7 @@ static void cs_mem_write(void *opaque, hwaddr addr,static const MemoryRegionOps cs_mem_ops = { .read = cs_mem_read, .write = cs_mem_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , };static const VMStateDescription vmstate_cs4231 = {
hw/char/grlib_apbuart.c +1 -1
@@ -242,7 +242,7 @@ static void grlib_apbuart_write(void *opaque, hwaddr addr,static const MemoryRegionOps grlib_apbuart_ops = { .write = grlib_apbuart_write, .read = grlib_apbuart_read, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , };static void grlib_apbuart_realize (DeviceState *dev,Error **errp)
hw/display/cg3.c +1 -1
@@ -265,7 +265,7 @@ static void cg3_reg_write(void *opaque, hwaddr addr, uint64_t val,static const MemoryRegionOps cg3_reg_ops = { .read = cg3_reg_read, .write = cg3_reg_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =4 ,
hw/display/tcx.c +7 -7
@@ -452,7 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,static const MemoryRegionOps tcx_dac_ops = { .read = tcx_dac_readl, .write = tcx_dac_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
@@ -533,7 +533,7 @@ static void tcx_rstip_writel(void *opaque, hwaddr addr,static const MemoryRegionOps tcx_stip_ops = { .read = tcx_stip_readl, .write = tcx_stip_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .impl = { .min_access_size =4 , .max_access_size =4 ,
@@ -547,7 +547,7 @@ static const MemoryRegionOps tcx_stip_ops = {static const MemoryRegionOps tcx_rstip_ops = { .read = tcx_stip_readl, .write = tcx_rstip_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .impl = { .min_access_size =4 , .max_access_size =4 ,
@@ -633,7 +633,7 @@ static void tcx_rblit_writel(void *opaque, hwaddr addr,static const MemoryRegionOps tcx_blit_ops = { .read = tcx_blit_readl, .write = tcx_blit_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .impl = { .min_access_size =4 , .max_access_size =4 ,
@@ -647,7 +647,7 @@ static const MemoryRegionOps tcx_blit_ops = {static const MemoryRegionOps tcx_rblit_ops = { .read = tcx_blit_readl, .write = tcx_rblit_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .impl = { .min_access_size =4 , .max_access_size =4 ,
@@ -713,7 +713,7 @@ static void tcx_thc_writel(void *opaque, hwaddr addr,static const MemoryRegionOps tcx_thc_ops = { .read = tcx_thc_readl, .write = tcx_thc_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
@@ -734,7 +734,7 @@ static void tcx_dummy_writel(void *opaque, hwaddr addr,static const MemoryRegionOps tcx_dummy_ops = { .read = tcx_dummy_readl, .write = tcx_dummy_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/dma/sparc32_dma.c +1 -1
@@ -230,7 +230,7 @@ static void dma_mem_write(void *opaque, hwaddr addr,static const MemoryRegionOps dma_mem_ops = { .read = dma_mem_read, .write = dma_mem_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/intc/grlib_irqmp.c +1 -1
@@ -330,7 +330,7 @@ static void grlib_irqmp_write(void *opaque, hwaddr addr,static const MemoryRegionOps grlib_irqmp_ops = { .read = grlib_irqmp_read, .write = grlib_irqmp_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/intc/slavio_intctl.c +2 -2
@@ -135,7 +135,7 @@ static void slavio_intctl_mem_writel(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_intctl_mem_ops = { .read = slavio_intctl_mem_readl, .write = slavio_intctl_mem_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
@@ -205,7 +205,7 @@ static void slavio_intctlm_mem_writel(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_intctlm_mem_ops = { .read = slavio_intctlm_mem_readl, .write = slavio_intctlm_mem_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/misc/eccmemctl.c +1 -1
@@ -232,7 +232,7 @@ static uint64_t ecc_mem_read(void *opaque, hwaddr addr,static const MemoryRegionOps ecc_mem_ops = { .read = ecc_mem_read, .write = ecc_mem_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/misc/slavio_misc.c +8 -8
@@ -147,7 +147,7 @@ static uint64_t slavio_cfg_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_cfg_mem_ops = { .read = slavio_cfg_mem_readb, .write = slavio_cfg_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -177,7 +177,7 @@ static uint64_t slavio_diag_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_diag_mem_ops = { .read = slavio_diag_mem_readb, .write = slavio_diag_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -207,7 +207,7 @@ static uint64_t slavio_mdm_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_mdm_mem_ops = { .read = slavio_mdm_mem_readb, .write = slavio_mdm_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -245,7 +245,7 @@ static uint64_t slavio_aux1_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_aux1_mem_ops = { .read = slavio_aux1_mem_readb, .write = slavio_aux1_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -282,7 +282,7 @@ static uint64_t slavio_aux2_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_aux2_mem_ops = { .read = slavio_aux2_mem_readb, .write = slavio_aux2_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -310,7 +310,7 @@ static uint64_t apc_mem_readb(void *opaque, hwaddr addr,static const MemoryRegionOps apc_mem_ops = { .read = apc_mem_readb, .write = apc_mem_writeb, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =1 , .max_access_size =1 ,
@@ -355,7 +355,7 @@ static void slavio_sysctrl_mem_writel(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_sysctrl_mem_ops = { .read = slavio_sysctrl_mem_readl, .write = slavio_sysctrl_mem_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
@@ -397,7 +397,7 @@ static void slavio_led_mem_writew(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_led_mem_ops = { .read = slavio_led_mem_readw, .write = slavio_led_mem_writew, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =2 , .max_access_size =2 ,
hw/rtc/sun4v-rtc.c +1 -1
@@ -49,7 +49,7 @@ static void sun4v_rtc_write(void *opaque, hwaddr addr,static const MemoryRegionOps sun4v_rtc_ops = { .read = sun4v_rtc_read, .write = sun4v_rtc_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , };void sun4v_rtc_init (hwaddr addr)
hw/timer/grlib_gptimer.c +1 -1
@@ -332,7 +332,7 @@ static void grlib_gptimer_write(void *opaque, hwaddr addr,static const MemoryRegionOps grlib_gptimer_ops = { .read = grlib_gptimer_read, .write = grlib_gptimer_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =4 ,
hw/timer/slavio_timer.c +1 -1
@@ -329,7 +329,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,static const MemoryRegionOps slavio_timer_mem_ops = { .read = slavio_timer_mem_readl, .write = slavio_timer_mem_writel, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_BIG_ENDIAN , .valid = { .min_access_size =4 , .max_access_size =8 ,
Signature · 1 line
2.52.0
[PULL 54/61] target/sparc: Inline cpu_ldl_code() call in cpu_do_interrupt()
In reply to Philippe Mathieu-DaudéIn preparation of removing the cpu_ldl_code wrapper, inline it.
Since SPARC instructions are always stored in big-endian order, replace MO_TE -> MO_BE.
Message-ID: <[email protected]>
--- target/sparc/int32_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/sparc/int32_helper.c +3 -1
@@ -149,9 +149,11 @@ void sparc_cpu_do_interrupt(CPUState *cs)* mimic delayed trap delivery as if by the subsequent insn. */ if (!env->fsr_qne) { +MemOpIdx oi =make_memop_idx (MO_BEUL ,cpu_mmu_index (cs, true)); + env->fsr_qne =FSR_QNE ; env->fq.s.addr = env->pc; - env->fq.s.insn =cpu_ldl_code (env, env->pc); + env->fq.s.insn =cpu_ldl_code_mmu (env, env->pc, oi,0 ); } env->pc = env->npc; env->npc = env->npc +4 ;
Signature · 1 line
2.52.0
[PULL 51/61] hw/sparc: Use explicit big-endian LD/ST API
In reply to Philippe Mathieu-DaudéThe SPARC architecture uses big endianness. Directly use the big-endian LD/ST API.
Mechanical change running:
$ for a in uw w l q; do \
sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
$(git grep -wlE '(ld|st)u?[wlq]_p' hw/sparc*/);
doneMessage-ID: <[email protected]>
--- hw/sparc/leon3.c | 42 +++++++++++++++++++++--------------------- hw/sparc/sun4m.c | 6 +++--- hw/sparc64/sun4u.c | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-)
hw/sparc/leon3.c +21 -21
@@ -79,21 +79,21 @@ typedef struct ResetData {static uint32_t *gen_store_u32 (uint32_t *code,hwaddr addr,uint32_t val) { -stl_p (code++,0x82100000 );/* mov %g0, %g1 */ -stl_p (code++,0x84100000 );/* mov %g0, %g2 */ -stl_p (code++,0x03000000 + +stl_be_p (code++,0x82100000 );/* mov %g0, %g1 */ +stl_be_p (code++,0x84100000 );/* mov %g0, %g2 */ +stl_be_p (code++,0x03000000 +extract32 (addr,10 ,22 ));/* sethi %hi(addr), %g1 */ -stl_p (code++,0x82106000 + +stl_be_p (code++,0x82106000 +extract32 (addr,0 ,10 ));/* or %g1, addr, %g1 */ -stl_p (code++,0x05000000 + +stl_be_p (code++,0x05000000 +extract32 (val,10 ,22 ));/* sethi %hi(val), %g2 */ -stl_p (code++,0x8410a000 + +stl_be_p (code++,0x8410a000 +extract32 (val,0 ,10 ));/* or %g2, val, %g2 */ -stl_p (code++,0xc4204000 );/* st %g2, [ %g1 ] */ +stl_be_p (code++,0xc4204000 );/* st %g2, [ %g1 ] */ return code; }
@@ -113,13 +113,13 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr)/* If we are running on a secondary CPU, jump directly to the kernel. */ -stl_p (p++,0x85444000 );/* rd %asr17, %g2 */ -stl_p (p++,0x8530a01c );/* srl %g2, 0x1c, %g2 */ -stl_p (p++,0x80908000 );/* tst %g2 */ +stl_be_p (p++,0x85444000 );/* rd %asr17, %g2 */ +stl_be_p (p++,0x8530a01c );/* srl %g2, 0x1c, %g2 */ +stl_be_p (p++,0x80908000 );/* tst %g2 */ /* Filled below. */ sec_cpu_branch_p = p; -stl_p (p++,0x0BADC0DE );/* bne xxx */ -stl_p (p++,0x01000000 );/* nop */ +stl_be_p (p++,0x0BADC0DE );/* bne xxx */ +stl_be_p (p++,0x01000000 );/* nop */ /* Initialize the UARTs */ /* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
@@ -134,17 +134,17 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr) p =gen_store_u32 (p,0x80000318 ,3 );/* Now, the relative branch above can be computed. */ -stl_p (sec_cpu_branch_p,0x12800000 - + (p - sec_cpu_branch_p)); +stl_be_p (sec_cpu_branch_p,0x12800000 + + (p - sec_cpu_branch_p));/* JUMP to the entry point */ -stl_p (p++,0x82100000 );/* mov %g0, %g1 */ -stl_p (p++,0x03000000 +extract32 (kernel_addr,10 ,22 )); -/* sethi %hi(kernel_addr), %g1 */ -stl_p (p++,0x82106000 +extract32 (kernel_addr,0 ,10 )); -/* or kernel_addr, %g1 */ -stl_p (p++,0x81c04000 );/* jmp %g1 */ -stl_p (p++,0x01000000 );/* nop */ +stl_be_p (p++,0x82100000 );/* mov %g0, %g1 */ +stl_be_p (p++,0x03000000 +extract32 (kernel_addr,10 ,22 )); +/* sethi %hi(kernel_addr), %g1 */ +stl_be_p (p++,0x82106000 +extract32 (kernel_addr,0 ,10 )); +/* or kernel_addr, %g1 */ +stl_be_p (p++,0x81c04000 );/* jmp %g1 */ +stl_be_p (p++,0x01000000 );/* nop */ }static void leon3_cpu_reset (void *opaque)
hw/sparc/sun4m.c +3 -3
@@ -268,9 +268,9 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,if (*initrd_size >0 ) {for (i =0 ; i <64 *TARGET_PAGE_SIZE ; i +=TARGET_PAGE_SIZE ) { ptr =rom_ptr (KERNEL_LOAD_ADDR + i,24 ); -if (ptr &&ldl_p (ptr) ==0x48647253 ) {/* HdrS */ -stl_p (ptr +16 ,INITRD_LOAD_ADDR ); -stl_p (ptr +20 , *initrd_size); +if (ptr &&ldl_be_p (ptr) ==0x48647253 ) {/* HdrS */ +stl_be_p (ptr +16 ,INITRD_LOAD_ADDR ); +stl_be_p (ptr +20 , *initrd_size);break ; } }
hw/sparc64/sun4u.c +3 -3
@@ -206,9 +206,9 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,if (*initrd_size >0 ) {for (i =0 ; i <64 *TARGET_PAGE_SIZE ; i +=TARGET_PAGE_SIZE ) { ptr =rom_ptr (*kernel_addr + i,32 ); -if (ptr &&ldl_p (ptr +8 ) ==0x48647253 ) {/* HdrS */ -stl_p (ptr +24 , *initrd_addr + *kernel_addr); -stl_p (ptr +28 , *initrd_size); +if (ptr &&ldl_be_p (ptr +8 ) ==0x48647253 ) {/* HdrS */ +stl_be_p (ptr +24 , *initrd_addr + *kernel_addr); +stl_be_p (ptr +28 , *initrd_size);break ; } }
Signature · 1 line
2.52.0
[PULL 55/61] target/tricore: Use little-endian variant of cpu_ld/st_data*()
In reply to Philippe Mathieu-DaudéWe only build the TriCore target using little endianness order, therefore the cpu_ld/st_data*() definitions expand to the little endian declarations. Use the explicit little-endian variants.
Mechanical change running:
$ tgt=tricore; \
end=le; \
for op in data mmuidx_ra; do \
for ac in uw sw l q; do \
sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
for ac in w l q; do \
sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
$(git grep -l cpu_ target/${tgt}/); \
done;
doneThen adapting spaces style manually to pass checkpatch.pl.
Message-ID: <[email protected]>
--- target/tricore/op_helper.c | 152 ++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 76 deletions(-)
target/tricore/op_helper.c +76 -76
@@ -2451,84 +2451,84 @@ static bool cdc_zero(uint32_t *psw)static void save_context_upper (CPUTriCoreState *env,uint32_t ea) { -cpu_stl_data (env, ea, env->PCXI); -cpu_stl_data (env, ea+4 ,psw_read (env)); -cpu_stl_data (env, ea+8 , env->gpr_a[10 ]); -cpu_stl_data (env, ea+12 , env->gpr_a[11 ]); -cpu_stl_data (env, ea+16 , env->gpr_d[8 ]); -cpu_stl_data (env, ea+20 , env->gpr_d[9 ]); -cpu_stl_data (env, ea+24 , env->gpr_d[10 ]); -cpu_stl_data (env, ea+28 , env->gpr_d[11 ]); -cpu_stl_data (env, ea+32 , env->gpr_a[12 ]); -cpu_stl_data (env, ea+36 , env->gpr_a[13 ]); -cpu_stl_data (env, ea+40 , env->gpr_a[14 ]); -cpu_stl_data (env, ea+44 , env->gpr_a[15 ]); -cpu_stl_data (env, ea+48 , env->gpr_d[12 ]); -cpu_stl_data (env, ea+52 , env->gpr_d[13 ]); -cpu_stl_data (env, ea+56 , env->gpr_d[14 ]); -cpu_stl_data (env, ea+60 , env->gpr_d[15 ]); +cpu_stl_le_data (env, ea, env->PCXI); +cpu_stl_le_data (env, ea +4 ,psw_read (env)); +cpu_stl_le_data (env, ea +8 , env->gpr_a[10 ]); +cpu_stl_le_data (env, ea +12 , env->gpr_a[11 ]); +cpu_stl_le_data (env, ea +16 , env->gpr_d[8 ]); +cpu_stl_le_data (env, ea +20 , env->gpr_d[9 ]); +cpu_stl_le_data (env, ea +24 , env->gpr_d[10 ]); +cpu_stl_le_data (env, ea +28 , env->gpr_d[11 ]); +cpu_stl_le_data (env, ea +32 , env->gpr_a[12 ]); +cpu_stl_le_data (env, ea +36 , env->gpr_a[13 ]); +cpu_stl_le_data (env, ea +40 , env->gpr_a[14 ]); +cpu_stl_le_data (env, ea +44 , env->gpr_a[15 ]); +cpu_stl_le_data (env, ea +48 , env->gpr_d[12 ]); +cpu_stl_le_data (env, ea +52 , env->gpr_d[13 ]); +cpu_stl_le_data (env, ea +56 , env->gpr_d[14 ]); +cpu_stl_le_data (env, ea +60 , env->gpr_d[15 ]); }static void save_context_lower (CPUTriCoreState *env,uint32_t ea) { -cpu_stl_data (env, ea, env->PCXI); -cpu_stl_data (env, ea+4 , env->gpr_a[11 ]); -cpu_stl_data (env, ea+8 , env->gpr_a[2 ]); -cpu_stl_data (env, ea+12 , env->gpr_a[3 ]); -cpu_stl_data (env, ea+16 , env->gpr_d[0 ]); -cpu_stl_data (env, ea+20 , env->gpr_d[1 ]); -cpu_stl_data (env, ea+24 , env->gpr_d[2 ]); -cpu_stl_data (env, ea+28 , env->gpr_d[3 ]); -cpu_stl_data (env, ea+32 , env->gpr_a[4 ]); -cpu_stl_data (env, ea+36 , env->gpr_a[5 ]); -cpu_stl_data (env, ea+40 , env->gpr_a[6 ]); -cpu_stl_data (env, ea+44 , env->gpr_a[7 ]); -cpu_stl_data (env, ea+48 , env->gpr_d[4 ]); -cpu_stl_data (env, ea+52 , env->gpr_d[5 ]); -cpu_stl_data (env, ea+56 , env->gpr_d[6 ]); -cpu_stl_data (env, ea+60 , env->gpr_d[7 ]); +cpu_stl_le_data (env, ea, env->PCXI); +cpu_stl_le_data (env, ea +4 , env->gpr_a[11 ]); +cpu_stl_le_data (env, ea +8 , env->gpr_a[2 ]); +cpu_stl_le_data (env, ea +12 , env->gpr_a[3 ]); +cpu_stl_le_data (env, ea +16 , env->gpr_d[0 ]); +cpu_stl_le_data (env, ea +20 , env->gpr_d[1 ]); +cpu_stl_le_data (env, ea +24 , env->gpr_d[2 ]); +cpu_stl_le_data (env, ea +28 , env->gpr_d[3 ]); +cpu_stl_le_data (env, ea +32 , env->gpr_a[4 ]); +cpu_stl_le_data (env, ea +36 , env->gpr_a[5 ]); +cpu_stl_le_data (env, ea +40 , env->gpr_a[6 ]); +cpu_stl_le_data (env, ea +44 , env->gpr_a[7 ]); +cpu_stl_le_data (env, ea +48 , env->gpr_d[4 ]); +cpu_stl_le_data (env, ea +52 , env->gpr_d[5 ]); +cpu_stl_le_data (env, ea +56 , env->gpr_d[6 ]); +cpu_stl_le_data (env, ea +60 , env->gpr_d[7 ]); }static void restore_context_upper (CPUTriCoreState *env,uint32_t ea,uint32_t *new_PCXI,uint32_t *new_PSW) { - *new_PCXI =cpu_ldl_data (env, ea); - *new_PSW =cpu_ldl_data (env, ea+4 ); - env->gpr_a[10 ] =cpu_ldl_data (env, ea+8 ); - env->gpr_a[11 ] =cpu_ldl_data (env, ea+12 ); - env->gpr_d[8 ] =cpu_ldl_data (env, ea+16 ); - env->gpr_d[9 ] =cpu_ldl_data (env, ea+20 ); - env->gpr_d[10 ] =cpu_ldl_data (env, ea+24 ); - env->gpr_d[11 ] =cpu_ldl_data (env, ea+28 ); - env->gpr_a[12 ] =cpu_ldl_data (env, ea+32 ); - env->gpr_a[13 ] =cpu_ldl_data (env, ea+36 ); - env->gpr_a[14 ] =cpu_ldl_data (env, ea+40 ); - env->gpr_a[15 ] =cpu_ldl_data (env, ea+44 ); - env->gpr_d[12 ] =cpu_ldl_data (env, ea+48 ); - env->gpr_d[13 ] =cpu_ldl_data (env, ea+52 ); - env->gpr_d[14 ] =cpu_ldl_data (env, ea+56 ); - env->gpr_d[15 ] =cpu_ldl_data (env, ea+60 ); + *new_PCXI =cpu_ldl_le_data (env, ea); + *new_PSW =cpu_ldl_le_data (env, ea +4 ); + env->gpr_a[10 ] =cpu_ldl_le_data (env, ea +8 ); + env->gpr_a[11 ] =cpu_ldl_le_data (env, ea +12 ); + env->gpr_d[8 ] =cpu_ldl_le_data (env, ea +16 ); + env->gpr_d[9 ] =cpu_ldl_le_data (env, ea +20 ); + env->gpr_d[10 ] =cpu_ldl_le_data (env, ea +24 ); + env->gpr_d[11 ] =cpu_ldl_le_data (env, ea +28 ); + env->gpr_a[12 ] =cpu_ldl_le_data (env, ea +32 ); + env->gpr_a[13 ] =cpu_ldl_le_data (env, ea +36 ); + env->gpr_a[14 ] =cpu_ldl_le_data (env, ea +40 ); + env->gpr_a[15 ] =cpu_ldl_le_data (env, ea +44 ); + env->gpr_d[12 ] =cpu_ldl_le_data (env, ea +48 ); + env->gpr_d[13 ] =cpu_ldl_le_data (env, ea +52 ); + env->gpr_d[14 ] =cpu_ldl_le_data (env, ea +56 ); + env->gpr_d[15 ] =cpu_ldl_le_data (env, ea +60 ); }static void restore_context_lower (CPUTriCoreState *env,uint32_t ea,uint32_t *ra,uint32_t *pcxi) { - *pcxi =cpu_ldl_data (env, ea); - *ra =cpu_ldl_data (env, ea+4 ); - env->gpr_a[2 ] =cpu_ldl_data (env, ea+8 ); - env->gpr_a[3 ] =cpu_ldl_data (env, ea+12 ); - env->gpr_d[0 ] =cpu_ldl_data (env, ea+16 ); - env->gpr_d[1 ] =cpu_ldl_data (env, ea+20 ); - env->gpr_d[2 ] =cpu_ldl_data (env, ea+24 ); - env->gpr_d[3 ] =cpu_ldl_data (env, ea+28 ); - env->gpr_a[4 ] =cpu_ldl_data (env, ea+32 ); - env->gpr_a[5 ] =cpu_ldl_data (env, ea+36 ); - env->gpr_a[6 ] =cpu_ldl_data (env, ea+40 ); - env->gpr_a[7 ] =cpu_ldl_data (env, ea+44 ); - env->gpr_d[4 ] =cpu_ldl_data (env, ea+48 ); - env->gpr_d[5 ] =cpu_ldl_data (env, ea+52 ); - env->gpr_d[6 ] =cpu_ldl_data (env, ea+56 ); - env->gpr_d[7 ] =cpu_ldl_data (env, ea+60 ); + *pcxi =cpu_ldl_le_data (env, ea); + *ra =cpu_ldl_le_data (env, ea +4 ); + env->gpr_a[2 ] =cpu_ldl_le_data (env, ea +8 ); + env->gpr_a[3 ] =cpu_ldl_le_data (env, ea +12 ); + env->gpr_d[0 ] =cpu_ldl_le_data (env, ea +16 ); + env->gpr_d[1 ] =cpu_ldl_le_data (env, ea +20 ); + env->gpr_d[2 ] =cpu_ldl_le_data (env, ea +24 ); + env->gpr_d[3 ] =cpu_ldl_le_data (env, ea +28 ); + env->gpr_a[4 ] =cpu_ldl_le_data (env, ea +32 ); + env->gpr_a[5 ] =cpu_ldl_le_data (env, ea +36 ); + env->gpr_a[6 ] =cpu_ldl_le_data (env, ea +40 ); + env->gpr_a[7 ] =cpu_ldl_le_data (env, ea +44 ); + env->gpr_d[4 ] =cpu_ldl_le_data (env, ea +48 ); + env->gpr_d[5 ] =cpu_ldl_le_data (env, ea +52 ); + env->gpr_d[6 ] =cpu_ldl_le_data (env, ea +56 ); + env->gpr_d[7 ] =cpu_ldl_le_data (env, ea +60 ); }void helper_call (CPUTriCoreState *env,uint32_t next_pc)
@@ -2566,7 +2566,7 @@ void helper_call(CPUTriCoreState *env, uint32_t next_pc) ea = ((env->FCX &MASK_FCX_FCXS ) <<12 ) + ((env->FCX &MASK_FCX_FCXO ) <<6 );/* new_FCX = M(EA, word); */ - new_FCX =cpu_ldl_data (env, ea); + new_FCX =cpu_ldl_le_data (env, ea);/* M(EA, 16 * word) = {PCXI, PSW, A[10], A[11], D[8], D[9], D[10], D[11], A[12], A[13], A[14], A[15], D[12], D[13], D[14], D[15]}; */
@@ -2632,7 +2632,7 @@ void helper_ret(CPUTriCoreState *env)A[13], A[14], A[15], D[12], D[13], D[14], D[15]} = M(EA, 16 * word); */ restore_context_upper (env, ea, &new_PCXI, &new_PSW);/* M(EA, word) = FCX; */ -cpu_stl_data (env, ea, env->FCX); +cpu_stl_le_data (env, ea, env->FCX);/* FCX[19: 0] = PCXI[19: 0]; */ env->FCX = (env->FCX &0xfff00000 ) + (env->PCXI &0x000fffff );/* PCXI = new_PCXI; */
@@ -2662,7 +2662,7 @@ void helper_bisr(CPUTriCoreState *env, uint32_t const9) ea = ((env->FCX &0xf0000 ) <<12 ) + ((env->FCX &0xffff ) <<6 );/* new_FCX = M(EA, word); */ - new_FCX =cpu_ldl_data (env, ea); + new_FCX =cpu_ldl_le_data (env, ea);/* M(EA, 16 * word) = {PCXI, A[11], A[2], A[3], D[0], D[1], D[2], D[3], A[4] , A[5], A[6], A[7], D[4], D[5], D[6], D[7]}; */ save_context_lower (env, ea);
@@ -2726,7 +2726,7 @@ void helper_rfe(CPUTriCoreState *env)A[13], A[14], A[15], D[12], D[13], D[14], D[15]} = M(EA, 16 * word); */ restore_context_upper (env, ea, &new_PCXI, &new_PSW);/* M(EA, word) = FCX;*/ -cpu_stl_data (env, ea, env->FCX); +cpu_stl_le_data (env, ea, env->FCX);/* FCX[19: 0] = PCXI[19: 0]; */ env->FCX = (env->FCX &0xfff00000 ) + (env->PCXI &0x000fffff );/* PCXI = new_PCXI; */
@@ -2744,10 +2744,10 @@ void helper_rfm(CPUTriCoreState *env)icr_set_ccpn (env,pcxi_get_pcpn (env));/* {PCXI, PSW, A[10], A[11]} = M(DCX, 4 * word); */ - env->PCXI =cpu_ldl_data (env, env->DCX); -psw_write (env,cpu_ldl_data (env, env->DCX+4 )); - env->gpr_a[10 ] =cpu_ldl_data (env, env->DCX+8 ); - env->gpr_a[11 ] =cpu_ldl_data (env, env->DCX+12 ); + env->PCXI =cpu_ldl_le_data (env, env->DCX); +psw_write (env,cpu_ldl_le_data (env, env->DCX +4 )); + env->gpr_a[10 ] =cpu_ldl_le_data (env, env->DCX +8 ); + env->gpr_a[11 ] =cpu_ldl_le_data (env, env->DCX +12 );if (tricore_has_feature (env,TRICORE_FEATURE_131 )) { env->DBGTCR =0 ;
@@ -2794,7 +2794,7 @@ void helper_svlcx(CPUTriCoreState *env) ea = ((env->FCX &MASK_FCX_FCXS ) <<12 ) + ((env->FCX &MASK_FCX_FCXO ) <<6 );/* new_FCX = M(EA, word); */ - new_FCX =cpu_ldl_data (env, ea); + new_FCX =cpu_ldl_le_data (env, ea);/* M(EA, 16 * word) = {PCXI, PSW, A[10], A[11], D[8], D[9], D[10], D[11], A[12], A[13], A[14], A[15], D[12], D[13], D[14], D[15]}; */
@@ -2837,7 +2837,7 @@ void helper_svucx(CPUTriCoreState *env) ea = ((env->FCX &MASK_FCX_FCXS ) <<12 ) + ((env->FCX &MASK_FCX_FCXO ) <<6 );/* new_FCX = M(EA, word); */ - new_FCX =cpu_ldl_data (env, ea); + new_FCX =cpu_ldl_le_data (env, ea);/* M(EA, 16 * word) = {PCXI, PSW, A[10], A[11], D[8], D[9], D[10], D[11], A[12], A[13], A[14], A[15], D[12], D[13], D[14], D[15]}; */
@@ -2887,9 +2887,9 @@ void helper_rslcx(CPUTriCoreState *env)A[13], A[14], A[15], D[12], D[13], D[14], D[15]} = M(EA, 16 * word); */ restore_context_lower (env, ea, &env->gpr_a[11 ], &new_PCXI);/* M(EA, word) = FCX; */ -cpu_stl_data (env, ea, env->FCX); +cpu_stl_le_data (env, ea, env->FCX);/* M(EA, word) = FCX; */ -cpu_stl_data (env, ea, env->FCX); +cpu_stl_le_data (env, ea, env->FCX);/* FCX[19: 0] = PCXI[19: 0]; */ env->FCX = (env->FCX &0xfff00000 ) + (env->PCXI &0x000fffff );/* PCXI = new_PCXI; */
Signature · 1 line
2.52.0
[PULL 59/61] gdbstub/helpers.h: allow header to be called from common code
In reply to Philippe Mathieu-DaudéFrom: Pierrick Bouvier <[email protected]>
Target specific variants can't be used in common code, thus limit their definition to COMPILING_PER_TARGET.
Message-ID: <[email protected]>
--- include/gdbstub/helpers.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/gdbstub/helpers.h +5 -4
@@ -12,13 +12,12 @@#ifndef _GDBSTUB_HELPERS_H_#define _GDBSTUB_HELPERS_H_ -#ifndef COMPILING_PER_TARGET -#error "gdbstub helpers should only be included by target specific code" -#endif -#include "qemu/bswap.h" #include "qemu/target-info.h" + +#ifdef COMPILING_PER_TARGET #include "cpu-param.h" +#endif /* * The GDB remote protocol transfers values in target byte order. As
@@ -102,6 +101,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)return buf->data + buf->len - len; } +#ifdef COMPILING_PER_TARGET #if TARGET_LONG_BITS ==64 #define gdb_get_regl (buf, val) gdb_get_reg64(buf, val)#define ldtul_p (addr) ldq_p(addr)
@@ -113,5 +113,6 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)#define ldtul_le_p (addr) ldl_le_p(addr)#define ldtul_be_p (addr) ldl_be_p(addr)#endif +#endif /* COMPILING_PER_TARGET */ #endif /* _GDBSTUB_HELPERS_H_ */
Signature · 1 line
2.52.0
[PULL 57/61] target/tricore: Build system units in common source set
In reply to Philippe Mathieu-DaudéSince commit range 809b460f305..cd08bcaa36b we remove all uses of the target_ulong type in target/rx/. Use the meson target_common_system_arch[] source set to prevent further uses of target-specific types.
Message-ID: <[email protected]>
--- target/tricore/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/tricore/meson.build +1 -1
@@ -12,4 +12,4 @@ tricore_ss.add(zlib) tricore_system_ss = ss.source_set() target_arch += {'tricore': tricore_ss} -target_system_arch += {'tricore': tricore_system_ss} +target_common_system_arch += {'tricore': tricore_system_ss}
Signature · 1 line
2.52.0
[PULL 56/61] target/tricore: Inline translator_lduw()
In reply to Philippe Mathieu-Daudétranslator_lduw() is defined in "exec/translator.h" as:
192 static inline uint16_t
193 translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) 194 {
195 return translator_lduw_end(env, db, pc, MO_TE);
196 }
Directly use the inlined form, expanding MO_TE -> MO_LE since we only build the TriCore target as little-endian.
Message-ID: <[email protected]>
--- target/tricore/translate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
target/tricore/translate.c +5 -4
@@ -8422,7 +8422,8 @@ static bool insn_crosses_page(DisasContext *ctx, CPUTriCoreState *env)* 4 bytes from the page boundary, so we cross the page if the first * 16 bits indicate that this is a 32 bit insn. */ -uint16_t insn =translator_lduw (env, &ctx->base, ctx->base.pc_next); +uint16_t insn =translator_lduw_end (env, &ctx->base, ctx->base.pc_next, +MO_LE );return !tricore_insn_is_16bit (insn); }
@@ -8435,15 +8436,15 @@ static void tricore_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)uint16_t insn_lo;bool is_16bit; - insn_lo =translator_lduw (env, &ctx->base, ctx->base.pc_next); + insn_lo =translator_lduw_end (env, &ctx->base, ctx->base.pc_next,MO_LE ); is_16bit =tricore_insn_is_16bit (insn_lo);if (is_16bit) { ctx->opcode = insn_lo; ctx->pc_succ_insn = ctx->base.pc_next +2 ;decode_16Bit_opc (ctx); }else { -uint32_t insn_hi =translator_lduw (env, &ctx->base, - ctx->base.pc_next +2 ); +uint32_t insn_hi =translator_lduw_end (env, &ctx->base, + ctx->base.pc_next +2 ,MO_LE ); ctx->opcode = insn_hi <<16 | insn_lo; ctx->pc_succ_insn = ctx->base.pc_next +4 ;decode_32Bit_opc (ctx);
Signature · 1 line
2.52.0
[PULL 60/61] target/arm/gdbstub: extract aarch64_cpu_register_gdb_regs_for_features
In reply to Philippe Mathieu-DaudéFrom: Pierrick Bouvier <[email protected]>
Message-ID: <[email protected]>
--- target/arm/internals.h | 1 + target/arm/gdbstub.c | 53 +-------------------------------------- target/arm/gdbstub64.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 52 deletions(-)
target/arm/internals.h +1 -0
@@ -387,6 +387,7 @@ void arm_translate_code(CPUState *cs, TranslationBlock *tb,void arm_cpu_register_gdb_commands (ARMCPU *cpu);void aarch64_cpu_register_gdb_commands (ARMCPU *cpu,GString *,GPtrArray *,GPtrArray *); +void aarch64_cpu_register_gdb_regs_for_features (ARMCPU *cpu); void arm_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb,
target/arm/gdbstub.c +1 -52
59 lines not on this page · raw message
target/arm/gdbstub64.c +57 -0
60 lines not on this page · raw message
Signature · 1 line
2.52.0
[PULL 61/61] target/arm/gdbstub: make compilation unit common
In reply to Philippe Mathieu-DaudéFrom: Pierrick Bouvier <[email protected]>
Expose and stubs aarch64 functions. All call sites are under a "is_aarch64" check.
Message-ID: <[email protected]>
--- target/arm/cpu32-stubs.c | 21 +++++++++++++++++++++ target/arm/gdbstub.c | 8 -------- target/arm/meson.build | 12 ++++++------ 3 files changed, 27 insertions(+), 14 deletions(-)
target/arm/cpu32-stubs.c +21 -0
@@ -24,3 +24,24 @@ void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) {g_assert_not_reached (); } + +int aarch64_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg) +{ +g_assert_not_reached (); +} + +int aarch64_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg) +{ +g_assert_not_reached (); +} + +void aarch64_cpu_register_gdb_commands (ARMCPU *cpu,GString *qsupported, +GPtrArray *qtable,GPtrArray *stable) +{ +g_assert_not_reached (); +} + +void aarch64_cpu_register_gdb_regs_for_features (ARMCPU *cpu) +{ +g_assert_not_reached (); +}
target/arm/gdbstub.c +0 -8
@@ -44,11 +44,9 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env; -#ifdef TARGET_AARCH64 if (arm_gdbstub_is_aarch64 (cpu)) {return aarch64_cpu_gdb_read_register (cs, mem_buf, n); } -#endif if (n <16 ) {/* Core integer register. */
@@ -72,11 +70,9 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)CPUARMState *env = &cpu->env;uint32_t tmp; -#ifdef TARGET_AARCH64 if (arm_gdbstub_is_aarch64 (cpu)) {return aarch64_cpu_gdb_write_register (cs, mem_buf, n); } -#endif tmp =ldl_p (mem_buf);
@@ -504,10 +500,8 @@ void arm_cpu_register_gdb_commands(ARMCPU *cpu)g_autoptr (GString) qsupported_features =g_string_new (NULL );if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { -#ifdef TARGET_AARCH64 aarch64_cpu_register_gdb_commands (cpu, qsupported_features, query_table, set_table); -#endif }/* Set arch-specific handlers for 'q' commands. */
@@ -536,9 +530,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)* The lower part of each SVE register aliases to the FPU * registers so we don't need to include both. */ -#ifdef TARGET_AARCH64 aarch64_cpu_register_gdb_regs_for_features (cpu); -#endif }else {if (arm_feature (env,ARM_FEATURE_NEON )) { gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg,
target/arm/meson.build +6 -6
@@ -1,8 +1,11 @@ arm_ss = ss.source_set() arm_common_ss = ss.source_set() -arm_ss.add(files( - 'gdbstub.c', -)) +arm_common_system_ss = ss.source_set() +arm_system_ss = ss.source_set() +arm_user_ss = ss.source_set() + +arm_common_system_ss.add(files('gdbstub.c')) +arm_user_ss.add(files('gdbstub.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c',
@@ -13,15 +16,12 @@ arm_common_ss.add(files( 'mmuidx.c', )) -arm_system_ss = ss.source_set() -arm_common_system_ss = ss.source_set() arm_system_ss.add(files( 'arm-qmp-cmds.c', )) arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c')) arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c')) -arm_user_ss = ss.source_set() arm_user_ss.add(files('cpu.c')) arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files( 'cpu32-stubs.c',
Signature · 1 line
2.52.0
[PULL 58/61] accel/tcg: Un-inline WatchPoint API user-emulation stubs
In reply to Philippe Mathieu-DaudéCurrently we can not build files including "exec/watchpoint.h" as meson common objects because the CONFIG_USER_ONLY definition is poisoned. We can easily fix that by un-inlining the user-emulation stubs.
Message-ID: <[email protected]>
--- include/accel/tcg/cpu-ops.h | 17 ----------------- include/exec/watchpoint.h | 23 ----------------------- accel/tcg/user-exec-stub.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 40 deletions(-)
include/accel/tcg/cpu-ops.h +0 -17
@@ -281,21 +281,6 @@ struct TCGCPUOps {#endif /* !CONFIG_USER_ONLY */ }; -#if defined(CONFIG_USER_ONLY ) - -static inline void cpu_check_watchpoint (CPUState *cpu,vaddr addr,vaddr len, -MemTxAttrs atr,int fl,uintptr_t ra) -{ -} - -static inline int cpu_watchpoint_address_matches (CPUState *cpu, -vaddr addr,vaddr len) -{ -return 0 ; -} - -#else -/** * cpu_check_watchpoint: * @cpu: cpu context
@@ -328,6 +313,4 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);vaddr cpu_pointer_wrap_notreached (CPUState *,int ,vaddr ,vaddr );vaddr cpu_pointer_wrap_uint32 (CPUState *,int ,vaddr ,vaddr ); -#endif -#endif /* TCG_CPU_OPS_H */
include/exec/watchpoint.h +0 -23
@@ -8,34 +8,11 @@#ifndef EXEC_WATCHPOINT_H #define EXEC_WATCHPOINT_H -#if defined(CONFIG_USER_ONLY ) -static inline int cpu_watchpoint_insert (CPUState *cpu,vaddr addr,vaddr len, -int flags,CPUWatchpoint **watchpoint) -{ -return -ENOSYS ; -} - -static inline int cpu_watchpoint_remove (CPUState *cpu,vaddr addr, -vaddr len,int flags) -{ -return -ENOSYS ; -} - -static inline void cpu_watchpoint_remove_by_ref (CPUState *cpu, -CPUWatchpoint *wp) -{ -} - -static inline void cpu_watchpoint_remove_all (CPUState *cpu,int mask) -{ -} -#else int cpu_watchpoint_insert (CPUState *cpu,vaddr addr,vaddr len,int flags,CPUWatchpoint **watchpoint);int cpu_watchpoint_remove (CPUState *cpu,vaddr addr,vaddr len,int flags);void cpu_watchpoint_remove_by_ref (CPUState *cpu,CPUWatchpoint *watchpoint);void cpu_watchpoint_remove_all (CPUState *cpu,int mask); -#endif #endif /* EXEC_WATCHPOINT_H */
accel/tcg/user-exec-stub.c +33 -0
@@ -1,6 +1,8 @@#include "qemu/osdep.h" #include "hw/core/cpu.h" +#include "accel/tcg/cpu-ops.h" #include "exec/replay-core.h" +#include "exec/watchpoint.h" #include "internal-common.h" void cpu_resume (CPUState *cpu)
@@ -19,6 +21,37 @@ void cpu_exec_reset_hold(CPUState *cpu) { } +int cpu_watchpoint_insert (CPUState *cpu,vaddr addr,vaddr len, +int flags,CPUWatchpoint **watchpoint) +{ +return -ENOSYS ; +} + +int cpu_watchpoint_remove (CPUState *cpu,vaddr addr, +vaddr len,int flags) +{ +return -ENOSYS ; +} + +void cpu_watchpoint_remove_by_ref (CPUState *cpu,CPUWatchpoint *wp) +{ +} + +void cpu_watchpoint_remove_all (CPUState *cpu,int mask) +{ +} + +int cpu_watchpoint_address_matches (CPUState *cpu,vaddr addr,vaddr len) +{ +return 0 ; +} + +void cpu_check_watchpoint (CPUState *cpu,vaddr addr,vaddr len, +MemTxAttrs atr,int fl,uintptr_t ra) +{ +} + +/* User mode emulation does not support softmmu yet. */ void tlb_init (CPUState *cpu)
Signature · 1 line
2.52.0
[PULL 53/61] target/sparc: Inline translator_ldl()
In reply to Philippe Mathieu-Daudétranslator_ldl() is defined in "exec/translator.h" as:
198 static inline uint32_t
199 translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc)
200 {
201 return translator_ldl_end(env, db, pc, MO_TE);
202 }Directly use the inlined form, expanding MO_TE -> MO_BE since we only build the SPARC targets as big-endian.
Message-ID: <[email protected]>
--- target/sparc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/translate.c +1 -1
@@ -5743,7 +5743,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)DisasContext *dc =container_of (dcbase, DisasContext, base);unsigned int insn; - insn =translator_ldl (cpu_env (cs), &dc->base, dc->pc); + insn =translator_ldl_end (cpu_env (cs), &dc->base, dc->pc,MO_BE ); dc->base.pc_next +=4 ;if (!decode (dc, insn)) {
Signature · 1 line
2.52.0
Richard Henderson
AppliedQuoted 10 lines · Philippe Mathieu-Daudé
The following changes since commit
81f1fc471c053c9d3915c3e1f8b37503bd9a9cb7:Merge tag 'pull-loongarch-20260112' ofhttps://github.com/bibo-mao/qemu into staging (2026-01-13 08:23:10 +1100)are available in the Git repository at:
https://github.com/philmd/qemu.git tags/single-binary-20260112for you to fetch changes up to
f445b4a4b6fa5b03503bc8fdfa4c336e13afc48f:
Quoted 8 lines
target/arm/gdbstub: make compilation unit common (2026-01-12 23:47:57 +0100)----------------------------------------------------------------
Various patches related to single binary effort:- Endianness cleanups in memory core subsystem and for various targets
- Few cleanups aroundtarget_ulongtype
- Build various compilation units as common
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/11.0 as appropriate.
r~