From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2098) id 9B4133858C2D; Mon, 23 Jan 2023 11:16:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B4133858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674472609; bh=34gzazvS48akbfim9Vt3xwrcwvsYavLgnVEInMrB4Cs=; h=From:To:Subject:Date:From; b=w61YtU50u+Lzi6Fgj6KgKj8wQVFpi6/KJGVUTW9td9I564Ccrn3OwBoYOYlDXERl4 zSLzSCWqNtoJipYJG6KjAxmzzQozr0FDooFh+3pt5lJWqCXNc8T3LnQXolk9u8Khe8 0TRDGzKMF6fOOfQeurFa8S+MkNvLWaNPaOo+IHNs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: SRINATH PARVATHANENI To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5304] arm: Add support for new frame unwinding instruction "0xb5". X-Act-Checkin: gcc X-Git-Author: Srinath Parvathaneni X-Git-Refname: refs/heads/master X-Git-Oldrev: 273874e925a544d96b8a9999d4c870c1f5191eeb X-Git-Newrev: 55a2d8096a799c682922b03bef7c0d4e4c1c8d7b Message-Id: <20230123111649.9B4133858C2D@sourceware.org> Date: Mon, 23 Jan 2023 11:16:49 +0000 (GMT) List-Id: https://gcc.gnu.org/g:55a2d8096a799c682922b03bef7c0d4e4c1c8d7b commit r13-5304-g55a2d8096a799c682922b03bef7c0d4e4c1c8d7b Author: Srinath Parvathaneni 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 * 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 abacfb62212..9c9d4eed85f 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;