18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file setups defines to compile arch specific binary from the
48c2ecf20Sopenharmony_ci * generic one.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * The function 'LIBUNWIND__ARCH_REG_ID' name is set according to arch
78c2ecf20Sopenharmony_ci * name and the defination of this function is included directly from
88c2ecf20Sopenharmony_ci * 'arch/x86/util/unwind-libunwind.c', to make sure that this function
98c2ecf20Sopenharmony_ci * is defined no matter what arch the host is.
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * Finally, the arch specific unwind methods are exported which will
128c2ecf20Sopenharmony_ci * be assigned to each x86 thread.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define REMOTE_UNWIND_LIBUNWIND
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Define arch specific functions & regs for libunwind, should be
188c2ecf20Sopenharmony_ci * defined before including "unwind.h"
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__x86_reg_id(regnum)
218c2ecf20Sopenharmony_ci#define LIBUNWIND__ARCH_REG_IP PERF_REG_X86_IP
228c2ecf20Sopenharmony_ci#define LIBUNWIND__ARCH_REG_SP PERF_REG_X86_SP
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include "unwind.h"
258c2ecf20Sopenharmony_ci#include "libunwind-x86.h"
268c2ecf20Sopenharmony_ci#include <../../../../arch/x86/include/uapi/asm/perf_regs.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* HAVE_ARCH_X86_64_SUPPORT is used in'arch/x86/util/unwind-libunwind.c'
298c2ecf20Sopenharmony_ci * for x86_32, we undef it to compile code for x86_32 only.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#undef HAVE_ARCH_X86_64_SUPPORT
328c2ecf20Sopenharmony_ci#include "../../arch/x86/util/unwind-libunwind.c"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Explicitly define NO_LIBUNWIND_DEBUG_FRAME, because non-ARM has no
358c2ecf20Sopenharmony_ci * dwarf_find_debug_frame() function.
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_ci#ifndef NO_LIBUNWIND_DEBUG_FRAME
388c2ecf20Sopenharmony_ci#define NO_LIBUNWIND_DEBUG_FRAME
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci#include "util/unwind-libunwind-local.c"
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistruct unwind_libunwind_ops *
438c2ecf20Sopenharmony_cix86_32_unwind_libunwind_ops = &_unwind_libunwind_ops;
44