From 87861962c006123615984d9e41c360fa51e69361 Mon Sep 17 00:00:00 2001 From: brightprogrammer Date: Wed, 12 Jul 2023 16:43:43 +0530 Subject: [PATCH] Build Works --- buildlog.txt | 343 +++++++++++++++++++++++++++++++++ include/fpu/softfloat-types.h | 3 + include/fpu/softfloat.h | 1 + include/qemu/bswap.h | 1 + linux-user/mips/trace_info.h | 6 +- linux-user/mips64/trace_info.h | 7 + qobject/block-qdict.c | 2 +- stubs/replay-tools.c | 4 +- target/mips/helper.h | 25 ++- target/mips/tcg/exception.c | 2 +- target/mips/tcg/translate.c | 55 ++++-- target/mips/trace_helper.c | 133 ++++++------- util/async.c | 6 +- 13 files changed, 482 insertions(+), 106 deletions(-) create mode 100644 buildlog.txt create mode 100644 linux-user/mips64/trace_info.h diff --git a/buildlog.txt b/buildlog.txt new file mode 100644 index 000000000000..b07a095894ee --- /dev/null +++ b/buildlog.txt @@ -0,0 +1,343 @@ +changing dir to build for make ""... +make[1]: Entering directory '/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/build' + GIT ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp +[1/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_ui64_rx.c.o +[2/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_i64_rx.c.o +[3/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_i32_rx.c.o +[4/576] Generating qemu-version.h with a custom command (wrapped by meson to capture output) +[5/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_ui32_x.c.o +[6/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_ui64_x.c.o +[7/576] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_a_f16_z_i32_x.c.o +[8/576] Compiling C object libqemu-mips-linux-user.fa.p/target_mips_trace_helper.c.o +FAILED: libqemu-mips-linux-user.fa.p/target_mips_trace_helper.c.o +cc -m64 -mcx16 -Ilibqemu-mips-linux-user.fa.p -I. -I.. -Itarget/mips -I../target/mips -I../linux-user/host/x86_64 -Ilinux-user -I../linux-user -Ilinux-user/mips -I../linux-user/mips -Iprotobuf -I../protobuf -I/home/brightprogrammer/Work/bap-frames/libtrace/src -Itrace -Iqapi -Iui/shader -I/usr/include/capstone -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -isystem /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/linux-headers -isystem linux-headers -iquote . -iquote /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu -iquote /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include -iquote /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/disas/libvixl -iquote /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIE -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="mips-linux-user-config-target.h"' '-DCONFIG_DEVICES="mips-linux-user-config-devices.h"' -MD -MQ libqemu-mips-linux-user.fa.p/target_mips_trace_helper.c.o -MF libqemu-mips-linux-user.fa.p/target_mips_trace_helper.c.o.d -o libqemu-mips-linux-user.fa.p/target_mips_trace_helper.c.o -c ../target/mips/trace_helper.c +In file included from /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/host-utils.h:33, + from /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/bitops.h:16, + from /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/bitmap.h:16, + from /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/hw/qdev-core.h:5, + from /home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/hw/core/cpu.h:23, + from ../target/mips/cpu-qom.h:23, + from ../target/mips/cpu.h:4, + from ../target/mips/trace_helper.c:3: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: error: conflicting types for ‘helper_trace_endframe’; have ‘void(CPUMIPSState *, uint64_t)’ {aka ‘void(CPUMIPSState *, long unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:14:6: note: in expansion of macro ‘HELPER’ + 14 | void HELPER(trace_endframe)(CPUMIPSState *env, uint64_t pc) { qemu_trace_endframe(env, pc, MIPS_INSN_SIZE); } + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: note: previous declaration of ‘helper_trace_endframe’ with type ‘void(target_ulong, uint64_t)’ {aka ‘void(unsigned int, long unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-proto.h:16:15: note: in expansion of macro ‘HELPER’ + 16 | dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:123:5: note: in expansion of macro ‘DEF_HELPER_FLAGS_2’ + 123 | DEF_HELPER_FLAGS_2(name, 0, ret, t1, t2) + | ^~~~~~~~~~~~~~~~~~ +../target/mips/helper.h:21:1: note: in expansion of macro ‘DEF_HELPER_2’ + 21 | DEF_HELPER_2(trace_endframe, void, tl, i64) + | ^~~~~~~~~~~~ +../target/mips/trace_helper.c:27:15: error: conflicting types for ‘load_store_reg’; have ‘OperandInfo *(uint32_t, uint64_t, size_t, int)’ {aka ‘OperandInfo *(unsigned int, long unsigned int, long unsigned int, int)’} + 27 | OperandInfo * load_store_reg(uint32_t reg, uint64_t val, size_t len, int ls) + | ^~~~~~~~~~~~~~ +In file included from ../target/mips/trace_helper.c:4: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/tracewrap.h:45:15: note: previous declaration of ‘load_store_reg’ with type ‘OperandInfo *(uint32_t, uint32_t, int)’ {aka ‘OperandInfo *(unsigned int, unsigned int, int)’} + 45 | OperandInfo * load_store_reg(uint32_t reg, uint32_t val, int ls); + | ^~~~~~~~~~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_load_reg32’: +../target/mips/trace_helper.c:65:14: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=] + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:74:61: note: in expansion of macro ‘LOAD_REG’ + 74 | void HELPER(trace_load_reg32)(uint32_t reg, uint32_t val) { LOAD_REG(reg, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:65:51: note: format string is defined here + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~~^ + | | + | long unsigned int + | %u +../target/mips/trace_helper.c:65:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + | | + | long unsigned int +../target/mips/trace_helper.c:74:61: note: in expansion of macro ‘LOAD_REG’ + 74 | void HELPER(trace_load_reg32)(uint32_t reg, uint32_t val) { LOAD_REG(reg, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:65:56: note: format string is defined here + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: warning: no previous prototype for ‘helper_trace_load_reg64’ [-Wmissing-prototypes] + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:75:6: note: in expansion of macro ‘HELPER’ + 75 | void HELPER(trace_load_reg64)(uint32_t reg, uint64_t val) { LOAD_REG(reg, val); } + | ^~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_load_reg64’: +../target/mips/trace_helper.c:65:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + | | + | long unsigned int +../target/mips/trace_helper.c:75:61: note: in expansion of macro ‘LOAD_REG’ + 75 | void HELPER(trace_load_reg64)(uint32_t reg, uint64_t val) { LOAD_REG(reg, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:65:56: note: format string is defined here + 65 | qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: In function ‘helper_trace_store_reg32’: +../target/mips/trace_helper.c:70:14: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=] + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:77:62: note: in expansion of macro ‘STORE_REG’ + 77 | void HELPER(trace_store_reg32)(uint32_t reg, uint32_t val) { STORE_REG(val, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:70:52: note: format string is defined here + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~~^ + | | + | long unsigned int + | %u +../target/mips/trace_helper.c:70:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + | | + | long unsigned int +../target/mips/trace_helper.c:77:62: note: in expansion of macro ‘STORE_REG’ + 77 | void HELPER(trace_store_reg32)(uint32_t reg, uint32_t val) { STORE_REG(val, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:70:57: note: format string is defined here + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: warning: no previous prototype for ‘helper_trace_store_reg64’ [-Wmissing-prototypes] + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:78:6: note: in expansion of macro ‘HELPER’ + 78 | void HELPER(trace_store_reg64)(uint32_t reg, uint64_t val) { STORE_REG(reg, val); } + | ^~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_store_reg64’: +../target/mips/trace_helper.c:70:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + | | + | long unsigned int +../target/mips/trace_helper.c:78:62: note: in expansion of macro ‘STORE_REG’ + 78 | void HELPER(trace_store_reg64)(uint32_t reg, uint64_t val) { STORE_REG(reg, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:70:57: note: format string is defined here + 70 | qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +../target/mips/trace_helper.c:90:15: error: conflicting types for ‘load_store_mem’; have ‘OperandInfo *(uint64_t, const void *, int, int)’ {aka ‘OperandInfo *(long unsigned int, const void *, int, int)’} + 90 | OperandInfo * load_store_mem(uint64_t addr, const void *memptr, int ls, int len) { + | ^~~~~~~~~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/tracewrap.h:47:15: note: previous declaration of ‘load_store_mem’ with type ‘OperandInfo *(uint64_t, int, const void *, size_t)’ {aka ‘OperandInfo *(long unsigned int, int, const void *, long unsigned int)’} + 47 | OperandInfo * load_store_mem(uint64_t addr, int ls, const void *data, size_t data_size); + | ^~~~~~~~~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: error: conflicting types for ‘helper_trace_load_mem32’; have ‘void(uint64_t, uint32_t)’ {aka ‘void(long unsigned int, unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:135:6: note: in expansion of macro ‘HELPER’ + 135 | void HELPER(trace_load_mem32)(uint64_t addr, uint32_t val) { LOAD_MEM(addr, val); } + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: note: previous declaration of ‘helper_trace_load_mem32’ with type ‘void(uint32_t, uint32_t)’ {aka ‘void(unsigned int, unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-proto.h:16:15: note: in expansion of macro ‘HELPER’ + 16 | dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:123:5: note: in expansion of macro ‘DEF_HELPER_FLAGS_2’ + 123 | DEF_HELPER_FLAGS_2(name, 0, ret, t1, t2) + | ^~~~~~~~~~~~~~~~~~ +../target/mips/helper.h:25:1: note: in expansion of macro ‘DEF_HELPER_2’ + 25 | DEF_HELPER_2(trace_load_mem32, void, i32, i32) + | ^~~~~~~~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_load_mem32’: +../target/mips/trace_helper.c:126:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:135:63: note: in expansion of macro ‘LOAD_MEM’ + 135 | void HELPER(trace_load_mem32)(uint64_t addr, uint32_t val) { LOAD_MEM(addr, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:126:31: note: format string is defined here + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: warning: no previous prototype for ‘helper_trace_load_mem64’ [-Wmissing-prototypes] + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:136:6: note: in expansion of macro ‘HELPER’ + 136 | void HELPER(trace_load_mem64)(uint64_t addr, uint64_t val) { LOAD_MEM(addr, val); } + | ^~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_load_mem64’: +../target/mips/trace_helper.c:126:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:136:63: note: in expansion of macro ‘LOAD_MEM’ + 136 | void HELPER(trace_load_mem64)(uint64_t addr, uint64_t val) { LOAD_MEM(addr, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:126:31: note: format string is defined here + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c:126:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:136:63: note: in expansion of macro ‘LOAD_MEM’ + 136 | void HELPER(trace_load_mem64)(uint64_t addr, uint64_t val) { LOAD_MEM(addr, val); } + | ^~~~~~~~ +../target/mips/trace_helper.c:126:41: note: format string is defined here + 126 | qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: error: conflicting types for ‘helper_trace_store_mem32’; have ‘void(uint64_t, uint32_t)’ {aka ‘void(long unsigned int, unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:138:6: note: in expansion of macro ‘HELPER’ + 138 | void HELPER(trace_store_mem32)(uint64_t addr, uint32_t val) { STORE_MEM(addr, val); } + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: note: previous declaration of ‘helper_trace_store_mem32’ with type ‘void(uint32_t, uint32_t)’ {aka ‘void(unsigned int, unsigned int)’} + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-proto.h:16:15: note: in expansion of macro ‘HELPER’ + 16 | dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); + | ^~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:123:5: note: in expansion of macro ‘DEF_HELPER_FLAGS_2’ + 123 | DEF_HELPER_FLAGS_2(name, 0, ret, t1, t2) + | ^~~~~~~~~~~~~~~~~~ +../target/mips/helper.h:26:1: note: in expansion of macro ‘DEF_HELPER_2’ + 26 | DEF_HELPER_2(trace_store_mem32, void, i32, i32) + | ^~~~~~~~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_store_mem32’: +../target/mips/trace_helper.c:131:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:138:63: note: in expansion of macro ‘STORE_MEM’ + 138 | void HELPER(trace_store_mem32)(uint64_t addr, uint32_t val) { STORE_MEM(addr, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:131:32: note: format string is defined here + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c: At top level: +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:27: warning: no previous prototype for ‘helper_trace_store_mem64’ [-Wmissing-prototypes] + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~~~~ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/qemu/compiler.h:35:21: note: in definition of macro ‘xglue’ + 35 | #define xglue(x, y) x ## y + | ^ +/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/include/exec/helper-head.h:21:22: note: in expansion of macro ‘glue’ + 21 | #define HELPER(name) glue(helper_, name) + | ^~~~ +../target/mips/trace_helper.c:139:6: note: in expansion of macro ‘HELPER’ + 139 | void HELPER(trace_store_mem64)(uint64_t addr, uint64_t val) { STORE_MEM(addr, val); } + | ^~~~~~ +../target/mips/trace_helper.c: In function ‘helper_trace_store_mem64’: +../target/mips/trace_helper.c:131:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:139:63: note: in expansion of macro ‘STORE_MEM’ + 139 | void HELPER(trace_store_mem64)(uint64_t addr, uint64_t val) { STORE_MEM(addr, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:131:32: note: format string is defined here + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +../target/mips/trace_helper.c:131:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../target/mips/trace_helper.c:139:63: note: in expansion of macro ‘STORE_MEM’ + 139 | void HELPER(trace_store_mem64)(uint64_t addr, uint64_t val) { STORE_MEM(addr, val); } + | ^~~~~~~~~ +../target/mips/trace_helper.c:131:42: note: format string is defined here + 131 | qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ + | ~^ + | | + | unsigned int + | %lx +[9/576] Compiling C object libqemu-mips-linux-user.fa.p/target_mips_tcg_ldst_helper.c.o +[10/576] Compiling C object libqemu-mips-linux-user.fa.p/target_mips_tcg_lmmi_helper.c.o +[11/576] Compiling C object libqemu-mips-linux-user.fa.p/target_mips_tcg_msa_helper.c.o +ninja: build stopped: subcommand failed. +make[1]: Leaving directory '/home/brightprogrammer/BigMan/OldFiles/Desktop/Work/bapqemu/build' diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 5bcbd041f74f..a72314ca4e5c 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -80,6 +80,9 @@ this code that are retained. #ifndef SOFTFLOAT_TYPES_H #define SOFTFLOAT_TYPES_H +#include +#include + /* * Software IEC/IEEE floating-point types. */ diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index a249991e6127..b5a7c120af30 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -95,6 +95,7 @@ typedef enum { #include "fpu/softfloat-types.h" #include "fpu/softfloat-helpers.h" +#include /*---------------------------------------------------------------------------- | Routine to raise any or all of the software IEC/IEEE floating-point diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 2d3bb8bbedda..1b712ce9fd1f 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -1,6 +1,7 @@ #ifndef BSWAP_H #define BSWAP_H +#include "osdep.h" #ifdef CONFIG_MACHINE_BSWAP_H # include # include diff --git a/linux-user/mips/trace_info.h b/linux-user/mips/trace_info.h index c7ef66dd8b74..2b1b7efd65d6 100644 --- a/linux-user/mips/trace_info.h +++ b/linux-user/mips/trace_info.h @@ -1,11 +1,7 @@ #pragma once #include "frame_arch.h" +#include -#if defined(TARGET_MIPS) const uint64_t frame_arch = frame_arch_mips; const uint64_t frame_mach = frame_mach_mipsisa32; -#else -const uint64_t frame_arch = frame_arch_mips64; -const uint64_t frame_mach = frame_mach_mipsisa64; -#endif diff --git a/linux-user/mips64/trace_info.h b/linux-user/mips64/trace_info.h new file mode 100644 index 000000000000..65deefe37a68 --- /dev/null +++ b/linux-user/mips64/trace_info.h @@ -0,0 +1,7 @@ +#pragma once + +#include "frame_arch.h" +#include + +const uint64_t frame_arch = frame_arch_mips; +const uint64_t frame_mach = frame_mach_mipsisa64; diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c index b26524429c0d..bbe6ea4af1f1 100644 --- a/qobject/block-qdict.c +++ b/qobject/block-qdict.c @@ -226,8 +226,8 @@ void qdict_array_split(QDict *src, QList **dst) bool is_subqdict; QDict *subqdict = NULL; char indexstr[32], prefix[32]; - size_t snprintf_ret; + size_t snprintf_ret; snprintf_ret = snprintf(indexstr, 32, "%u", i); assert(snprintf_ret < 32); diff --git a/stubs/replay-tools.c b/stubs/replay-tools.c index 43296b3d4eb7..d2d6c1c93c62 100644 --- a/stubs/replay-tools.c +++ b/stubs/replay-tools.c @@ -7,13 +7,13 @@ bool replay_events_enabled(void) return false; } -int64_t replay_save_clock(unsigned int kind, int64_t clock, int64_t raw_icount) +int64_t replay_save_clock(ReplayClockKind kind, int64_t clock, int64_t raw_icount) { abort(); return 0; } -int64_t replay_read_clock(unsigned int kind, int64_t raw_icount) +int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount) { abort(); return 0; diff --git a/target/mips/helper.h b/target/mips/helper.h index 7d4bca89e700..11cf1652e93e 100644 --- a/target/mips/helper.h +++ b/target/mips/helper.h @@ -1,4 +1,4 @@ -DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int) +DEF_HELPER_3(raise_exception_err, noreturn, env, i32, i32) DEF_HELPER_2(raise_exception, noreturn, env, i32) DEF_HELPER_1(raise_exception_debug, noreturn, env) @@ -17,17 +17,28 @@ DEF_HELPER_3(lld, tl, env, tl, int) #endif #ifdef HAS_TRACEWRAP -DEF_HELPER_1(trace_newframe, void, tl) -DEF_HELPER_3(trace_endframe, void, env, tl, i32) +// trace being/end +DEF_HELPER_1(trace_newframe, void, i64) +DEF_HELPER_2(trace_endframe, void, env, i64) +DEF_HELPER_1(trace_mode, void, ptr) + +// load/store registers DEF_HELPER_2(trace_load_reg32, void, i32, i32) DEF_HELPER_2(trace_store_reg32, void, i32, i32) -DEF_HELPER_3(trace_load_mem32, void, env, i32, i32) -DEF_HELPER_3(trace_store_mem32, void, env, i32, i32) + +// load store memory operands +DEF_HELPER_3(trace_load_mem, void, i32, i32, i32) +DEF_HELPER_3(trace_store_mem, void, i32, i32, i32) +DEF_HELPER_3(trace_load_mem_i64, void, i32, i64, i32) +DEF_HELPER_3(trace_store_mem_i64, void, i32, i64, i32) #ifdef TARGET_MIPS64 +// load/store registers DEF_HELPER_2(trace_load_reg64, void, i32, i64) DEF_HELPER_2(trace_store_reg64, void, i32, i64) -DEF_HELPER_2(trace_load_mem64, void, i32, i64) -DEF_HELPER_2(trace_store_mem64, void, i32, i64) + +// load store memory operands +DEF_HELPER_3(trace_load_mem64, void, i64, i64, i32) +DEF_HELPER_3(trace_store_mem64, void, i64, i64, i32) #endif // TARGET_MIPS64 #endif // HAS_TRACEWRAP diff --git a/target/mips/tcg/exception.c b/target/mips/tcg/exception.c index 7b3026b105b8..b1cc73daba8a 100644 --- a/target/mips/tcg/exception.c +++ b/target/mips/tcg/exception.c @@ -43,7 +43,7 @@ target_ulong exception_resume_pc(CPUMIPSState *env) } void helper_raise_exception_err(CPUMIPSState *env, uint32_t exception, - int error_code) + uint32_t error_code) { do_raise_exception_err(env, exception, error_code, 0); } diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index d51b8e3f688a..9e4570b3945f 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -1234,21 +1234,21 @@ static const char regnames_LO[][4] = { static inline void gen_trace_newframe(uint64_t pc) { #ifdef HAS_TRACEWRAP - // create new traceframe + // will contain machine type information TCGv_i64 _pc = tcg_const_i64(pc); gen_helper_trace_newframe(_pc); tcg_temp_free_i64(_pc); - // get machine type + TCGv_ptr mt; #ifdef TARGET_MIPS64 - TCGv_ptr mt = tcg_const_ptr(FRAME_MODE_MIPS64); // TODO: Check this -#else - TCGv_ptr mt = tcg_const_ptr(FRAME_MODE_MIPS); + mt = tcg_const_ptr(FRAME_MODE_MIPS64); +#else // else this is TARGET_MIPS + mt = tcg_const_ptr(FRAME_MODE_MIPS); #endif // TARGET_MIPS64 // set trace mode to mips64 or mips gen_helper_trace_mode(mt); - tcg_trace_free_ptr(mt); + tcg_temp_free_ptr(mt); #endif // HAS_TRACEWRAP } @@ -1269,7 +1269,7 @@ static void gen_trace_load_reg(int reg, TCGv var) { #ifdef TARGET_MIPS64 gen_helper_trace_load_reg64(r, var); #else - gen_helper_trace_load_reg(r, var); + gen_helper_trace_load_reg32(r, var); #endif tcg_temp_free_i32(r); @@ -1280,16 +1280,43 @@ static void gen_trace_store_reg(int reg, TCGv var) { #ifdef HAS_TRACEWRAP TCGv_i32 r = tcg_const_i32(reg); -#ifdef TARGET_PPC64 +#ifdef TARGET_MIPS64 gen_helper_trace_store_reg64(r, var); #else - gen_helper_trace_store_reg(r, var); + gen_helper_trace_store_reg32(r, var); #endif tcg_temp_free_i32(r); #endif // HAS_TRACEWRAP } +static void gen_trace_load_mem(TCGv addr, TCGv val, MemOp op) { +#ifdef HAS_TRACEWRAP + + TCGv_i32 o = tcg_const_i32(op); +#ifdef TARGET_MIPS64 + gen_helper_trace_load_mem64(addr, val, o); +#else + gen_helper_trace_load_mem(addr, val, o); +#endif + tcg_temp_free_i32(o); + +#endif // HAS_TRACEWRAP +} + +static void gen_trace_store_mem(TCGv addr, TCGv val, MemOp op) { +#ifdef HAS_TRACEWRAP + + TCGv_i32 o = tcg_const_i32(op); +#ifdef TARGET_MIPS64 + gen_helper_trace_store_mem64(addr, val, o); +#else + gen_helper_trace_store_mem(addr, val, o); +#endif + tcg_temp_free_i32(o); + +#endif // HAS_TRACEWRAP +} /* General purpose registers moves. */ void gen_load_gpr(TCGv t, int reg) @@ -1321,9 +1348,7 @@ void gen_load_gpr_hi(TCGv_i64 t, int reg) tcg_gen_mov_i64(t, cpu_gpr_hi[reg]); } - #ifdef HAS_TRACEWRAP gen_trace_load_reg(reg, t); - #endif } void gen_store_gpr_hi(TCGv_i64 t, int reg) @@ -1332,9 +1357,7 @@ void gen_store_gpr_hi(TCGv_i64 t, int reg) tcg_gen_mov_i64(cpu_gpr_hi[reg], t); } - #ifdef HAS_TRACEWRAP gen_trace_store_reg(reg, t); - #endif } #endif /* TARGET_MIPS64 */ @@ -1363,8 +1386,6 @@ static inline void gen_load_srsgpr(int from, int to) } gen_store_gpr(t0, to); tcg_temp_free(t0); - - #ifdef H } static inline void gen_store_srsgpr(int from, int to) @@ -16116,7 +16137,7 @@ static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) int is_slot; // get pc_next and start generating new traceframe - uint64_t pc_next = ctx->base.px_next; + uint64_t pc_next = ctx->base.pc_next; gen_trace_newframe(pc_next); // translate depending on architecture @@ -16182,7 +16203,7 @@ static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) } // end the frame - gen_pc_endframe(pc_next); + gen_trace_endframe(pc_next); } static void mips_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/mips/trace_helper.c b/target/mips/trace_helper.c index 593f46facef1..25b0ee0bb1f8 100644 --- a/target/mips/trace_helper.c +++ b/target/mips/trace_helper.c @@ -1,22 +1,19 @@ #include #include "cpu.h" -#include "helper.h" #include "tracewrap.h" #include "qemu/log.h" +#include "exec/helper-proto.h" +#include "exec/memop.h" + +#define MIPS_INSN_SIZE 4 const char *regs[] = {"r0","at","v0","v1","a0","a1","a2","a3","t0","t1","t2","t3","t4","t5","t6","t7","s0","s1","s2","s3","s4","s5","s6","s7","t8","t9","k0","k1","gp","sp","s8","ra","LO","HI"}; static const int reg_max = sizeof(regs) / sizeof(regs[0]); -void HELPER(trace_newframe)(target_ulong pc) -{ - qemu_trace_newframe(pc, 0); -} - -void HELPER(trace_endframe)(CPUMIPSState *env, target_ulong old_pc, uint32_t size) -{ - qemu_trace_endframe(env, old_pc, size); -} +void HELPER(trace_newframe)(uint64_t pc) { qemu_trace_newframe(pc, 0); } +void HELPER(trace_endframe)(CPUMIPSState *env, uint64_t pc) { qemu_trace_endframe(env, pc, MIPS_INSN_SIZE); } +void HELPER(trace_mode)(void *mode) { qemu_trace_set_mode(mode); } /** * Load/Store a value from/to a register @@ -28,8 +25,7 @@ void HELPER(trace_endframe)(CPUMIPSState *env, target_ulong old_pc, uint32_t siz * * @return OperandInfo * */ -OperandInfo * load_store_reg(uint32_t reg, uint64_t val, size_t len, int ls) -{ +OperandInfo * build_load_store_reg_op(uint32_t reg, uint64_t val, size_t len, int ls) { RegOperand * ro = g_new(RegOperand,1); reg_operand__init(ro); ro->name = g_strdup(reg < reg_max ? regs[reg] : "UNKOWN"); @@ -65,50 +61,27 @@ OperandInfo * load_store_reg(uint32_t reg, uint64_t val, size_t len, int ls) return oi; } -#define LOAD_REG(reg, val) \ - qemu_log("Read from (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ - OperandInfo *oi = load_store_reg(reg, val, sizeof(val), 0); \ - qemu_trace_add_operand(oi, 0x1) - -#define STORE_REG(reg, val) \ - qemu_log("Write into (r%d) register. Val = (u%zu)0x%x\n", reg, val, sizeof(val)*8); \ - OperandInfo *oi = load_store_reg(reg, val, sizeof(val), 1); \ - qemu_trace_add_operand(oi, 0x2) - -void HELPER(trace_load_reg32)(uint32_t reg, uint32_t val) -{ - LOAD_REG(reg, val); -} - -void HELPER(trace_store_reg32)(uint32_t reg, uint32_t val) -{ - STORE_REG(val, val); -} - -void HELPER(trace_load_reg64)(uint32_t reg, uint64_t val) -{ - LOAD_REG(reg, val); +/** + * load/store operations for 32 bit registers + * function is declared in tracewrap.h and is defined per architecture + * */ +OperandInfo *load_store_reg(uint32_t reg, uint32_t val, int ls) { + return build_load_store_reg_op(reg, val, sizeof(val), ls); } +void HELPER(trace_load_reg32)(uint32_t reg, uint32_t val) { load_store_reg(reg, val, 0); } +void HELPER(trace_store_reg32)(uint32_t reg, uint32_t val) { load_store_reg(reg, val, 1); } -void HELPER(trace_store_reg64)(uint32_t reg, uint64_t val) -{ - STORE_REG(reg, val); +#ifdef TARGET_MIPS64 +/** + * load/store operations for 64 bit registers + * again, declared in tracewrap.h and defined here + * */ +OperandInfo *load_store_reg64(uint32_t reg, uint64_t val, int ls) { + return build_load_store_reg_op(reg, val, sizeof(val), ls); } - -//void HELPER(trace_load_eflags)(CPUMIPSState *env) -//{ -// OperandInfo *oi = load_store_reg(REG_EFLAGS, cpu_compute_eflags(env), 0); -// -// qemu_trace_add_operand(oi, 0x1); -//} -// -//void HELPER(trace_store_eflags)(CPUMIPSState *env) -//{ -// OperandInfo *oi = load_store_reg(REG_EFLAGS, cpu_compute_eflags(env), 1); -// -// qemu_trace_add_operand(oi, 0x2); -//} -// +void HELPER(trace_load_reg64)(uint32_t reg, uint64_t val) { load_store_reg64(reg, val, 0); } +void HELPER(trace_store_reg64)(uint32_t reg, uint64_t val) { load_store_reg64(reg, val, 1); } +#endif /** * Load/Store a value from/to a memory region @@ -120,7 +93,7 @@ void HELPER(trace_store_reg64)(uint32_t reg, uint64_t val) * * @return OperandInfo * */ -OperandInfo * load_store_mem(uint64_t addr, const void *memptr, int ls, int len) { +OperandInfo * load_store_mem(uint64_t addr, int ls, const void* data, size_t data_size) { // create new memory operand MemOperand * mo = g_new(MemOperand,1); mem_operand__init(mo); @@ -143,30 +116,50 @@ OperandInfo * load_store_mem(uint64_t addr, const void *memptr, int ls, int len) // sum up all information OperandInfo *oi = g_new(OperandInfo,1); operand_info__init(oi); - oi->bit_length = len*8; + oi->bit_length = data_size*8; oi->operand_info_specific = ois; oi->operand_usage = ou; - oi->value.len = len; + oi->value.len = data_size; oi->value.data = g_malloc(oi->value.len); - memcpy(oi->value.data, memptr, len); + memcpy(oi->value.data, data, data_size); return oi; } -// TODO : create load/store_mem, u and i, 32 and i64 +void HELPER(trace_load_mem)(uint32_t addr, uint32_t val, MemOp op) { + qemu_log("LOAD at 0x%lx size: %d data: 0x%lx\n", (unsigned long) addr, memop_size(op), (unsigned long) val); + OperandInfo *oi = load_store_mem(addr, 0, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x1); +} -#define LOAD_MEM(addr, data) \ - qemu_log("Read at addr=0x%x, val=0x%x\n", addr, data); \ - OperandInfo *oi = load_store_mem(addr, &data, 0, sizeof(data)); \ - qemu_trace_add_operand(oi, 0x1) +void HELPER(trace_store_mem)(uint32_t addr, uint32_t val, MemOp op) { + qemu_log("STORE at 0x%lx size: %d data: 0x%lx\n", (unsigned long) addr, memop_size(op), (unsigned long) val); + OperandInfo *oi = load_store_mem(addr, 1, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x2); +} -#define STORE_MEM(addr, data) \ - qemu_log("Write at addr=0x%x, val=0x%x\n", addr, data); \ - OperandInfo *oi = load_store_mem(addr, &data, 1, sizeof(data)); \ - qemu_trace_add_operand(oi, 0x1) +void HELPER(trace_load_mem_i64)(uint32_t addr, uint64_t val, MemOp op) { + qemu_log("LOAD at 0x%lx size: %d data: 0x%llx\n", (unsigned long) addr, memop_size(op), (unsigned long long) val); + OperandInfo *oi = load_store_mem(addr, 0, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x1); +} -void HELPER(trace_load_mem32)(uint64_t addr, uint32_t val) { LOAD_MEM(addr, val); } -void HELPER(trace_load_mem64)(uint64_t addr, uint64_t val) { LOAD_MEM(addr, val); } +void HELPER(trace_store_mem_i64)(uint32_t addr, uint64_t val, MemOp op) { + qemu_log("STORE at 0x%lx size: %d data: 0x%llx\n", (unsigned long) addr, memop_size(op), (unsigned long long) val); + OperandInfo *oi = load_store_mem(addr, 1, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x2); +} -void HELPER(trace_store_mem32)(uint64_t addr, uint32_t val) { STORE_MEM(addr, val); } -void HELPER(trace_store_mem64)(uint64_t addr, uint64_t val) { STORE_MEM(addr, val); } +#ifdef TARGET_MIPS64 +void HELPER(trace_load_mem64)(uint64_t addr, uint64_t val, MemOp op) { + qemu_log("LOAD at 0x%llx size: %d data: 0x%llx\n", (unsigned long long) addr, memop_size(op), (unsigned long long) val); + OperandInfo *oi = load_store_mem(addr, 0, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x1); +} + +void HELPER(trace_store_mem64)(uint64_t addr, uint64_t val, MemOp op) { + qemu_log("STORE at 0x%llx size: %d data: 0x%llx\n", (unsigned long long) addr, memop_size(op), (unsigned long long) val); + OperandInfo *oi = load_store_mem(addr, 1, &val, memop_size(op)); + qemu_trace_add_operand(oi, 0x2); +} +#endif diff --git a/util/async.c b/util/async.c index 6f6717a34b63..2d8f54053698 100644 --- a/util/async.c +++ b/util/async.c @@ -144,12 +144,12 @@ void aio_bh_call(QEMUBH *bh) /* Multiple occurrences of aio_bh_poll cannot be called concurrently. */ int aio_bh_poll(AioContext *ctx) { - BHListSlice slice; + BHListSlice *slice = g_malloc(sizeof(BHListSlice)); BHListSlice *s; int ret = 0; - QSLIST_MOVE_ATOMIC(&slice.bh_list, &ctx->bh_list); - QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next); + QSLIST_MOVE_ATOMIC(&slice->bh_list, &ctx->bh_list); + QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, slice, next); while ((s = QSIMPLEQ_FIRST(&ctx->bh_slice_list))) { QEMUBH *bh;