Skip to content
  • Marcin Kościelnicki's avatar
    gdbserver/s390: Add fast tracepoint support. · abd9baf9
    Marcin Kościelnicki authored
    Fast tracepoints will only work on 6-byte intructions, and assume at least
    a z900 CPU.  s390 also has 4-byte jump instructions, which also work on
    pre-z900, but their range is limitted to +-64kiB, which is not very useful
    (and wouldn't work at all with current jump pad allocation).
    
    There's a little problem with s390_relocate_instruction function: it
    converts BRAS/BRASL instructions to LARL of the return address + JG
    to the target address.  On 31-bit, this sets the high bit of the target
    register to 0, while BRAS/BRASL would set it to 1.  While this is not
    a problem when the result is only used to address memory, it could
    possibly break something that expects to compare such addresses for
    equality without first masking the bit off.  In particular, I'm not sure
    whether leaving the return address high bit unset is ABI-compliant
    (could confuse some unwinder?).  If that's a problem, it could be fixed
    by handling it in the jump pad (since at that point we can just modify
    the GPRs in the save area without having to worry about preserving
    CCs and only having that one GPR to work with - I'm not sure if it's
    even possible to set the high bit with such constraints).
    
    gdb/gdbserver/ChangeLog:
    
    	PR 18377
    	* Makefile.in: Add s390 IPA files.
    	* configure.srv: Build IPA for s390.
    	* linux-s390-ipa.c: New file.
    	* linux-s390-low.c: New includes - inttypes.h and linux-s390-tdesc.h.
    	(init_registers_s390_linux32): Move declaration to linux-s390-tdesc.h.
    	(tdesc_s390_linux32): Likewise.
    	(init_registers_s390_linux32v1): Likewise.
    	(tdesc_s390_linux32v1): Likewise.
    	(init_registers_s390_linux32v2): Likewise.
    	(tdesc_s390_linux32v2): Likewise.
    	(init_registers_s390_linux64): Likewise.
    	(tdesc_s390_linux64): Likewise.
    	(init_registers_s390_linux64v1): Likewise.
    	(tdesc_s390_linux64v1): Likewise.
    	(init_registers_s390_linux64v2): Likewise.
    	(tdesc_s390_linux64v2): Likewise.
    	(init_registers_s390_te_linux64): Likewise.
    	(tdesc_s390_te_linux64): Likewise.
    	(init_registers_s390_vx_linux64): Likewise.
    	(tdesc_s390_vx_linux64): Likewise.
    	(init_registers_s390_tevx_linux64): Likewise.
    	(tdesc_s390_tevx_linux64): Likewise.
    	(init_registers_s390x_linux64): Likewise.
    	(tdesc_s390x_linux64): Likewise.
    	(init_registers_s390x_linux64v1): Likewise.
    	(tdesc_s390x_linux64v1): Likewise.
    	(init_registers_s390x_linux64v2): Likewise.
    	(tdesc_s390x_linux64v2): Likewise.
    	(init_registers_s390x_te_linux64): Likewise.
    	(tdesc_s390x_te_linux64): Likewise.
    	(init_registers_s390x_vx_linux64): Likewise.
    	(tdesc_s390x_vx_linux64): Likewise.
    	(init_registers_s390x_tevx_linux64): Likewise.
    	(tdesc_s390x_tevx_linux64): Likewise.
    	(have_hwcap_s390_vx): New static variable.
    	(s390_arch_setup): Fill have_hwcap_s390_vx.
    	(s390_get_thread_area): New function.
    	(s390_ft_entry_gpr_esa): New const.
    	(s390_ft_entry_gpr_zarch): New const.
    	(s390_ft_entry_misc): New const.
    	(s390_ft_entry_fr): New const.
    	(s390_ft_entry_vr): New const.
    	(s390_ft_main_31): New const.
    	(s390_ft_main_64): New const.
    	(s390_ft_exit_fr): New const.
    	(s390_ft_exit_vr): New const.
    	(s390_ft_exit_misc): New const.
    	(s390_ft_exit_gpr_esa): New const.
    	(s390_ft_exit_gpr_zarch): New const.
    	(append_insns): New function.
    	(s390_relocate_instruction): New function.
    	(s390_install_fast_tracepoint_jump_pad): New function.
    	(s390_get_min_fast_tracepoint_insn_len): New function.
    	(s390_get_ipa_tdesc_idx): New function.
    	(struct linux_target_ops): Wire in the above functions.
    	(initialize_low_arch) [!__s390x__]: Don't initialize s390x tdescs.
    	* linux-s390-tdesc.h: New file.
    abd9baf9