Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'qemu_7_2' into qemu_8_1
This is a port of SymQEMU to version 8.1 of QEMU. This port is itself based on the port to QEMU 7.2 performed by Aurélien Hernandez. Here is a description of the non trivial adaptations that had to be performed : accel/tcg/tcg-runtime-sym.h In the previous SymQEMU version, the declaration of the helper functions for sym_load_guest_i32, sym_load_guest_i64, sym_store_guest_i32, sym_store_guest_i64 use the macro dh_alias_tl for describing the type of the load / store address. This macro is expanded to i_32 or i_64 depending on the guest architecture. However, in QEMU 8.1, dh_alias_tl is not avaialable in all compilation units that include tcg-runtime-sym.h. This is due to the fact that this macro is only available in the compilation units that include target/<arch>/cpu-param.h, and dependance on this header has been reduced in QEMU 8.1 As a solution, I replaced dh_alias_tl with i64. This obviously does not cause any problem for 64 bits guests. Even with 32 bits guests, this should be ok as, even in the original SymQEMU, the load / store addresses are always converted to 64 bit pointers before being passed to the symbolic backend. include/exec/helper-gen-common.h, helper-proto-common.h, accel/tcg/tcg-runtime-sym.c The way helper functions should be included for their macros to be expanded has changed. In QEMU 8.1, the helper expansions are done with the help of include/exec/helper-proto.h.inc, include/exec/helper/gen.h.inc, include/exec/helper-info.c.inc. I have adapted it for tcg-runtime-sym by imitating the way it is done for tcg-runtime. tcg/tcg.c:tcg_temp_new_internal QEMU 8.1 allows to create 128 bits TCGTemps. On a 64 bits host, a 128 bits temp will actually be stored in two consecutive 64 bits TCGTemps that are created by tcg_temp_new_internal. This conflicts with the design of SymQEMU, that consists of storing symbolic version of a TCGTemp right after the concrete one. For now, I have edited the function such that it triggers an error if an attempt to create a 128 bits TCGTemp is made. tcg/tcg.c:tcg_context_init In previous SymQEMU version, a macro expansion in tcg_context_init computes the distance between ArchCPU.env and ArchCPU.env_exprs. In QEMU 8.1, ArchCPU is not included in tcg.c. As a solution, the macro expansion is now placed in tcg-all.c:tcg_init_machine and the result offset is passed as argument to tcg_context_init. tcg/tcg.h: tcgv_i32_expr_num, tcgv_i64_expr_num Changed the return type of those two functions from TCGv to TCGv_i64, as the TCGv macro is not available for all compilation units that include tcg.h. TCGv expands to TCGv_i64 or TCGv_i32 depending on the guest architecture. However, the return value of tcgv_i32_expr_num and tcgv_i64_expr_num are only used in instrumentation code that expects 64 bits TCGArgs, even when the guest is 32 bits. Thus, TCGv_i64 makes more sense here than TGCv. include/tcg/tcg-op.h, include/tcg/tcg-op-common.h In QEMU 8.1, most of the content of tcg-op.h has been moved into the new file tcg-op-common.h include/tcg/tcg-op.h: tcg_gen_qemu_ld_i32, tcg_gen_qemu_st_i32, tcg_gen_qemu_ld_i64, tcg_gen_qemu_st_i64 In QEMU 8.1, the logic of those functions has been delegated to internal functions in tcg/tcg-op-ldst.c. Additionally, those internal functions now receive the load / store address temp as a TCGTemp instead of a TCGv_i64. The instrumentation code had to be adapted accordingly.
- Loading branch information