diff options
author | Alistair Delva <adelva@google.com> | 2021-02-16 21:01:22 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-16 21:01:22 +0000 |
commit | efb2826bb8160e2d8e0fcec85133a7468484f9fd (patch) | |
tree | 37a21c69306801ee7cdda5167a30896c8740155b /common/backtrace/backtrace.c | |
parent | b00a71fc312c9781fa6f404dccfb55b062b2ccac (diff) | |
parent | faa476c0caaa598afa5a6109d17102db5fe35ec6 (diff) | |
download | platform_external_arm-trusted-firmware-master.tar.gz platform_external_arm-trusted-firmware-master.tar.bz2 platform_external_arm-trusted-firmware-master.zip |
Merge branch 'aosp/upstream-master' into HEAD am: faa476c0caHEADandroid-s-beta-5android-s-beta-4android-s-beta-3android-s-beta-2android-s-beta-1mastermain-cg-testing-releaseandroid-s-beta-5android-s-beta-4
Original change: https://android-review.googlesource.com/c/platform/external/arm-trusted-firmware/+/1589611
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I3a25534ceed4f8e188510641080d8b8ed49b8f62
Diffstat (limited to 'common/backtrace/backtrace.c')
-rw-r--r-- | common/backtrace/backtrace.c | 55 |
1 files changed, 6 insertions, 49 deletions
diff --git a/common/backtrace/backtrace.c b/common/backtrace/backtrace.c index 506d4a482..25e2c707b 100644 --- a/common/backtrace/backtrace.c +++ b/common/backtrace/backtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -37,48 +37,7 @@ struct frame_record { uintptr_t return_addr; }; -/* - * Strip the Pointer Authentication Code (PAC) from the address to retrieve the - * original one. - * - * The PAC field is stored on the high bits of the address and defined as: - * - PAC field = Xn[54:bottom_PAC_bit], when address tagging is used. - * - PAC field = Xn[63:56, 54:bottom_PAC_bit], without address tagging. - * - * With bottom_PAC_bit = 64 - TCR_ELx.TnSZ - */ -#if ENABLE_PAUTH -static uintptr_t demangle_address(uintptr_t addr) -{ - unsigned int el, t0sz, bottom_pac_bit; - uint64_t tcr, pac_mask; - - /* - * Different virtual address space size can be defined for each EL. - * Ensure that we use the proper one by reading the corresponding - * TCR_ELx register. - */ - el = get_current_el(); - - if (el == 3U) { - tcr = read_tcr_el3(); - } else if (el == 2U) { - tcr = read_tcr_el2(); - } else { - tcr = read_tcr_el1(); - } - - /* T0SZ = TCR_ELx[5:0] */ - t0sz = tcr & 0x1f; - bottom_pac_bit = 64 - t0sz; - pac_mask = (1ULL << bottom_pac_bit) - 1; - - /* demangle the address with the computed mask */ - return (addr & pac_mask); -} -#endif /* ENABLE_PAUTH */ - -static const char *get_el_str(unsigned int el) +const char *get_el_str(unsigned int el) { if (el == 3U) { return "EL3"; @@ -104,15 +63,14 @@ static bool is_address_readable(uintptr_t addr) * stack contains a PAC. It must be stripped to retrieve the return * address. */ - addr = demangle_address(addr); + xpaci(addr); #endif - if (el == 3U) { ats1e3r(addr); } else if (el == 2U) { ats1e2r(addr); } else { - ats1e1r(addr); + AT(ats1e1r, addr); } isb(); @@ -257,9 +215,8 @@ static void unwind_stack(struct frame_record *fr, uintptr_t current_pc, * the stack contains a PAC. It must be stripped to retrieve the * return address. */ - call_site = demangle_address(call_site); + xpaci(call_site); #endif - /* * If the address is invalid it means that the frame record is * probably corrupted. @@ -304,7 +261,7 @@ void backtrace(const char *cookie) struct frame_record *fr = __builtin_frame_address(0U); /* Printing the backtrace may crash the system, flush before starting */ - (void)console_flush(); + console_flush(); fr = adjust_frame_record(fr); |