xref: /OK3568_Linux_fs/kernel/tools/perf/util/libunwind/x86_32.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * This file setups defines to compile arch specific binary from the
4*4882a593Smuzhiyun  * generic one.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * The function 'LIBUNWIND__ARCH_REG_ID' name is set according to arch
7*4882a593Smuzhiyun  * name and the defination of this function is included directly from
8*4882a593Smuzhiyun  * 'arch/x86/util/unwind-libunwind.c', to make sure that this function
9*4882a593Smuzhiyun  * is defined no matter what arch the host is.
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * Finally, the arch specific unwind methods are exported which will
12*4882a593Smuzhiyun  * be assigned to each x86 thread.
13*4882a593Smuzhiyun  */
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #define REMOTE_UNWIND_LIBUNWIND
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun /* Define arch specific functions & regs for libunwind, should be
18*4882a593Smuzhiyun  * defined before including "unwind.h"
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__x86_reg_id(regnum)
21*4882a593Smuzhiyun #define LIBUNWIND__ARCH_REG_IP PERF_REG_X86_IP
22*4882a593Smuzhiyun #define LIBUNWIND__ARCH_REG_SP PERF_REG_X86_SP
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun #include "unwind.h"
25*4882a593Smuzhiyun #include "libunwind-x86.h"
26*4882a593Smuzhiyun #include <../../../../arch/x86/include/uapi/asm/perf_regs.h>
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /* HAVE_ARCH_X86_64_SUPPORT is used in'arch/x86/util/unwind-libunwind.c'
29*4882a593Smuzhiyun  * for x86_32, we undef it to compile code for x86_32 only.
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun #undef HAVE_ARCH_X86_64_SUPPORT
32*4882a593Smuzhiyun #include "../../arch/x86/util/unwind-libunwind.c"
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun /* Explicitly define NO_LIBUNWIND_DEBUG_FRAME, because non-ARM has no
35*4882a593Smuzhiyun  * dwarf_find_debug_frame() function.
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun #ifndef NO_LIBUNWIND_DEBUG_FRAME
38*4882a593Smuzhiyun #define NO_LIBUNWIND_DEBUG_FRAME
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun #include "util/unwind-libunwind-local.c"
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun struct unwind_libunwind_ops *
43*4882a593Smuzhiyun x86_32_unwind_libunwind_ops = &_unwind_libunwind_ops;
44