]> granicus.if.org Git - strace/commit
Refactor stack pointers
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 4 Dec 2018 22:31:41 +0000 (22:31 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 5 Dec 2018 16:10:05 +0000 (16:10 +0000)
commit917c2ccf3a677ab183d6a5f19dc801669ac2cc51
treeedb37e4e723d9b21072ba84e0c8fa93a6a903786
parentbcd5cdddec37dd5a9a7ccff6a1d93cf86209249f
Refactor stack pointers

Change all linux/*/arch_regs.c to provide either ARCH_SP_REG
or ARCH_SP_PEEK_ADDR.  Introduce get_stack_pointer(), rewrite
all code accessing stack pointers to use get_stack_pointer().
On some architectures stack pointers were referred to as frame pointers,
clean up this confusion.

* defs.h (get_stack_pointer): New prototype.
* syscall.c (get_stack_pointer): New function.
* linux/arch_rt_sigframe.c: New file.
* linux/aarch64/arch_regs.c (aarch64_sp_ptr, arm_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/alpha/arch_regs.c: Import linux/alpha/arch_regs.h.
(REG_FP): Rename to REG_SP.
(ARCH_SP_PEEK_ADDR): New macro.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/arc/arch_regs.c (arc_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/arm/arch_regs.c (arm_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/avr32/arch_regs.c (avr32_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/bfin/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/hppa/arch_regs.c: Import linux/hppa/arch_regs.h.
(PT_GR30, ARCH_SP_PEEK_ADDR): New macros.
* linux/hppa/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/i386/arch_regs.c (i386_esp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/i386/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/i386/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_regs.c (ia64_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/ia64/arch_regs.h (ia64_frame_ptr): Remove.
* linux/ia64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/m68k/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/metag/arch_regs.c (metag_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/metag/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/microblaze/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/mips/arch_regs.c: Import linux/mips/arch_regs.h.
(mips_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/nios2/arch_regs.c (nios2_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/or1k/arch_regs.c (or1k_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/powerpc/arch_regs.c (ppc_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/powerpc/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/powerpc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/riscv/arch_regs.c (riscv_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390/arch_regs.c (s390_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390/arch_sigreturn.c (S390_FRAME_PTR): Remove.
(arch_sigreturn): Use get_stack_pointer.
* linux/s390x/arch_regs.c (s390_frame_ptr, s390x_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390x/arch_sigreturn.c (S390_FRAME_PTR): Remove.
* linux/sh/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/sh64/arch_regs.c: Likewise.
* linux/sparc/arch_regs.c: Import linux/sparc/arch_regs.h.
(sparc_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/sparc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/tile/arch_regs.c (tile_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/x86_64/arch_regs.c (i386_esp_ptr, x86_64_rsp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/x86_64/arch_regs.h (i386_esp_ptr, x86_64_rsp_ptr): Remove.
* linux/x86_64/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
* linux/xtensa/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/aarch64/arch_regs.h: Remove.
* linux/aarch64/arch_rt_sigframe.c: Remove.
* linux/alpha/arch_regs.h: Remove.
* linux/alpha/arch_rt_sigframe.c: Remove.
* linux/arc/arch_regs.h: Remove.
* linux/arc/arch_rt_sigframe.c: Remove.
* linux/arm/arch_regs.h: Remove.
* linux/arm/arch_rt_sigframe.c: Remove.
* linux/avr32/arch_regs.h: Remove.
* linux/avr32/arch_rt_sigframe.c: Remove.
* linux/bfin/arch_rt_sigframe.c: Remove.
* linux/hppa/arch_regs.h: Remove.
* linux/i386/arch_regs.h: Remove.
* linux/m68k/arch_regs.h: Remove.
* linux/metag/arch_regs.h: Remove.
* linux/microblaze/arch_rt_sigframe.c: Remove.
* linux/mips/arch_regs.h: Remove.
* linux/mips/arch_rt_sigframe.c: Remove.
* linux/nios2/arch_regs.h: Remove.
* linux/nios2/arch_rt_sigframe.c: Remove.
* linux/or1k/arch_regs.h: Remove.
* linux/or1k/arch_rt_sigframe.c: Remove.
* linux/powerpc/arch_regs.h: Remove.
* linux/powerpc64/arch_regs.h: Remove.
* linux/riscv/arch_regs.h: Remove.
* linux/riscv/arch_rt_sigframe.c: Remove.
* linux/s390/arch_regs.h: Remove.
* linux/s390/arch_rt_sigframe.c: Remove.
* linux/s390x/arch_regs.h: Remove.
* linux/s390x/arch_rt_sigframe.c: Remove.
* linux/sh/arch_rt_sigframe.c: Remove.
* linux/sh64/arch_rt_sigframe.c: Remove.
* linux/sparc/arch_regs.h: Remove.
* linux/sparc/arch_rt_sigframe.c: Remove.
* linux/sparc64/arch_regs.h: Remove.
* linux/tile/arch_regs.h: Remove.
* linux/tile/arch_rt_sigframe.c: Remove.
* linux/xtensa/arch_rt_sigframe.c: Remove.
* Makefile.am (EXTRA_DIST): Remove them, add linux/arch_rt_sigframe.c.
87 files changed:
Makefile.am
defs.h
linux/aarch64/arch_regs.c
linux/aarch64/arch_regs.h [deleted file]
linux/aarch64/arch_rt_sigframe.c [deleted file]
linux/alpha/arch_regs.c
linux/alpha/arch_regs.h [deleted file]
linux/alpha/arch_rt_sigframe.c [deleted file]
linux/alpha/arch_sigreturn.c
linux/arc/arch_regs.c
linux/arc/arch_regs.h [deleted file]
linux/arc/arch_rt_sigframe.c [deleted file]
linux/arch_rt_sigframe.c [moved from linux/bfin/arch_rt_sigframe.c with 88% similarity]
linux/arm/arch_regs.c
linux/arm/arch_regs.h [deleted file]
linux/arm/arch_rt_sigframe.c [deleted file]
linux/arm/arch_sigreturn.c
linux/avr32/arch_regs.c
linux/avr32/arch_regs.h [deleted file]
linux/avr32/arch_rt_sigframe.c [deleted file]
linux/bfin/arch_regs.c
linux/hppa/arch_regs.c
linux/hppa/arch_regs.h [deleted file]
linux/hppa/arch_rt_sigframe.c
linux/i386/arch_regs.c
linux/i386/arch_regs.h [deleted file]
linux/i386/arch_rt_sigframe.c
linux/i386/arch_sigreturn.c
linux/ia64/arch_regs.c
linux/ia64/arch_regs.h
linux/ia64/arch_rt_sigframe.c
linux/m68k/arch_regs.c
linux/m68k/arch_regs.h [deleted file]
linux/m68k/arch_rt_sigframe.c
linux/m68k/arch_sigreturn.c
linux/metag/arch_regs.c
linux/metag/arch_regs.h [deleted file]
linux/metag/arch_rt_sigframe.c
linux/microblaze/arch_regs.c
linux/microblaze/arch_rt_sigframe.c [deleted file]
linux/mips/arch_regs.c
linux/mips/arch_regs.h [deleted file]
linux/mips/arch_rt_sigframe.c [deleted file]
linux/mips/arch_sigreturn.c
linux/nios2/arch_regs.c
linux/nios2/arch_regs.h [deleted file]
linux/nios2/arch_rt_sigframe.c [deleted file]
linux/or1k/arch_regs.c
linux/or1k/arch_regs.h [deleted file]
linux/or1k/arch_rt_sigframe.c [deleted file]
linux/powerpc/arch_regs.c
linux/powerpc/arch_regs.h [deleted file]
linux/powerpc/arch_rt_sigframe.c
linux/powerpc/arch_sigreturn.c
linux/powerpc64/arch_regs.h [deleted file]
linux/powerpc64/arch_rt_sigframe.c
linux/riscv/arch_regs.c
linux/riscv/arch_regs.h [deleted file]
linux/riscv/arch_rt_sigframe.c [deleted file]
linux/s390/arch_regs.c
linux/s390/arch_regs.h [deleted file]
linux/s390/arch_rt_sigframe.c [deleted file]
linux/s390/arch_sigreturn.c
linux/s390x/arch_regs.c
linux/s390x/arch_regs.h [deleted file]
linux/s390x/arch_rt_sigframe.c [deleted file]
linux/s390x/arch_sigreturn.c
linux/sh/arch_regs.c
linux/sh/arch_rt_sigframe.c [deleted file]
linux/sh64/arch_regs.c
linux/sh64/arch_rt_sigframe.c [deleted file]
linux/sparc/arch_regs.c
linux/sparc/arch_regs.h [deleted file]
linux/sparc/arch_rt_sigframe.c [deleted file]
linux/sparc/arch_sigreturn.c
linux/sparc64/arch_regs.h [deleted file]
linux/sparc64/arch_rt_sigframe.c
linux/tile/arch_regs.c
linux/tile/arch_regs.h [deleted file]
linux/tile/arch_rt_sigframe.c [deleted file]
linux/tile/arch_sigreturn.c
linux/x86_64/arch_regs.c
linux/x86_64/arch_regs.h
linux/x86_64/arch_rt_sigframe.c
linux/xtensa/arch_regs.c
linux/xtensa/arch_rt_sigframe.c [deleted file]
syscall.c