Commit 92689021 by Doug Rupp Committed by Pierre-Marie de Rodat

[Ada] Enhance stack unwinding on VxWorks for AArch64

2018-05-21  Doug Rupp  <rupp@adacore.com>

gcc/ada/

	* sigtramp-vxworks-target.inc: Set cfa_reg properly from sigcontext
	pregs.
	(CFI_COMMON_REGS): Restore LR jic probed from prologue.
	(REGNO_PC_OFFSET): Change to correct value for Aarch64.

From-SVN: r260463
parent 9e40de1d
2018-04-04 Doug Rupp <rupp@adacore.com>
* sigtramp-vxworks-target.inc: Set cfa_reg properly from sigcontext
pregs.
(CFI_COMMON_REGS): Restore LR jic probed from prologue.
(REGNO_PC_OFFSET): Change to correct value for Aarch64.
2018-04-04 Jose Ruiz <ruiz@adacore.com> 2018-04-04 Jose Ruiz <ruiz@adacore.com>
* doc/gnat_ugn/gnat_utility_programs.rst, exp_attr.adb, * doc/gnat_ugn/gnat_utility_programs.rst, exp_attr.adb,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* Asm Implementation Include File * * Asm Implementation Include File *
* * * *
* Copyright (C) 2011-2017, Free Software Foundation, Inc. * * Copyright (C) 2011-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -100,17 +100,18 @@ ...@@ -100,17 +100,18 @@
#define FUNCTION "%function" #define FUNCTION "%function"
#ifdef __aarch64__ #ifdef __aarch64__
#define REGNO_PC_OFFSET 31 /* PC_REGNUM */ #define REGNO_PC_OFFSET 80 /* aka V16, a scratch register */
#else #else
#define REGNO_PC_OFFSET 15 /* PC_REGNUM */ #define REGNO_PC_OFFSET 15 /* PC_REGNUM */
#endif #endif
/* Mapping of CFI Column, Gcc Regno, Signal context offset for _LP64 /* Mapping of CFI Column, Gcc Regno, Signal context offset for _LP64
Name CFI GCC SCTX Name CFI GCC SCTX
G0-G30 0-30 0-30 G0-G30 0-30 0-30 0-30
PC 31 31 SP 31 31 31
V0-V31 64-95 32-63 PC 32
V0-V31 64-95 32-63 N/A
*/ */
...@@ -386,6 +387,7 @@ TCR(COMMON_CFI(G_REG_OFFSET(26))) \ ...@@ -386,6 +387,7 @@ TCR(COMMON_CFI(G_REG_OFFSET(26))) \
TCR(COMMON_CFI(G_REG_OFFSET(27))) \ TCR(COMMON_CFI(G_REG_OFFSET(27))) \
TCR(COMMON_CFI(G_REG_OFFSET(28))) \ TCR(COMMON_CFI(G_REG_OFFSET(28))) \
TCR(COMMON_CFI(G_REG_OFFSET(29))) \ TCR(COMMON_CFI(G_REG_OFFSET(29))) \
TCR(COMMON_CFI(G_REG_OFFSET(30))) \
TCR(COMMON_CFI(PC_OFFSET)) \ TCR(COMMON_CFI(PC_OFFSET)) \
TCR(".cfi_return_column " S(REGNO_PC_OFFSET)) TCR(".cfi_return_column " S(REGNO_PC_OFFSET))
#else #else
...@@ -417,10 +419,10 @@ TCR(".cfi_return_column " S(REGNO_PC_OFFSET)) ...@@ -417,10 +419,10 @@ TCR(".cfi_return_column " S(REGNO_PC_OFFSET))
CR("") \ CR("") \
TCR("# Push FP and LR on stack") \ TCR("# Push FP and LR on stack") \
TCR("stp x29, x30, [sp, #-16]!") \ TCR("stp x29, x30, [sp, #-16]!") \
TCR("# Push register used to hold the CFA on stack") \ TCR("# Push register used to hold the CFA on stack (pro forma)") \
TCR("str x" S(CFA_REG) ", [sp, #-8]!") \ TCR("str x" S(CFA_REG) ", [sp, #-8]!") \
TCR("# Set the CFA: x2 value") \ TCR("# Set the CFA reg from the 5th arg") \
TCR("mov x" S(CFA_REG) ", x2") \ TCR("mov x" S(CFA_REG) ", x4") \
TCR("# Call the handler") \ TCR("# Call the handler") \
TCR("blr x3") \ TCR("blr x3") \
TCR("# Release our frame and return (should never get here!).") \ TCR("# Release our frame and return (should never get here!).") \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment