162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file setups defines to compile arch specific binary from the
462306a36Sopenharmony_ci * generic one.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * The function 'LIBUNWIND__ARCH_REG_ID' name is set according to arch
762306a36Sopenharmony_ci * name and the definition of this function is included directly from
862306a36Sopenharmony_ci * 'arch/arm64/util/unwind-libunwind.c', to make sure that this function
962306a36Sopenharmony_ci * is defined no matter what arch the host is.
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * Finally, the arch specific unwind methods are exported which will
1262306a36Sopenharmony_ci * be assigned to each arm64 thread.
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define REMOTE_UNWIND_LIBUNWIND
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* Define arch specific functions & regs for libunwind, should be
1862306a36Sopenharmony_ci * defined before including "unwind.h"
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci#define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arm64_reg_id(regnum)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#include "unwind.h"
2362306a36Sopenharmony_ci#include "libunwind-aarch64.h"
2462306a36Sopenharmony_ci#define perf_event_arm_regs perf_event_arm64_regs
2562306a36Sopenharmony_ci#include <../../../arch/arm64/include/uapi/asm/perf_regs.h>
2662306a36Sopenharmony_ci#undef perf_event_arm_regs
2762306a36Sopenharmony_ci#include "../../arch/arm64/util/unwind-libunwind.c"
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* NO_LIBUNWIND_DEBUG_FRAME is a feature flag for local libunwind,
3062306a36Sopenharmony_ci * assign NO_LIBUNWIND_DEBUG_FRAME_AARCH64 to it for compiling arm64
3162306a36Sopenharmony_ci * unwind methods.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci#undef NO_LIBUNWIND_DEBUG_FRAME
3462306a36Sopenharmony_ci#ifdef NO_LIBUNWIND_DEBUG_FRAME_AARCH64
3562306a36Sopenharmony_ci#define NO_LIBUNWIND_DEBUG_FRAME
3662306a36Sopenharmony_ci#endif
3762306a36Sopenharmony_ci#include "util/unwind-libunwind-local.c"
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistruct unwind_libunwind_ops *
4062306a36Sopenharmony_ciarm64_unwind_libunwind_ops = &_unwind_libunwind_ops;
41