From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2092) id 265523858414; Fri, 10 Mar 2023 16:22:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 265523858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678465329; bh=REdZ4jxyJWvn2rbVcgg30jhzOdrPCLmz+/omO5q6QEM=; h=From:To:Subject:Date:From; b=SpKQLqaesDb4qQgNUoGTE++wzxyDbSgibYb5jwj5P4WYlCe6sI6Uoq5lAWIF6ZKOS McmZaS+qD8Eze2k5o+MHP7TY59wix8mxjA6VqF3rBIlBipMKG4CQNoAgw+x+7cBQ2+ e7EWkKeaSKnxPXqYi4hjYb6Bn1Vo+nXvxB+iKK6Y= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Andrea Corallo To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] arm: Add support for new frame unwinding instruction "0xb5". X-Act-Checkin: gcc X-Git-Author: Srinath Parvathaneni X-Git-Refname: refs/vendors/ARM/heads/arm-12-m-pacbti X-Git-Oldrev: eb26fa78a8f5979800a835b2047b0b7e3260601e X-Git-Newrev: 28c545f81a888154ca8abf844197f4eca473e61d Message-Id: <20230310162209.265523858414@sourceware.org> Date: Fri, 10 Mar 2023 16:22:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:28c545f81a888154ca8abf844197f4eca473e61d commit 28c545f81a888154ca8abf844197f4eca473e61d 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 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;