target/arm: Remove unnecessary gen_io_end() calls
PATCH 1/1 target/arm: Remove unnecessary gen_io_end() calls
Since commit ba3e7926691ed3 it has been unnecessary for target code to call gen_io_end() after an IO instruction in icount mode; it is sufficient to call gen_io_start() before it and to force the end of the TB.
Many now-unnecessary calls to gen_io_end() were removed in commit 9e9b10c6491153b, but some were missed or accidentally added later. Remove unneeded calls from the arm target:
* the call in the handling of exception-return-via-LDM is unnecessary, and the code is already forcing end-of-TB
* the call in the VFP access check code is more complicated:
we weren't ending the TB, so we need to add the code to force that by setting DISAS_UPDATE
* the doc comment for ARM_CP_IO doesn't need to mention gen_io_end() any more
--- target/arm/cpu.h | 2 +- target/arm/translate-vfp.inc.c | 7 +++---- target/arm/translate.c | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-)
target/arm/cpu.h +1 -1
@@ -2334,7 +2334,7 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)* migration or KVM state synchronization. (Typically this is for "registers" * which are actually used as instructions for cache maintenance and so on.) * IO indicates that this register does I/O and therefore its accesses -* need to be surrounded by gen_io_start()/gen_io_end(). In particular, +* need to be marked with gen_io_start() and also end the TB. In particular, * registers which implement clocks or timers require this. * RAISES_EXC is for when the read or write hook might raise an exception; * the generated code will synchronize the CPU state before calling the hook
target/arm/translate-vfp.inc.c +3 -4
@@ -119,15 +119,14 @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)if (s->v7m_lspact) {/* * Lazy state saving affects external memory and also the NVIC, -* so we must mark it as an IO operation for icount. +* so we must mark it as an IO operation for icount (and cause +* this to be the last insn in the TB). */ if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { + s->base.is_jmp =DISAS_UPDATE ;gen_io_start (); }gen_helper_v7m_preserve_fp_state (cpu_env); -if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { -gen_io_end (); - }/* * If the preserve_fp_state helper doesn't throw an exception * then it will clear LSPACT; we don't need to repeat this for
target/arm/translate.c +0 -3
@@ -8824,9 +8824,6 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)gen_io_start (); }gen_helper_cpsr_write_eret (cpu_env, tmp); -if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { -gen_io_end (); - }tcg_temp_free_i32 (tmp);/* Must exit loop to check un-masked IRQs */ s->base.is_jmp =DISAS_EXIT ;
Signature · 1 line
2.20.1
Quoted 9 lines · Peter Maydell
Since commit
ba3e7926691ed3it has been unnecessary for target code to callgen_io_end()after an IO instruction in icount mode; it is sufficient to callgen_io_start()before it and to force the end of the TB.Many now-unnecessary calls to
gen_io_end()were removed in commit9e9b10c6491153b, but some were missed or accidentally added later. Remove unneeded calls from the arm target:
Quoted 5 lines
* the call in the handling of exception-return-via-LDM is unnecessary, and the code is already forcing end-of-TB
* the call in the VFP access check code is more complicated:
we weren't ending the TB, so we need to add the code to force that by settingDISAS_UPDATE
That was the thing I was staring at trying to puzzle out.
I guess going forward we want to base the base DisasContext to gen_io_start so we can flip a bit and then assert we don't start a new instruction having already handled an IO instruction which should have been the last one.
Quoted 4 lines
* the doc comment for
ARM_CP_IOdoesn't need to mentiongen_io_end()any moreSigned-off-by Peter Maydell <[email protected]>
Signature · 1 line
Alex Bennée
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END ===
CC qga/qapi-generated/qga-qapi-types.o CC qga/qapi-generated/qga-qapi-visit.o CC qga/qapi-generated/qga-qapi-commands.o /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) CC qga/qapi-generated/qga-qapi-init-commands.o AR libqemuutil.a LINK elf2dmp --- GEN docs/interop/qemu-ga-ref.html GEN docs/interop/qemu-ga-ref.txt GEN docs/interop/qemu-ga-ref.7
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-keymap/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK ivshmem-client
LINK ivshmem-server/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-nbd
LINK qemu-storage-daemon/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-img AS pc-bios/optionrom/multiboot.o AS pc-bios/optionrom/linuxboot.o /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) CC pc-bios/optionrom/linuxboot_dma.o LINK qemu-io AS pc-bios/optionrom/kvmvapic.o /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) AS pc-bios/optionrom/pvh.o LINK qemu-edid CC pc-bios/optionrom/pvh_main.o --- BUILD pc-bios/optionrom/linuxboot.raw LINK fsdev/virtfs-proxy-helper BUILD pc-bios/optionrom/linuxboot_dma.raw /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) BUILD pc-bios/optionrom/kvmvapic.raw BUILD pc-bios/optionrom/pvh.img SIGN pc-bios/optionrom/multiboot.bin SIGN pc-bios/optionrom/linuxboot.bin SIGN pc-bios/optionrom/linuxboot_dma.bin /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) SIGN pc-bios/optionrom/kvmvapic.bin BUILD pc-bios/optionrom/pvh.raw LINK scsi/qemu-pr-helper SIGN pc-bios/optionrom/pvh.bin LINK qemu-bridge-helper
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) /usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK virtiofsd/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK vhost-user-input/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-ga/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
GEN x86_64-softmmu/config-devices.h GEN x86_64-softmmu/hmp-commands.h GEN x86_64-softmmu/hmp-commands-info.h --- CC x86_64-softmmu/gdbstub-xml.o CC x86_64-softmmu/trace/generated-helpers.o LINK x86_64-softmmu/qemu-system-x86_64
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o) common.rc: line 50: test: check: binary operator expected
(printf '#define QEMU_PKGVERSION ""\n'; printf '#define QEMU_FULL_VERSION "5.0.50"\n'; ) > qemu-version.h.tmp
make -C /tmp/qemu-test/src/slirp BUILD_DIR="/tmp/qemu-test/build/slirp" PKG_CONFIG="pkg-config" CC="clang" AR="ar" LD="ld" RANLIB="ranlib" CFLAGS="-I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -I/tmp/qemu-test/src/tests -I/tmp/qemu-test/src/tests/qtest -g " LDFLAGS="-Wl,--warn-common -fsanitize=undefined -fsanitize=address -Wl,-z,relro -Wl,-z,now -pie -m64 -fstack-protector-strong"
---
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT verCases_common.o -MF ./verCases_common.d -g -c -o verCases_common.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/verCases_common.c
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT verCases_writeFunctionName.o -MF ./verCases_writeFunctionName.d -g -c -o verCases_writeFunctionName.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/verCases_writeFunctionName.c
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT readHex.o -MF ./readHex.d -g -c -o readHex.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/readHex.c/tmp/qemu-test/src/tests/qht-bench.c:287:29: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
*threshold = rate * UINT64_MAX;
~ ^~~~~~~~~~/usr/include/stdint.h:130:23: note: expanded from macro 'UINT64_MAX'
---
18446744073709551615UL
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: tests/qht-bench.o] Error 1
make: *** Waiting for unfinished jobs....
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT writeHex.o -MF ./writeHex.d -g -c -o writeHex.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/writeHex.c
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -I/usr/include/p11-kit-1 -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT writeCase_a_ui32.o -MF ./writeCase_a_ui32.d -g -c -o writeCase_a_ui32.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/writeCase_a_ui32.c
---
rm -f libtestfloat.a && ar rcs libtestfloat.a uint128_inline.o uint128.o fail.o functions_common.o functionInfos.o standardFunctionInfos.o random.o genCases_common.o genCases_ui32.o genCases_ui64.o genCases_i32.o genCases_i64.o genCases_f16.o genCases_f32.o genCases_f64.o genCases_extF80.o genCases_f128.o genCases_writeTestsTotal.o verCases_inline.o verCases_common.o verCases_writeFunctionName.o readHex.o writeHex.o writeCase_a_ui32.o writeCase_a_ui64.o writeCase_a_f16.o writeCase_ab_f16.o writeCase_abc_f16.o writeCase_a_f32.o writeCase_ab_f32.o writeCase_abc_f32.o writeCase_a_f64.o writeCase_ab_f64.o writeCase_abc_f64.o writeCase_a_extF80M.o writeCase_ab_extF80M.o writeCase_a_f128M.o writeCase_ab_f128M.o writeCase_abc_f128M.o writeCase_z_bool.o writeCase_z_ui32.o writeCase_z_ui64.o writeCase_z_f16.o writeCase_z_f32.o writeCase_z_f64.o writeCase_z_extF80M.o writeCase_z_f128M.o testLoops_common.o test_a_ui32_z_f16.o test_a_ui32_z_f32.o test_a_ui32_z_f64.o test_a_ui32_z_extF80.o test_a_ui32_z_f128.o test_a_ui64_z_f16.o test_a_ui64_z_f32.o test_a_ui64_z_f64.o test_a_ui64_z_extF80.o test_a_ui64_z_f128.o test_a_i32_z_f16.o test_a_i32_z_f32.o test_a_i32_z_f64.o test_a_i32_z_extF80.o test_a_i32_z_f128.o test_a_i64_z_f16.o test_a_i64_z_f32.o test_a_i64_z_f64.o test_a_i64_z_extF80.o test_a_i64_z_f128.o test_a_f16_z_ui32_rx.o test_a_f16_z_ui64_rx.o test_a_f16_z_i32_rx.o test_a_f16_z_i64_rx.o test_a_f16_z_ui32_x.o test_a_f16_z_ui64_x.o test_a_f16_z_i32_x.o test_a_f16_z_i64_x.o test_a_f16_z_f32.o test_a_f16_z_f64.o test_a_f16_z_extF80.o test_a_f16_z_f128.o test_az_f16.o test_az_f16_rx.o test_abz_f16.o test_abcz_f16.o test_ab_f16_z_bool.o test_a_f32_z_ui32_rx.o test_a_f32_z_ui64_rx.o test_a_f32_z_i32_rx.o test_a_f32_z_i64_rx.o test_a_f32_z_ui32_x.o test_a_f32_z_ui64_x.o test_a_f32_z_i32_x.o test_a_f32_z_i64_x.o test_a_f32_z_f16.o test_a_f32_z_f64.o test_a_f32_z_extF80.o test_a_f32_z_f128.o test_az_f32.o test_az_f32_rx.o test_abz_f32.o test_abcz_f32.o test_ab_f32_z_bool.o test_a_f64_z_ui32_rx.o test_a_f64_z_ui64_rx.o test_a_f64_z_i32_rx.o test_a_f64_z_i64_rx.o test_a_f64_z_ui32_x.o test_a_f64_z_ui64_x.o test_a_f64_z_i32_x.o test_a_f64_z_i64_x.o test_a_f64_z_f16.o test_a_f64_z_f32.o test_a_f64_z_extF80.o test_a_f64_z_f128.o test_az_f64.o test_az_f64_rx.o test_abz_f64.o test_abcz_f64.o test_ab_f64_z_bool.o test_a_extF80_z_ui32_rx.o test_a_extF80_z_ui64_rx.o test_a_extF80_z_i32_rx.o test_a_extF80_z_i64_rx.o test_a_extF80_z_ui32_x.o test_a_extF80_z_ui64_x.o test_a_extF80_z_i32_x.o test_a_extF80_z_i64_x.o test_a_extF80_z_f16.o test_a_extF80_z_f32.o test_a_extF80_z_f64.o test_a_extF80_z_f128.o test_az_extF80.o test_az_extF80_rx.o test_abz_extF80.o test_ab_extF80_z_bool.o test_a_f128_z_ui32_rx.o test_a_f128_z_ui64_rx.o test_a_f128_z_i32_rx.o test_a_f128_z_i64_rx.o test_a_f128_z_ui32_x.o test_a_f128_z_ui64_x.o test_a_f128_z_i32_x.o test_a_f128_z_i64_x.o test_a_f128_z_f16.o test_a_f128_z_f32.o test_a_f128_z_f64.o test_a_f128_z_extF80.o test_az_f128.o test_az_f128_rx.o test_abz_f128.o test_abcz_f128.o test_ab_f128_z_bool.o
rm -f libsoftfloat.a && ar rcs libsoftfloat.a s_eq128.o s_le128.o s_lt128.o s_shortShiftLeft128.o s_shortShiftRight128.o s_shortShiftRightJam64.o s_shortShiftRightJam64Extra.o s_shortShiftRightJam128.o s_shortShiftRightJam128Extra.o s_shiftRightJam32.o s_shiftRightJam64.o s_shiftRightJam64Extra.o s_shiftRightJam128.o s_shiftRightJam128Extra.o s_shiftRightJam256M.o s_countLeadingZeros8.o s_countLeadingZeros16.o s_countLeadingZeros32.o s_countLeadingZeros64.o s_add128.o s_add256M.o s_sub128.o s_sub256M.o s_mul64ByShifted32To128.o s_mul64To128.o s_mul128By32.o s_mul128To256M.o s_approxRecip_1Ks.o s_approxRecip32_1.o s_approxRecipSqrt_1Ks.o s_approxRecipSqrt32_1.o s_roundToUI32.o s_roundToUI64.o s_roundToI32.o s_roundToI64.o s_normSubnormalF16Sig.o s_roundPackToF16.o s_normRoundPackToF16.o s_addMagsF16.o s_subMagsF16.o s_mulAddF16.o s_normSubnormalF32Sig.o s_roundPackToF32.o s_normRoundPackToF32.o s_addMagsF32.o s_subMagsF32.o s_mulAddF32.o s_normSubnormalF64Sig.o s_roundPackToF64.o s_normRoundPackToF64.o s_addMagsF64.o s_subMagsF64.o s_mulAddF64.o s_normSubnormalExtF80Sig.o s_roundPackToExtF80.o s_normRoundPackToExtF80.o s_addMagsExtF80.o s_subMagsExtF80.o s_normSubnormalF128Sig.o s_roundPackToF128.o s_normRoundPackToF128.o s_addMagsF128.o s_subMagsF128.o s_mulAddF128.o softfloat_state.o ui32_to_f16.o ui32_to_f32.o ui32_to_f64.o ui32_to_extF80.o ui32_to_extF80M.o ui32_to_f128.o ui32_to_f128M.o ui64_to_f16.o ui64_to_f32.o ui64_to_f64.o ui64_to_extF80.o ui64_to_extF80M.o ui64_to_f128.o ui64_to_f128M.o i32_to_f16.o i32_to_f32.o i32_to_f64.o i32_to_extF80.o i32_to_extF80M.o i32_to_f128.o i32_to_f128M.o i64_to_f16.o i64_to_f32.o i64_to_f64.o i64_to_extF80.o i64_to_extF80M.o i64_to_f128.o i64_to_f128M.o f16_to_ui32.o f16_to_ui64.o f16_to_i32.o f16_to_i64.o f16_to_ui32_r_minMag.o f16_to_ui64_r_minMag.o f16_to_i32_r_minMag.o f16_to_i64_r_minMag.o f16_to_f32.o f16_to_f64.o f16_to_extF80.o f16_to_extF80M.o f16_to_f128.o f16_to_f128M.o f16_roundToInt.o f16_add.o f16_sub.o f16_mul.o f16_mulAdd.o f16_div.o f16_rem.o f16_sqrt.o f16_eq.o f16_le.o f16_lt.o f16_eq_signaling.o f16_le_quiet.o f16_lt_quiet.o f16_isSignalingNaN.o f32_to_ui32.o f32_to_ui64.o f32_to_i32.o f32_to_i64.o f32_to_ui32_r_minMag.o f32_to_ui64_r_minMag.o f32_to_i32_r_minMag.o f32_to_i64_r_minMag.o f32_to_f16.o f32_to_f64.o f32_to_extF80.o f32_to_extF80M.o f32_to_f128.o f32_to_f128M.o f32_roundToInt.o f32_add.o f32_sub.o f32_mul.o f32_mulAdd.o f32_div.o f32_rem.o f32_sqrt.o f32_eq.o f32_le.o f32_lt.o f32_eq_signaling.o f32_le_quiet.o f32_lt_quiet.o f32_isSignalingNaN.o f64_to_ui32.o f64_to_ui64.o f64_to_i32.o f64_to_i64.o f64_to_ui32_r_minMag.o f64_to_ui64_r_minMag.o f64_to_i32_r_minMag.o f64_to_i64_r_minMag.o f64_to_f16.o f64_to_f32.o f64_to_extF80.o f64_to_extF80M.o f64_to_f128.o f64_to_f128M.o f64_roundToInt.o f64_add.o f64_sub.o f64_mul.o f64_mulAdd.o f64_div.o f64_rem.o f64_sqrt.o f64_eq.o f64_le.o f64_lt.o f64_eq_signaling.o f64_le_quiet.o f64_lt_quiet.o f64_isSignalingNaN.o extF80_to_ui32.o extF80_to_ui64.o extF80_to_i32.o extF80_to_i64.o extF80_to_ui32_r_minMag.o extF80_to_ui64_r_minMag.o extF80_to_i32_r_minMag.o extF80_to_i64_r_minMag.o extF80_to_f16.o extF80_to_f32.o extF80_to_f64.o extF80_to_f128.o extF80_roundToInt.o extF80_add.o extF80_sub.o extF80_mul.o extF80_div.o extF80_rem.o extF80_sqrt.o extF80_eq.o extF80_le.o extF80_lt.o extF80_eq_signaling.o extF80_le_quiet.o extF80_lt_quiet.o extF80_isSignalingNaN.o extF80M_to_ui32.o extF80M_to_ui64.o extF80M_to_i32.o extF80M_to_i64.o extF80M_to_ui32_r_minMag.o extF80M_to_ui64_r_minMag.o extF80M_to_i32_r_minMag.o extF80M_to_i64_r_minMag.o extF80M_to_f16.o extF80M_to_f32.o extF80M_to_f64.o extF80M_to_f128M.o extF80M_roundToInt.o extF80M_add.o extF80M_sub.o extF80M_mul.o extF80M_div.o extF80M_rem.o extF80M_sqrt.o extF80M_eq.o extF80M_le.o extF80M_lt.o extF80M_eq_signaling.o extF80M_le_quiet.o extF80M_lt_quiet.o f128_to_ui32.o f128_to_ui64.o f128_to_i32.o f128_to_i64.o f128_to_ui32_r_minMag.o f128_to_ui64_r_minMag.o f128_to_i32_r_minMag.o f128_to_i64_r_minMag.o f128_to_f16.o f128_to_f32.o f128_to_extF80.o f128_to_f64.o f128_roundToInt.o f128_add.o f128_sub.o f128_mul.o f128_mulAdd.o f128_div.o f128_rem.o f128_sqrt.o f128_eq.o f128_le.o f128_lt.o f128_eq_signaling.o f128_le_quiet.o f128_lt_quiet.o f128_isSignalingNaN.o f128M_to_ui32.o f128M_to_ui64.o f128M_to_i32.o f128M_to_i64.o f128M_to_ui32_r_minMag.o f128M_to_ui64_r_minMag.o f128M_to_i32_r_minMag.o f128M_to_i64_r_minMag.o f128M_to_f16.o f128M_to_f32.o f128M_to_extF80M.o f128M_to_f64.o f128M_roundToInt.o f128M_add.o f128M_sub.o f128M_mul.o f128M_mulAdd.o f128M_div.o f128M_rem.o f128M_sqrt.o f128M_eq.o f128M_le.o f128M_lt.o f128M_eq_signaling.o f128M_le_quiet.o f128M_lt_quiet.o softfloat_raiseFlags.o s_f16UIToCommonNaN.o s_commonNaNToF16UI.o s_propagateNaNF16UI.o s_f32UIToCommonNaN.o s_commonNaNToF32UI.o s_propagateNaNF32UI.o s_f64UIToCommonNaN.o s_commonNaNToF64UI.o s_propagateNaNF64UI.o extF80M_isSignalingNaN.o s_extF80UIToCommonNaN.o s_commonNaNToExtF80UI.o s_propagateNaNExtF80UI.o f128M_isSignalingNaN.o s_f128UIToCommonNaN.o s_commonNaNToF128UI.o s_propagateNaNF128UI.o
clang++ -g -Wl,--warn-common -fsanitize=undefined -fsanitize=address -Wl,-z,relro -Wl,-z,now -pie -m64 -fstack-protector-strong -o fp-test fp-test.o slowfloat.o softfloat.o libtestfloat.a libsoftfloat.a /tmp/qemu-test/build/libqemuutil.a -lm -lz -lgthread-2.0 -pthread -lglib-2.0 -lnettle -lgnutls -lzstd -lrt/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
make[1]: Leaving directory '/tmp/qemu-test/build/tests/fp'
Traceback (most recent call last):
File "./tests/docker/docker.py", line 669, in <module>
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=2b0a161d4ba4427ba5e6e27525e6b837', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=x86_64-softmmu', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-4drgonrr/src/docker-src.2020-06-19-13.20.30.8832:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-debug']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=2b0a161d4ba4427ba5e6e27525e6b837
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-4drgonrr/src'
make: *** [docker-run-test-debug@fedora] Error 2
real 4m15.222s
user 0m8.989s
The full log is available at
http://patchew.org/logs/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 17 lines · Peter Maydell
Since commit
ba3e7926691ed3it has been unnecessary for target code to callgen_io_end()after an IO instruction in icount mode; it is sufficient to callgen_io_start()before it and to force the end of the TB.Many now-unnecessary calls to
gen_io_end()were removed in commit9e9b10c6491153b, but some were missed or accidentally added later. Remove unneeded calls from the arm target:* the call in the handling of exception-return-via-LDM is unnecessary, and the code is already forcing end-of-TB
* the call in the VFP access check code is more complicated:
we weren't ending the TB, so we need to add the code to force that by settingDISAS_UPDATE
* the doc comment forARM_CP_IOdoesn't need to mentiongen_io_end()any more
Quoted 6 lines
Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu.h | 2 +- target/arm/translate-vfp.inc.c | 7 +++---- target/arm/translate.c | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-)
r~
Quoted 17 lines · Peter Maydell
Since commit
ba3e7926691ed3it has been unnecessary for target code to callgen_io_end()after an IO instruction in icount mode; it is sufficient to callgen_io_start()before it and to force the end of the TB.Many now-unnecessary calls to
gen_io_end()were removed in commit9e9b10c6491153b, but some were missed or accidentally added later. Remove unneeded calls from the arm target:* the call in the handling of exception-return-via-LDM is unnecessary, and the code is already forcing end-of-TB
* the call in the VFP access check code is more complicated:
we weren't ending the TB, so we need to add the code to force that by settingDISAS_UPDATE
* the doc comment forARM_CP_IOdoesn't need to mentiongen_io_end()any more
Quoted 1 line
Signed-off-by Peter Maydell <[email protected]>
Quoted 57 lines
--- target/arm/cpu.h | 2 +- target/arm/translate-vfp.inc.c | 7 +++---- target/arm/translate.c | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-)target/arm/cpu.h +1
-1@@ -2334,7 +2334,7 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)* migration or KVM state synchronization. (Typically this is for "registers" * which are actually used as instructions for cache maintenance and so on.) * IO indicates that this register does I/O and therefore its accesses -* need to be surrounded by gen_io_start()/gen_io_end(). In particular, +* need to be marked with gen_io_start() and also end the TB. In particular, * registers which implement clocks or timers require this. * RAISES_EXC is for when the read or write hook might raise an exception; * the generated code will synchronize the CPU state before calling the hook target/arm/translate-vfp.inc.c +3
-4@@ -119,15 +119,14 @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)if (s->v7m_lspact) {/* * Lazy state saving affects external memory and also the NVIC, -* so we must mark it as an IO operation for icount. +* so we must mark it as an IO operation for icount (and cause +* this to be the last insn in the TB). */ if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { + s->base.is_jmp =DISAS_UPDATE ;gen_io_start (); }gen_helper_v7m_preserve_fp_state (cpu_env); -if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { -gen_io_end (); - }/* * If the preserve_fp_state helper doesn't throw an exception * then it will clear LSPACT; we don't need to repeat this for target/arm/translate.c +0
-3@@ -8824,9 +8824,6 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)gen_io_start (); }gen_helper_cpsr_write_eret (cpu_env, tmp); -if (tb_cflags (s->base.tb) &CF_USE_ICOUNT ) { -gen_io_end (); - }tcg_temp_free_i32 (tmp);/* Must exit loop to check un-masked IRQs */ s->base.is_jmp =DISAS_EXIT ;
Role of qemu-arm
Hello,
I am using qemu for doing simulations of code, and currently find qemu-system-arm convienient.
But, I cannot understand how to use qemu-arm. In fact, what I am searching for is a way of simulating only the ARM core, not any peripherals. I can work with qemu-system-arm, and could not find a way to use qemu-arm.
Would anyone have any pointers to a documentation or a tutorial using this tool ?
Best regards,
Vincent.
Signature · 7 lines
*Vincent Dupaquis* Software security & Cryptography expert 06 24 58 17 05 /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert de la Lauzière 13290 Aix-en-Provence/ www.trusted-objects.com <http://www.trusted-objects.com>
Re: Role of qemu-arm
Quoted 8 lines · vincent Dupaquis
Hello,
I am using qemu for doing simulations of code, and currently find
qemu-system-arm convienient.But, I cannot understand how to use qemu-arm. In fact, what I am
searching for is a way of simulating only the ARM core, not any peripherals.
There are two modes:
- system emulation (CPU + board and peripherals)
- linux-user (CPU but with a Linux syscall interface)
Quoted 2 lines
I can work with qemu-system-arm, and could not find a way to use qemu-arm.
If you are installing via your distros package manager you probably want a package called qemu-user. You can build the only the user-mode packages by issuing --disable-system to the configure script.
The closest thing to being a "pure" just the CPU is probably a standalone usermode binary that uses semihosting calls rather than a libc/syscall interface.
Quoted 7 lines
Would anyone have any pointers to a documentation or a tutorial
using this tool ?Best regards,
Vincent.
Signature · 1 line
Alex Bennée
Re: Role of qemu-arm
Hi Vincent,
Quoted 11 lines · Alex Bennée
Quoted 8 lines · vincent Dupaquis
Hello,
I am using qemu for doing simulations of code, and currently find
qemu-system-arm convienient.But, I cannot understand how to use qemu-arm. In fact, what I am
searching for is a way of simulating only the ARM core, not any peripherals.
You can start a machine with only a CPU core using:
$ qemu-system-arm -M none -cpu cortex-r5
The core will start running at full speed looping taking exception because there is no memory on its bus to fetch the code to run:
$ qemu-system-arm -M none -cpu cortex-r5 -d mmu,int PMSA MPU lookup for execute at 0x00000000 mmu_idx 33 -> Hit (prot rwx) Taking exception 3 [Prefetch Abort] ...from EL1 to EL1 ...with ESR 0x21/0x8600003f ...with IFSR 0x8 IFAR 0x0 Taking exception 3 [Prefetch Abort] ...from EL1 to EL1 ...with ESR 0x21/0x8600003f ...with IFSR 0x8 IFAR 0xc
You can use the '-m <size_mb>' option to add memory (mapped at the 0x00000000 address).
You can use the '-S' flag to start QEMU with the cores not running.
Example of use is via gdbstub, filling some instructions in memory, set $sp and $pc and singlestep.
You can also use the 'loader' device to load a file into memory (it can understand ELF/hex format, see docs/generic-loader.txt).
Finally I also recommend you the -semihosting option.
For example you can run an RTOS Fibonacci test displaying progress via semihosting calls, by using something like (mapping 2MB of DRAM at 0x0):
$ qemu-system-arm -M none \ -m 2 \ -cpu cortex-r5 -d in_asm \ -semihosting-config enable=on \ -device loader,file=fibonacci.elf
Quoted 26 lines
There are two modes:
- system emulation (CPU + board and peripherals)
- linux-user (CPU but with a Linux syscall interface)Quoted 2 lines
I can work with qemu-system-arm, and could not find a way to use qemu-arm.
If you are installing via your distros package manager you probably want a package called qemu-user. You can build the only the user-mode packages by issuing --disable-system to the configure script.
The closest thing to being a "pure" just the CPU is probably a standalone usermode binary that uses semihosting calls rather than a libc/syscall interface.
Quoted 7 lines
Would anyone have any pointers to a documentation or a tutorial
using this tool ?Best regards,
Vincent.
Re: Role of qemu-arm
Philippe,
It looks very near from what I want to do indeed.
I essentially work on Cortex-M0+/M3 devices and I will have a try to your proposal !
Now I have a couple of hints, I'll probably be able to understand more how to do this :)
Best regards,
Vincent.
Le 22/06/2020 à 11:29, Philippe Mathieu-Daudé a écrit :
Quoted 79 lines
Hi Vincent,
Quoted 10 lines · Alex Bennée
Quoted 8 lines · vincent Dupaquis
Hello,
I am using qemu for doing simulations of code, and currently find
qemu-system-arm convienient.But, I cannot understand how to use qemu-arm. In fact, what I am
searching for is a way of simulating only the ARM core, not any peripherals.You can start a machine with only a CPU core using:
$ qemu-system-arm -M none -cpu cortex-r5The core will start running at full speed looping taking exception because there is no memory on its bus to fetch the code to run:
$ qemu-system-arm -M none -cpu cortex-r5 -d mmu,int PMSA MPU lookup for execute at 0x00000000 mmu_idx 33 -> Hit (prot rwx) Taking exception 3 [Prefetch Abort] ...from EL1 to EL1 ...with ESR 0x21/0x8600003f ...with IFSR 0x8 IFAR 0x0 Taking exception 3 [Prefetch Abort] ...from EL1 to EL1 ...with ESR 0x21/0x8600003f ...with IFSR 0x8 IFAR 0xcYou can use the '-m <
size_mb>' option to add memory (mapped at the0x00000000address).You can use the '-S' flag to start QEMU with the cores not running.
Example of use is via gdbstub, filling some instructions in memory, set $sp and $pc and singlestep.
You can also use the 'loader' device to load a file into memory (it can understand ELF/hex format, see
docs/generic-loader.txt).Finally I also recommend you the -semihosting option.
For example you can run an RTOS Fibonacci test displaying progress via semihosting calls, by using something like (mapping 2MB of DRAM at
0x0):$ qemu-system-arm -M none \ -m 2 \ -cpu cortex-r5 -d in_asm \ -semihosting-config enable=on \ -device loader,file=fibonacci.elfQuoted 22 lines
There are two modes:
- system emulation (CPU + board and peripherals)
- linux-user (CPU but with a Linux syscall interface)Quoted 2 lines
I can work with qemu-system-arm, and could not find a way to use qemu-arm.
If you are installing via your distros package manager you probably want a package called qemu-user. You can build the only the user-mode packages by issuing --disable-system to the configure script.
The closest thing to being a "pure" just the CPU is probably a standalone usermode binary that uses semihosting calls rather than a libc/syscall interface.
Quoted 6 lines
Would anyone have any pointers to a documentation or a tutorial
using this tool ?Best regards,
Vincent.
Signature · 7 lines
*Vincent Dupaquis* Software security & Cryptography expert 06 24 58 17 05 /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert de la Lauzière 13290 Aix-en-Provence/ www.trusted-objects.com <http://www.trusted-objects.com>
Re: Role of qemu-arm
Quoted 2 lines · vincent Dupaquis
I essentially work on Cortex-M0+/M3 devices and I will have a try to
your proposal !
The 'none' machine can't be used with M-profile CPUs, because it doesn't create the NVIC, which is a mandatory device for M-profile. You'll get this error message:
qemu-system-arm: This board cannot be used with Cortex-M CPUs
(or if you're using a really old QEMU, it will crash or misbehave.)
thanks
-- PMM
Re: Role of qemu-arm
Peter,
It is a shame, so I suppose I'll have to stay with my emulation using netduino2 or so ...
That was the reason why I tried to use qem-arm, which is probably crashing because what you just suggested.
Is there a way of pointing-out the interest for the feature ?
Best regards,
Vincent.
Le 22/06/2020 à 14:16, Peter Maydell a écrit :
Quoted 13 lines
Quoted 2 lines · vincent Dupaquis
I essentially work on Cortex-M0+/M3 devices and I will have a try to
your proposal !The 'none' machine can't be used with M-profile CPUs, because it doesn't create the NVIC, which is a mandatory device for M-profile. You'll get this error message:
qemu-system-arm: This board cannot be used with Cortex-M CPUs(or if you're using a really old QEMU, it will crash or misbehave.)
thanks
-- PMM
Signature · 7 lines
*Vincent Dupaquis* Software security & Cryptography expert 06 24 58 17 05 /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert de la Lauzière 13290 Aix-en-Provence/ www.trusted-objects.com <http://www.trusted-objects.com>
Re: Role of qemu-arm
Quoted 5 lines · vincent Dupaquis
It is a shame, so I suppose I'll have to stay with my emulation
using netduino2 or so ...That was the reason why I tried to use qem-arm, which is probably
crashing because what you just suggested.
qemu-arm is for "I'm a linux userspace binary"; if your code is a userspace binary then you can use it...
Quoted 1 line
Is there a way of pointing-out the interest for the feature ?
I'm afraid we don't support or have any plan to support "just run a CPU, no peripherals". I don't think there's much utility in it -- M-profile needs the interrupt controller, almost any setup wants to have a UART for I/O, and you need some actual RAM, which then leaves you with the question of what address to put the RAM at. At that point you're not really "just a CPU", you're "a minimalist board that doesn't correspond to any real hardware". We've found from experience that emulating things which don't correspond to something in the real world is not really maintainable and supportable in the long term.
If your code will genuinely run on any M-profile board, just pick whichever one seems most useful and ignore the devices you don't need to use. (I like the mps2-an385, it has a bit more RAM than most.)
thanks
-- PMM
Re: Role of qemu-arm
Indeed, for us it has an interest, as we do libraries running on cortex-Mx cores. We are not linked to any specific board and can run on any.
Currently, we are using a basic board (the netduino2), and do not make use of any peripherals (that's the goal of our project, being able to be used on any board, with the right core). We do not even use the IT controller.
You are right to say that there is no need of having 'plain cpu' emulation, as long as you can use any existing simulated board model. So, as long as there is
By the way, my original question was on the usage of qemu-arm, and I have my response now :) It has no interest for cortex-Mx devices.
Best regards,
Vincent.
Le 22/06/2020 à 15:43, Peter Maydell a écrit :
Quoted 30 lines
Quoted 5 lines · vincent Dupaquis
It is a shame, so I suppose I'll have to stay with my emulation
using netduino2 or so ...That was the reason why I tried to use qem-arm, which is probably
crashing because what you just suggested.qemu-arm is for "I'm a linux userspace binary"; if your code is a userspace binary then you can use it...
Quoted 1 line
Is there a way of pointing-out the interest for the feature ?
I'm afraid we don't support or have any plan to support "just run a CPU, no peripherals". I don't think there's much utility in it -- M-profile needs the interrupt controller, almost any setup wants to have a UART for I/O, and you need some actual RAM, which then leaves you with the question of what address to put the RAM at. At that point you're not really "just a CPU", you're "a minimalist board that doesn't correspond to any real hardware". We've found from experience that emulating things which don't correspond to something in the real world is not really maintainable and supportable in the long term.
If your code will genuinely run on any M-profile board, just pick whichever one seems most useful and ignore the devices you don't need to use. (I like the mps2-an385, it has a bit more RAM than most.)
thanks
-- PMM
Signature · 7 lines
*Vincent Dupaquis* Software security & Cryptography expert 06 24 58 17 05 /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert de la Lauzière 13290 Aix-en-Provence/ www.trusted-objects.com <http://www.trusted-objects.com>
Re: Role of qemu-arm
Quoted 3 lines · vincent Dupaquis
Indeed, for us it has an interest, as we do libraries running on cortex-Mx cores. We are not linked to any specific board and can run on any.
Do the libraries use any privileged instructions?
How do they interact with I/O?
Can they be linked into an ELF binary?
Quoted 11 lines
Currently, we are using a basic board (the netduino2), and do not make use of any peripherals (that's the goal of our project, being able to be used on any board, with the right core). We do not even use the IT controller.
You are right to say that there is no need of having 'plain cpu' emulation, as long as you can use any existing simulated board model. So, as long as there is
By the way, my original question was on the usage of qemu-arm, and I have my response now :) It has no interest for cortex-Mx devices.
So I believe some of the gcc m-profile test suite runs under qemu-arm with semihosting for this reason. You may need to wrap a little test harness around your libraries to get this to work though.
Quoted 36 lines
Best regards,
Vincent.
Quoted 30 lines · Peter Maydell
Quoted 5 lines · vincent Dupaquis
It is a shame, so I suppose I'll have to stay with my emulation
using netduino2 or so ...That was the reason why I tried to use qem-arm, which is probably
crashing because what you just suggested.qemu-arm is for "I'm a linux userspace binary"; if your code is a userspace binary then you can use it...
Quoted 1 line
Is there a way of pointing-out the interest for the feature ?
I'm afraid we don't support or have any plan to support "just run a CPU, no peripherals". I don't think there's much utility in it -- M-profile needs the interrupt controller, almost any setup wants to have a UART for I/O, and you need some actual RAM, which then leaves you with the question of what address to put the RAM at. At that point you're not really "just a CPU", you're "a minimalist board that doesn't correspond to any real hardware". We've found from experience that emulating things which don't correspond to something in the real world is not really maintainable and supportable in the long term.
If your code will genuinely run on any M-profile board, just pick whichever one seems most useful and ignore the devices you don't need to use. (I like the mps2-an385, it has a bit more RAM than most.)
thanks
-- PMM
Signature · 1 line
Alex Bennée
Re: Role of qemu-arm
The libraries in this case do not make any interaction with I/O. We take control over them through GDB to be able to run them & test them.
They can be linked into a ELF binary (indeed this is how we test them, we link them with a dummy binary and take control over it using the debug interface).
Regading the priviledged instructions, I do not understand the question, we only use available core instructions (I do not remember about priviledged instructions in Cortex-Mx.
Le 24/06/2020 à 12:14, Alex Bennée a écrit :
Quoted 60 lines
Quoted 3 lines · vincent Dupaquis
Indeed, for us it has an interest, as we do libraries running on cortex-Mx cores. We are not linked to any specific board and can run on any.
Do the libraries use any privileged instructions?
How do they interact with I/O?
Can they be linked into an ELF binary?Quoted 11 lines
Currently, we are using a basic board (the netduino2), and do not make use of any peripherals (that's the goal of our project, being able to be used on any board, with the right core). We do not even use the IT controller.
You are right to say that there is no need of having 'plain cpu' emulation, as long as you can use any existing simulated board model. So, as long as there is
By the way, my original question was on the usage of qemu-arm, and I have my response now :) It has no interest for cortex-Mx devices.
So I believe some of the gcc m-profile test suite runs under qemu-arm with semihosting for this reason. You may need to wrap a little test harness around your libraries to get this to work though.
Quoted 35 lines
Best regards,
Vincent.
Quoted 30 lines · Peter Maydell
Quoted 5 lines · vincent Dupaquis
It is a shame, so I suppose I'll have to stay with my emulation
using netduino2 or so ...That was the reason why I tried to use qem-arm, which is probably
crashing because what you just suggested.qemu-arm is for "I'm a linux userspace binary"; if your code is a userspace binary then you can use it...
Quoted 1 line
Is there a way of pointing-out the interest for the feature ?
I'm afraid we don't support or have any plan to support "just run a CPU, no peripherals". I don't think there's much utility in it -- M-profile needs the interrupt controller, almost any setup wants to have a UART for I/O, and you need some actual RAM, which then leaves you with the question of what address to put the RAM at. At that point you're not really "just a CPU", you're "a minimalist board that doesn't correspond to any real hardware". We've found from experience that emulating things which don't correspond to something in the real world is not really maintainable and supportable in the long term.
If your code will genuinely run on any M-profile board, just pick whichever one seems most useful and ignore the devices you don't need to use. (I like the mps2-an385, it has a bit more RAM than most.)
thanks
-- PMM
Signature · 7 lines
*Vincent Dupaquis* Software security & Cryptography expert 06 24 58 17 05 /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert de la Lauzière 13290 Aix-en-Provence/ www.trusted-objects.com <http://www.trusted-objects.com>
Re: Role of qemu-arm
Quoted 3 lines · vincent Dupaquis
Regading the priviledged instructions, I do not understand the question, we only use available core instructions (I do not remember about priviledged instructions in Cortex-Mx.
For Cortex-M, privileged instructions are those which are only accessible when execution is privileged, ie when the CPU is either (a) in Handler mode or (b) in Thread mode with CONTROL.nPRIV=0. Examples of insns only available to privileged code are CPS, MRS access to some special registers, and access to most of the memory-mapped system registers.
thanks
-- PMM
Re: Role of qemu-arm
In reply to vincent DupaquisQuoted 2 lines · vincent Dupaquis
The libraries in this case do not make any interaction with I/O. We take control over them through GDB to be able to run them & test them.
So you could instead use a semihosting wrapper and use SYS_REPORTEXC to report a pass/fail back to whatever invoked QEMU. If you look at tests/tcg/arm/semihosting.c it can actually be built with:
semihosting-arm: LDFLAGS+=-nostdlib -N -static
And you get a libc free executable with about ~30 insns that can be invoked by qemu-arm.
Quoted 7 lines
They can be linked into a ELF binary (indeed this is how we test them, we link them with a dummy binary and take control over it using the debug interface).
Regading the priviledged instructions, I do not understand the question, we only use available core instructions (I do not remember about priviledged instructions in Cortex-Mx.
Things like accessing system control registers and the like.
Quoted 62 lines · Alex Bennée
Quoted 60 lines
Quoted 3 lines · vincent Dupaquis
Indeed, for us it has an interest, as we do libraries running on cortex-Mx cores. We are not linked to any specific board and can run on any.
Do the libraries use any privileged instructions?
How do they interact with I/O?
Can they be linked into an ELF binary?Quoted 11 lines
Currently, we are using a basic board (the netduino2), and do not make use of any peripherals (that's the goal of our project, being able to be used on any board, with the right core). We do not even use the IT controller.
You are right to say that there is no need of having 'plain cpu' emulation, as long as you can use any existing simulated board model. So, as long as there is
By the way, my original question was on the usage of qemu-arm, and I have my response now :) It has no interest for cortex-Mx devices.
So I believe some of the gcc m-profile test suite runs under qemu-arm with semihosting for this reason. You may need to wrap a little test harness around your libraries to get this to work though.
Quoted 35 lines
Best regards,
Vincent.
Quoted 30 lines · Peter Maydell
Quoted 5 lines · vincent Dupaquis
It is a shame, so I suppose I'll have to stay with my emulation
using netduino2 or so ...That was the reason why I tried to use qem-arm, which is probably
crashing because what you just suggested.qemu-arm is for "I'm a linux userspace binary"; if your code is a userspace binary then you can use it...
Quoted 1 line
Is there a way of pointing-out the interest for the feature ?
I'm afraid we don't support or have any plan to support "just run a CPU, no peripherals". I don't think there's much utility in it -- M-profile needs the interrupt controller, almost any setup wants to have a UART for I/O, and you need some actual RAM, which then leaves you with the question of what address to put the RAM at. At that point you're not really "just a CPU", you're "a minimalist board that doesn't correspond to any real hardware". We've found from experience that emulating things which don't correspond to something in the real world is not really maintainable and supportable in the long term.
If your code will genuinely run on any M-profile board, just pick whichever one seems most useful and ignore the devices you don't need to use. (I like the mps2-an385, it has a bit more RAM than most.)
thanks
-- PMM
Signature · 1 line
Alex Bennée