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/x86/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 x86 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__x86_reg_id(regnum)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#include "unwind.h"
2362306a36Sopenharmony_ci#include "libunwind-x86.h"
2462306a36Sopenharmony_ci#include <../../../../arch/x86/include/uapi/asm/perf_regs.h>
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* HAVE_ARCH_X86_64_SUPPORT is used in'arch/x86/util/unwind-libunwind.c'
2762306a36Sopenharmony_ci * for x86_32, we undef it to compile code for x86_32 only.
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_ci#undef HAVE_ARCH_X86_64_SUPPORT
3062306a36Sopenharmony_ci#include "../../arch/x86/util/unwind-libunwind.c"
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/* Explicitly define NO_LIBUNWIND_DEBUG_FRAME, because non-ARM has no
3362306a36Sopenharmony_ci * dwarf_find_debug_frame() function.
3462306a36Sopenharmony_ci */
3562306a36Sopenharmony_ci#ifndef NO_LIBUNWIND_DEBUG_FRAME
3662306a36Sopenharmony_ci#define NO_LIBUNWIND_DEBUG_FRAME
3762306a36Sopenharmony_ci#endif
3862306a36Sopenharmony_ci#include "util/unwind-libunwind-local.c"
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cistruct unwind_libunwind_ops *
4162306a36Sopenharmony_cix86_32_unwind_libunwind_ops = &_unwind_libunwind_ops;
42