public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] arm: Add support for new frame unwinding instruction "0xb5".
@ 2023-03-10 16:22 Andrea Corallo
  0 siblings, 0 replies; only message in thread
From: Andrea Corallo @ 2023-03-10 16:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:28c545f81a888154ca8abf844197f4eca473e61d

commit 28c545f81a888154ca8abf844197f4eca473e61d
Author: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
Date:   Mon Jan 23 11:13:18 2023 +0000

    arm: Add support for new frame unwinding instruction "0xb5".
    
    This patch adds support for Arm frame unwinding instruction "0xb5" [1]. When
    an exception is taken and "0xb5" instruction is encounter during runtime
    stack-unwinding, we use effective vsp as modifier in pointer authentication.
    On completion of stack unwinding if "0xb5" instruction is not encountered
    then CFA will be used as modifier in pointer authentication.
    
    [1] https://github.com/ARM-software/abi-aa/releases/download/2022Q3/ehabi32.pdf
    
    libgcc/ChangeLog:
    
    2022-11-09  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
    
            * config/arm/pr-support.c (__gnu_unwind_execute): Decode opcode
            "0xb5".

Diff:
---
 libgcc/config/arm/pr-support.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libgcc/config/arm/pr-support.c b/libgcc/config/arm/pr-support.c
index e48854587c6..1fbc41e17c2 100644
--- a/libgcc/config/arm/pr-support.c
+++ b/libgcc/config/arm/pr-support.c
@@ -107,7 +107,9 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws)
   _uw op;
   int set_pc;
   int set_pac = 0;
+  int set_pac_sp = 0;
   _uw reg;
+  _uw sp;
 
   set_pc = 0;
   for (;;)
@@ -124,10 +126,11 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws)
 #if defined(TARGET_HAVE_PACBTI)
 	  if (set_pac)
 	    {
-	      _uw sp;
 	      _uw lr;
 	      _uw pac;
-	      _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp);
+	      if (!set_pac_sp)
+		_Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32,
+				 &sp);
 	      _Unwind_VRS_Get (context, _UVRSC_CORE, R_LR, _UVRSD_UINT32, &lr);
 	      _Unwind_VRS_Get (context, _UVRSC_PAC, R_IP,
 			       _UVRSD_UINT32, &pac);
@@ -259,6 +262,14 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws)
 	      continue;
 	    }
 
+	  /* Use current VSP as modifier in PAC validation.  */
+	  if (op == 0xb5)
+	    {
+	      _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp);
+	      set_pac_sp = 1;
+	      continue;
+	    }
+
 	  if ((op & 0xfc) == 0xb4)  /* Obsolete FPA.  */
 	    return _URC_FAILURE;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10 16:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 16:22 [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] arm: Add support for new frame unwinding instruction "0xb5" Andrea Corallo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).