aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sigtramp-ppcvxw.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-07 17:30:55 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-07 17:30:55 +0100
commitb5bf33351aa47106647ccb7a37a956739595ea24 (patch)
treee96f3aeea76722f22537edf282bc60a2833720c7 /gcc/ada/sigtramp-ppcvxw.c
parent9ee76313c4ae8b4a9b9f887ae67747017096c89d (diff)
downloadgcc-b5bf33351aa47106647ccb7a37a956739595ea24.zip
gcc-b5bf33351aa47106647ccb7a37a956739595ea24.tar.gz
gcc-b5bf33351aa47106647ccb7a37a956739595ea24.tar.bz2
[multiple changes]
2011-11-07 Olivier Hainque <hainque@adacore.com> * sigtramp-ppcvxw.c: Add general comments. (CFI_COMMON_REGS): Remove rule for r1, as in other unwinders. Add rules for r2 to r13, plus CTR and XER. (CFA_REG): New, register number used to hold the local CFA. (CFI_DEF_CFA, SIGTRAMP_BODY): Use it. Make that 15, not 14, with documentation. (TCR): Undef before definition, preventing conflict with reg number in VxWorks headers. 2011-11-07 Robert Dewar <dewar@adacore.com> * exp_util.ads, exp_alfa.adb, a-cohama.adb, a-cohama.ads, sem_ch4.adb, aspects.ads, exp_ch8.adb, exp_ch8.ads, atree.ads: Minor reformatting. * gcc-interface/Make-lang.in: Update dependencies. 2011-11-07 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb: A tagged type is a legal actual for an aliased formal. 2011-11-07 Pascal Obry <obry@adacore.com> * g-socket.adb, g-socket.ads: Minor reformatting. 2011-11-07 Robert Dewar <dewar@adacore.com> * sem_res.adb (Resolve_Actuals): Minor error message improvement. 2011-11-07 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Add discussion of default mode handling of source representation with no -gnatW option given, in particular noting that NEL (next line) is not recognized in this context. From-SVN: r181094
Diffstat (limited to 'gcc/ada/sigtramp-ppcvxw.c')
-rw-r--r--gcc/ada/sigtramp-ppcvxw.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/gcc/ada/sigtramp-ppcvxw.c b/gcc/ada/sigtramp-ppcvxw.c
index 57a02a7..bebe657 100644
--- a/gcc/ada/sigtramp-ppcvxw.c
+++ b/gcc/ada/sigtramp-ppcvxw.c
@@ -55,7 +55,11 @@
Checking which variant should apply and getting at sc_pregs is simpler
to express in C (we can't use offsetof in toplevel asms and hardcoding
constants is not workable with the flurry of VxWorks variants), so this
- is the choice for our toplevel interface. */
+ is the choice for our toplevel interface.
+
+ Note that the registers we "restore" here are those to which we have
+ direct access through the system sigcontext structure, which includes
+ only a partial set of the non-volatiles ABI-wise. */
/* -----------------------------------------
-- Protypes for our internal asm stubs --
@@ -120,8 +124,9 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
/* REGNO constants, dwarf column numbers for registers of interest. */
#define REGNO_LR 65
-#define REGNO_XER 76
+#define REGNO_CTR 66
#define REGNO_CR 70
+#define REGNO_XER 76
#define REGNO_GR(N) (N)
#define REGNO_PC 67 /* ARG_POINTER_REGNUM */
@@ -139,6 +144,8 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
multine contents: */
#define TAB(S) "\t" S
#define CR(S) S "\n"
+
+#undef TCR
#define TCR(S) TAB(CR(S))
/*------------------------------
@@ -147,11 +154,18 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
/* CFA setup block
---------------
- Only non-volatile registers are suitable for a CFA base. We use r14
- here and set it to the value we need in stub body that follows. */
+ Only non-volatile registers are suitable for a CFA base. These are the
+ only ones we can expect to be able retrieve from the unwinding context
+ while walking up the chain, saved by at least the bottom-most exception
+ propagation services. We use r15 here and set it to the value we need
+ in stub body that follows. Note that r14 is inappropriate here, even
+ though it is non-volatile according to the ABI, because GCC uses it as
+ an extra SCRATCH on SPE targets. */
+
+#define CFA_REG 15
#define CFI_DEF_CFA \
-CR(".cfi_def_cfa 14, 0")
+CR(".cfi_def_cfa " S(CFA_REG) ", 0")
/* Register location blocks
------------------------
@@ -164,7 +178,18 @@ CR(".cfi_def_cfa 14, 0")
#define CFI_COMMON_REGS \
CR("# CFI for common registers\n") \
-TCR(COMMON_CFI(GR(1))) \
+TCR(COMMON_CFI(GR(2))) \
+TCR(COMMON_CFI(GR(3))) \
+TCR(COMMON_CFI(GR(4))) \
+TCR(COMMON_CFI(GR(5))) \
+TCR(COMMON_CFI(GR(6))) \
+TCR(COMMON_CFI(GR(7))) \
+TCR(COMMON_CFI(GR(8))) \
+TCR(COMMON_CFI(GR(9))) \
+TCR(COMMON_CFI(GR(10))) \
+TCR(COMMON_CFI(GR(11))) \
+TCR(COMMON_CFI(GR(12))) \
+TCR(COMMON_CFI(GR(13))) \
TCR(COMMON_CFI(GR(14))) \
TCR(COMMON_CFI(GR(15))) \
TCR(COMMON_CFI(GR(16))) \
@@ -185,6 +210,8 @@ TCR(COMMON_CFI(GR(30))) \
TCR(COMMON_CFI(GR(31))) \
TCR(COMMON_CFI(LR)) \
TCR(COMMON_CFI(CR)) \
+TCR(COMMON_CFI(CTR)) \
+TCR(COMMON_CFI(XER)) \
TCR(COMMON_CFI(PC)) \
TCR(".cfi_return_column " S(REGNO_PC))
@@ -198,10 +225,10 @@ TCR("# registers we're going to modify") \
TCR("stwu %r1,-16(%r1)") \
TCR("mflr %r0") \
TCR("stw %r0,20(%r1)") \
-TCR("stw %r14,8(%r1)") \
+TCR("stw %r" S(CFA_REG) ",8(%r1)") \
TCR("") \
-TCR("# Setup r14 = sc_pregs, that we'll retrieve as our CFA value") \
-TCR("mr %r14, %r7") \
+TCR("# Setup CFA_REG = sc_pregs, that we'll retrieve as our CFA value") \
+TCR("mr %r" S(CFA_REG) ", %r7") \
TCR("") \
TCR("# Call the real handler. The signo, siginfo and sigcontext") \
TCR("# arguments are the same as those we received in r3, r4 and r5") \
@@ -209,7 +236,7 @@ TCR("mtctr %r6") \
TCR("bctrl") \
TCR("") \
TCR("# Restore our callee-saved items, release our frame and return") \
-TCR("lwz %r14,8(%r1)") \
+TCR("lwz %r" S(CFA_REG) ",8(%r1)") \
TCR("lwz %r0,20(%r1)") \
TCR("mtlr %r0") \
TCR("") \