18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Copyright (C) 2009 Matt Fleming <matt@console-pimps.org> 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef __ASM_SH_DWARF_H 68c2ecf20Sopenharmony_ci#define __ASM_SH_DWARF_H 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifdef CONFIG_DWARF_UNWINDER 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* 118c2ecf20Sopenharmony_ci * DWARF expression operations 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci#define DW_OP_addr 0x03 148c2ecf20Sopenharmony_ci#define DW_OP_deref 0x06 158c2ecf20Sopenharmony_ci#define DW_OP_const1u 0x08 168c2ecf20Sopenharmony_ci#define DW_OP_const1s 0x09 178c2ecf20Sopenharmony_ci#define DW_OP_const2u 0x0a 188c2ecf20Sopenharmony_ci#define DW_OP_const2s 0x0b 198c2ecf20Sopenharmony_ci#define DW_OP_const4u 0x0c 208c2ecf20Sopenharmony_ci#define DW_OP_const4s 0x0d 218c2ecf20Sopenharmony_ci#define DW_OP_const8u 0x0e 228c2ecf20Sopenharmony_ci#define DW_OP_const8s 0x0f 238c2ecf20Sopenharmony_ci#define DW_OP_constu 0x10 248c2ecf20Sopenharmony_ci#define DW_OP_consts 0x11 258c2ecf20Sopenharmony_ci#define DW_OP_dup 0x12 268c2ecf20Sopenharmony_ci#define DW_OP_drop 0x13 278c2ecf20Sopenharmony_ci#define DW_OP_over 0x14 288c2ecf20Sopenharmony_ci#define DW_OP_pick 0x15 298c2ecf20Sopenharmony_ci#define DW_OP_swap 0x16 308c2ecf20Sopenharmony_ci#define DW_OP_rot 0x17 318c2ecf20Sopenharmony_ci#define DW_OP_xderef 0x18 328c2ecf20Sopenharmony_ci#define DW_OP_abs 0x19 338c2ecf20Sopenharmony_ci#define DW_OP_and 0x1a 348c2ecf20Sopenharmony_ci#define DW_OP_div 0x1b 358c2ecf20Sopenharmony_ci#define DW_OP_minus 0x1c 368c2ecf20Sopenharmony_ci#define DW_OP_mod 0x1d 378c2ecf20Sopenharmony_ci#define DW_OP_mul 0x1e 388c2ecf20Sopenharmony_ci#define DW_OP_neg 0x1f 398c2ecf20Sopenharmony_ci#define DW_OP_not 0x20 408c2ecf20Sopenharmony_ci#define DW_OP_or 0x21 418c2ecf20Sopenharmony_ci#define DW_OP_plus 0x22 428c2ecf20Sopenharmony_ci#define DW_OP_plus_uconst 0x23 438c2ecf20Sopenharmony_ci#define DW_OP_shl 0x24 448c2ecf20Sopenharmony_ci#define DW_OP_shr 0x25 458c2ecf20Sopenharmony_ci#define DW_OP_shra 0x26 468c2ecf20Sopenharmony_ci#define DW_OP_xor 0x27 478c2ecf20Sopenharmony_ci#define DW_OP_skip 0x2f 488c2ecf20Sopenharmony_ci#define DW_OP_bra 0x28 498c2ecf20Sopenharmony_ci#define DW_OP_eq 0x29 508c2ecf20Sopenharmony_ci#define DW_OP_ge 0x2a 518c2ecf20Sopenharmony_ci#define DW_OP_gt 0x2b 528c2ecf20Sopenharmony_ci#define DW_OP_le 0x2c 538c2ecf20Sopenharmony_ci#define DW_OP_lt 0x2d 548c2ecf20Sopenharmony_ci#define DW_OP_ne 0x2e 558c2ecf20Sopenharmony_ci#define DW_OP_lit0 0x30 568c2ecf20Sopenharmony_ci#define DW_OP_lit1 0x31 578c2ecf20Sopenharmony_ci#define DW_OP_lit2 0x32 588c2ecf20Sopenharmony_ci#define DW_OP_lit3 0x33 598c2ecf20Sopenharmony_ci#define DW_OP_lit4 0x34 608c2ecf20Sopenharmony_ci#define DW_OP_lit5 0x35 618c2ecf20Sopenharmony_ci#define DW_OP_lit6 0x36 628c2ecf20Sopenharmony_ci#define DW_OP_lit7 0x37 638c2ecf20Sopenharmony_ci#define DW_OP_lit8 0x38 648c2ecf20Sopenharmony_ci#define DW_OP_lit9 0x39 658c2ecf20Sopenharmony_ci#define DW_OP_lit10 0x3a 668c2ecf20Sopenharmony_ci#define DW_OP_lit11 0x3b 678c2ecf20Sopenharmony_ci#define DW_OP_lit12 0x3c 688c2ecf20Sopenharmony_ci#define DW_OP_lit13 0x3d 698c2ecf20Sopenharmony_ci#define DW_OP_lit14 0x3e 708c2ecf20Sopenharmony_ci#define DW_OP_lit15 0x3f 718c2ecf20Sopenharmony_ci#define DW_OP_lit16 0x40 728c2ecf20Sopenharmony_ci#define DW_OP_lit17 0x41 738c2ecf20Sopenharmony_ci#define DW_OP_lit18 0x42 748c2ecf20Sopenharmony_ci#define DW_OP_lit19 0x43 758c2ecf20Sopenharmony_ci#define DW_OP_lit20 0x44 768c2ecf20Sopenharmony_ci#define DW_OP_lit21 0x45 778c2ecf20Sopenharmony_ci#define DW_OP_lit22 0x46 788c2ecf20Sopenharmony_ci#define DW_OP_lit23 0x47 798c2ecf20Sopenharmony_ci#define DW_OP_lit24 0x48 808c2ecf20Sopenharmony_ci#define DW_OP_lit25 0x49 818c2ecf20Sopenharmony_ci#define DW_OP_lit26 0x4a 828c2ecf20Sopenharmony_ci#define DW_OP_lit27 0x4b 838c2ecf20Sopenharmony_ci#define DW_OP_lit28 0x4c 848c2ecf20Sopenharmony_ci#define DW_OP_lit29 0x4d 858c2ecf20Sopenharmony_ci#define DW_OP_lit30 0x4e 868c2ecf20Sopenharmony_ci#define DW_OP_lit31 0x4f 878c2ecf20Sopenharmony_ci#define DW_OP_reg0 0x50 888c2ecf20Sopenharmony_ci#define DW_OP_reg1 0x51 898c2ecf20Sopenharmony_ci#define DW_OP_reg2 0x52 908c2ecf20Sopenharmony_ci#define DW_OP_reg3 0x53 918c2ecf20Sopenharmony_ci#define DW_OP_reg4 0x54 928c2ecf20Sopenharmony_ci#define DW_OP_reg5 0x55 938c2ecf20Sopenharmony_ci#define DW_OP_reg6 0x56 948c2ecf20Sopenharmony_ci#define DW_OP_reg7 0x57 958c2ecf20Sopenharmony_ci#define DW_OP_reg8 0x58 968c2ecf20Sopenharmony_ci#define DW_OP_reg9 0x59 978c2ecf20Sopenharmony_ci#define DW_OP_reg10 0x5a 988c2ecf20Sopenharmony_ci#define DW_OP_reg11 0x5b 998c2ecf20Sopenharmony_ci#define DW_OP_reg12 0x5c 1008c2ecf20Sopenharmony_ci#define DW_OP_reg13 0x5d 1018c2ecf20Sopenharmony_ci#define DW_OP_reg14 0x5e 1028c2ecf20Sopenharmony_ci#define DW_OP_reg15 0x5f 1038c2ecf20Sopenharmony_ci#define DW_OP_reg16 0x60 1048c2ecf20Sopenharmony_ci#define DW_OP_reg17 0x61 1058c2ecf20Sopenharmony_ci#define DW_OP_reg18 0x62 1068c2ecf20Sopenharmony_ci#define DW_OP_reg19 0x63 1078c2ecf20Sopenharmony_ci#define DW_OP_reg20 0x64 1088c2ecf20Sopenharmony_ci#define DW_OP_reg21 0x65 1098c2ecf20Sopenharmony_ci#define DW_OP_reg22 0x66 1108c2ecf20Sopenharmony_ci#define DW_OP_reg23 0x67 1118c2ecf20Sopenharmony_ci#define DW_OP_reg24 0x68 1128c2ecf20Sopenharmony_ci#define DW_OP_reg25 0x69 1138c2ecf20Sopenharmony_ci#define DW_OP_reg26 0x6a 1148c2ecf20Sopenharmony_ci#define DW_OP_reg27 0x6b 1158c2ecf20Sopenharmony_ci#define DW_OP_reg28 0x6c 1168c2ecf20Sopenharmony_ci#define DW_OP_reg29 0x6d 1178c2ecf20Sopenharmony_ci#define DW_OP_reg30 0x6e 1188c2ecf20Sopenharmony_ci#define DW_OP_reg31 0x6f 1198c2ecf20Sopenharmony_ci#define DW_OP_breg0 0x70 1208c2ecf20Sopenharmony_ci#define DW_OP_breg1 0x71 1218c2ecf20Sopenharmony_ci#define DW_OP_breg2 0x72 1228c2ecf20Sopenharmony_ci#define DW_OP_breg3 0x73 1238c2ecf20Sopenharmony_ci#define DW_OP_breg4 0x74 1248c2ecf20Sopenharmony_ci#define DW_OP_breg5 0x75 1258c2ecf20Sopenharmony_ci#define DW_OP_breg6 0x76 1268c2ecf20Sopenharmony_ci#define DW_OP_breg7 0x77 1278c2ecf20Sopenharmony_ci#define DW_OP_breg8 0x78 1288c2ecf20Sopenharmony_ci#define DW_OP_breg9 0x79 1298c2ecf20Sopenharmony_ci#define DW_OP_breg10 0x7a 1308c2ecf20Sopenharmony_ci#define DW_OP_breg11 0x7b 1318c2ecf20Sopenharmony_ci#define DW_OP_breg12 0x7c 1328c2ecf20Sopenharmony_ci#define DW_OP_breg13 0x7d 1338c2ecf20Sopenharmony_ci#define DW_OP_breg14 0x7e 1348c2ecf20Sopenharmony_ci#define DW_OP_breg15 0x7f 1358c2ecf20Sopenharmony_ci#define DW_OP_breg16 0x80 1368c2ecf20Sopenharmony_ci#define DW_OP_breg17 0x81 1378c2ecf20Sopenharmony_ci#define DW_OP_breg18 0x82 1388c2ecf20Sopenharmony_ci#define DW_OP_breg19 0x83 1398c2ecf20Sopenharmony_ci#define DW_OP_breg20 0x84 1408c2ecf20Sopenharmony_ci#define DW_OP_breg21 0x85 1418c2ecf20Sopenharmony_ci#define DW_OP_breg22 0x86 1428c2ecf20Sopenharmony_ci#define DW_OP_breg23 0x87 1438c2ecf20Sopenharmony_ci#define DW_OP_breg24 0x88 1448c2ecf20Sopenharmony_ci#define DW_OP_breg25 0x89 1458c2ecf20Sopenharmony_ci#define DW_OP_breg26 0x8a 1468c2ecf20Sopenharmony_ci#define DW_OP_breg27 0x8b 1478c2ecf20Sopenharmony_ci#define DW_OP_breg28 0x8c 1488c2ecf20Sopenharmony_ci#define DW_OP_breg29 0x8d 1498c2ecf20Sopenharmony_ci#define DW_OP_breg30 0x8e 1508c2ecf20Sopenharmony_ci#define DW_OP_breg31 0x8f 1518c2ecf20Sopenharmony_ci#define DW_OP_regx 0x90 1528c2ecf20Sopenharmony_ci#define DW_OP_fbreg 0x91 1538c2ecf20Sopenharmony_ci#define DW_OP_bregx 0x92 1548c2ecf20Sopenharmony_ci#define DW_OP_piece 0x93 1558c2ecf20Sopenharmony_ci#define DW_OP_deref_size 0x94 1568c2ecf20Sopenharmony_ci#define DW_OP_xderef_size 0x95 1578c2ecf20Sopenharmony_ci#define DW_OP_nop 0x96 1588c2ecf20Sopenharmony_ci#define DW_OP_push_object_address 0x97 1598c2ecf20Sopenharmony_ci#define DW_OP_call2 0x98 1608c2ecf20Sopenharmony_ci#define DW_OP_call4 0x99 1618c2ecf20Sopenharmony_ci#define DW_OP_call_ref 0x9a 1628c2ecf20Sopenharmony_ci#define DW_OP_form_tls_address 0x9b 1638c2ecf20Sopenharmony_ci#define DW_OP_call_frame_cfa 0x9c 1648c2ecf20Sopenharmony_ci#define DW_OP_bit_piece 0x9d 1658c2ecf20Sopenharmony_ci#define DW_OP_lo_user 0xe0 1668c2ecf20Sopenharmony_ci#define DW_OP_hi_user 0xff 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci/* 1698c2ecf20Sopenharmony_ci * Addresses used in FDE entries in the .eh_frame section may be encoded 1708c2ecf20Sopenharmony_ci * using one of the following encodings. 1718c2ecf20Sopenharmony_ci */ 1728c2ecf20Sopenharmony_ci#define DW_EH_PE_absptr 0x00 1738c2ecf20Sopenharmony_ci#define DW_EH_PE_omit 0xff 1748c2ecf20Sopenharmony_ci#define DW_EH_PE_uleb128 0x01 1758c2ecf20Sopenharmony_ci#define DW_EH_PE_udata2 0x02 1768c2ecf20Sopenharmony_ci#define DW_EH_PE_udata4 0x03 1778c2ecf20Sopenharmony_ci#define DW_EH_PE_udata8 0x04 1788c2ecf20Sopenharmony_ci#define DW_EH_PE_sleb128 0x09 1798c2ecf20Sopenharmony_ci#define DW_EH_PE_sdata2 0x0a 1808c2ecf20Sopenharmony_ci#define DW_EH_PE_sdata4 0x0b 1818c2ecf20Sopenharmony_ci#define DW_EH_PE_sdata8 0x0c 1828c2ecf20Sopenharmony_ci#define DW_EH_PE_signed 0x09 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci#define DW_EH_PE_pcrel 0x10 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/* 1878c2ecf20Sopenharmony_ci * The architecture-specific register number that contains the return 1888c2ecf20Sopenharmony_ci * address in the .debug_frame table. 1898c2ecf20Sopenharmony_ci */ 1908c2ecf20Sopenharmony_ci#define DWARF_ARCH_RA_REG 17 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci#include <linux/compiler.h> 1958c2ecf20Sopenharmony_ci#include <linux/bug.h> 1968c2ecf20Sopenharmony_ci#include <linux/list.h> 1978c2ecf20Sopenharmony_ci#include <linux/module.h> 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci/* 2008c2ecf20Sopenharmony_ci * Read either the frame pointer (r14) or the stack pointer (r15). 2018c2ecf20Sopenharmony_ci * NOTE: this MUST be inlined. 2028c2ecf20Sopenharmony_ci */ 2038c2ecf20Sopenharmony_cistatic __always_inline unsigned long dwarf_read_arch_reg(unsigned int reg) 2048c2ecf20Sopenharmony_ci{ 2058c2ecf20Sopenharmony_ci unsigned long value = 0; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci switch (reg) { 2088c2ecf20Sopenharmony_ci case 14: 2098c2ecf20Sopenharmony_ci __asm__ __volatile__("mov r14, %0\n" : "=r" (value)); 2108c2ecf20Sopenharmony_ci break; 2118c2ecf20Sopenharmony_ci case 15: 2128c2ecf20Sopenharmony_ci __asm__ __volatile__("mov r15, %0\n" : "=r" (value)); 2138c2ecf20Sopenharmony_ci break; 2148c2ecf20Sopenharmony_ci default: 2158c2ecf20Sopenharmony_ci BUG(); 2168c2ecf20Sopenharmony_ci } 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci return value; 2198c2ecf20Sopenharmony_ci} 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci/** 2228c2ecf20Sopenharmony_ci * dwarf_cie - Common Information Entry 2238c2ecf20Sopenharmony_ci */ 2248c2ecf20Sopenharmony_cistruct dwarf_cie { 2258c2ecf20Sopenharmony_ci unsigned long length; 2268c2ecf20Sopenharmony_ci unsigned long cie_id; 2278c2ecf20Sopenharmony_ci unsigned char version; 2288c2ecf20Sopenharmony_ci const char *augmentation; 2298c2ecf20Sopenharmony_ci unsigned int code_alignment_factor; 2308c2ecf20Sopenharmony_ci int data_alignment_factor; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci /* Which column in the rule table represents return addr of func. */ 2338c2ecf20Sopenharmony_ci unsigned int return_address_reg; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci unsigned char *initial_instructions; 2368c2ecf20Sopenharmony_ci unsigned char *instructions_end; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci unsigned char encoding; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci unsigned long cie_pointer; 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci unsigned long flags; 2438c2ecf20Sopenharmony_ci#define DWARF_CIE_Z_AUGMENTATION (1 << 0) 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci /* linked-list entry if this CIE is from a module */ 2468c2ecf20Sopenharmony_ci struct list_head link; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci struct rb_node node; 2498c2ecf20Sopenharmony_ci}; 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci/** 2528c2ecf20Sopenharmony_ci * dwarf_fde - Frame Description Entry 2538c2ecf20Sopenharmony_ci */ 2548c2ecf20Sopenharmony_cistruct dwarf_fde { 2558c2ecf20Sopenharmony_ci unsigned long length; 2568c2ecf20Sopenharmony_ci unsigned long cie_pointer; 2578c2ecf20Sopenharmony_ci struct dwarf_cie *cie; 2588c2ecf20Sopenharmony_ci unsigned long initial_location; 2598c2ecf20Sopenharmony_ci unsigned long address_range; 2608c2ecf20Sopenharmony_ci unsigned char *instructions; 2618c2ecf20Sopenharmony_ci unsigned char *end; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci /* linked-list entry if this FDE is from a module */ 2648c2ecf20Sopenharmony_ci struct list_head link; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci struct rb_node node; 2678c2ecf20Sopenharmony_ci}; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci/** 2708c2ecf20Sopenharmony_ci * dwarf_frame - DWARF information for a frame in the call stack 2718c2ecf20Sopenharmony_ci */ 2728c2ecf20Sopenharmony_cistruct dwarf_frame { 2738c2ecf20Sopenharmony_ci struct dwarf_frame *prev, *next; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci unsigned long pc; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci struct list_head reg_list; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci unsigned long cfa; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci /* Valid when DW_FRAME_CFA_REG_OFFSET is set in flags */ 2828c2ecf20Sopenharmony_ci unsigned int cfa_register; 2838c2ecf20Sopenharmony_ci unsigned int cfa_offset; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci /* Valid when DW_FRAME_CFA_REG_EXP is set in flags */ 2868c2ecf20Sopenharmony_ci unsigned char *cfa_expr; 2878c2ecf20Sopenharmony_ci unsigned int cfa_expr_len; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci unsigned long flags; 2908c2ecf20Sopenharmony_ci#define DWARF_FRAME_CFA_REG_OFFSET (1 << 0) 2918c2ecf20Sopenharmony_ci#define DWARF_FRAME_CFA_REG_EXP (1 << 1) 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci unsigned long return_addr; 2948c2ecf20Sopenharmony_ci}; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci/** 2978c2ecf20Sopenharmony_ci * dwarf_reg - DWARF register 2988c2ecf20Sopenharmony_ci * @flags: Describes how to calculate the value of this register 2998c2ecf20Sopenharmony_ci */ 3008c2ecf20Sopenharmony_cistruct dwarf_reg { 3018c2ecf20Sopenharmony_ci struct list_head link; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci unsigned int number; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci unsigned long addr; 3068c2ecf20Sopenharmony_ci unsigned long flags; 3078c2ecf20Sopenharmony_ci#define DWARF_REG_OFFSET (1 << 0) 3088c2ecf20Sopenharmony_ci#define DWARF_VAL_OFFSET (1 << 1) 3098c2ecf20Sopenharmony_ci#define DWARF_UNDEFINED (1 << 2) 3108c2ecf20Sopenharmony_ci}; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/* 3138c2ecf20Sopenharmony_ci * Call Frame instruction opcodes. 3148c2ecf20Sopenharmony_ci */ 3158c2ecf20Sopenharmony_ci#define DW_CFA_advance_loc 0x40 3168c2ecf20Sopenharmony_ci#define DW_CFA_offset 0x80 3178c2ecf20Sopenharmony_ci#define DW_CFA_restore 0xc0 3188c2ecf20Sopenharmony_ci#define DW_CFA_nop 0x00 3198c2ecf20Sopenharmony_ci#define DW_CFA_set_loc 0x01 3208c2ecf20Sopenharmony_ci#define DW_CFA_advance_loc1 0x02 3218c2ecf20Sopenharmony_ci#define DW_CFA_advance_loc2 0x03 3228c2ecf20Sopenharmony_ci#define DW_CFA_advance_loc4 0x04 3238c2ecf20Sopenharmony_ci#define DW_CFA_offset_extended 0x05 3248c2ecf20Sopenharmony_ci#define DW_CFA_restore_extended 0x06 3258c2ecf20Sopenharmony_ci#define DW_CFA_undefined 0x07 3268c2ecf20Sopenharmony_ci#define DW_CFA_same_value 0x08 3278c2ecf20Sopenharmony_ci#define DW_CFA_register 0x09 3288c2ecf20Sopenharmony_ci#define DW_CFA_remember_state 0x0a 3298c2ecf20Sopenharmony_ci#define DW_CFA_restore_state 0x0b 3308c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa 0x0c 3318c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa_register 0x0d 3328c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa_offset 0x0e 3338c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa_expression 0x0f 3348c2ecf20Sopenharmony_ci#define DW_CFA_expression 0x10 3358c2ecf20Sopenharmony_ci#define DW_CFA_offset_extended_sf 0x11 3368c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa_sf 0x12 3378c2ecf20Sopenharmony_ci#define DW_CFA_def_cfa_offset_sf 0x13 3388c2ecf20Sopenharmony_ci#define DW_CFA_val_offset 0x14 3398c2ecf20Sopenharmony_ci#define DW_CFA_val_offset_sf 0x15 3408c2ecf20Sopenharmony_ci#define DW_CFA_val_expression 0x16 3418c2ecf20Sopenharmony_ci#define DW_CFA_lo_user 0x1c 3428c2ecf20Sopenharmony_ci#define DW_CFA_hi_user 0x3f 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci/* GNU extension opcodes */ 3458c2ecf20Sopenharmony_ci#define DW_CFA_GNU_args_size 0x2e 3468c2ecf20Sopenharmony_ci#define DW_CFA_GNU_negative_offset_extended 0x2f 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci/* 3498c2ecf20Sopenharmony_ci * Some call frame instructions encode their operands in the opcode. We 3508c2ecf20Sopenharmony_ci * need some helper functions to extract both the opcode and operands 3518c2ecf20Sopenharmony_ci * from an instruction. 3528c2ecf20Sopenharmony_ci */ 3538c2ecf20Sopenharmony_cistatic inline unsigned int DW_CFA_opcode(unsigned long insn) 3548c2ecf20Sopenharmony_ci{ 3558c2ecf20Sopenharmony_ci return (insn & 0xc0); 3568c2ecf20Sopenharmony_ci} 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_cistatic inline unsigned int DW_CFA_operand(unsigned long insn) 3598c2ecf20Sopenharmony_ci{ 3608c2ecf20Sopenharmony_ci return (insn & 0x3f); 3618c2ecf20Sopenharmony_ci} 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci#define DW_EH_FRAME_CIE 0 /* .eh_frame CIE IDs are 0 */ 3648c2ecf20Sopenharmony_ci#define DW_CIE_ID 0xffffffff 3658c2ecf20Sopenharmony_ci#define DW64_CIE_ID 0xffffffffffffffffULL 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci/* 3688c2ecf20Sopenharmony_ci * DWARF FDE/CIE length field values. 3698c2ecf20Sopenharmony_ci */ 3708c2ecf20Sopenharmony_ci#define DW_EXT_LO 0xfffffff0 3718c2ecf20Sopenharmony_ci#define DW_EXT_HI 0xffffffff 3728c2ecf20Sopenharmony_ci#define DW_EXT_DWARF64 DW_EXT_HI 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ciextern struct dwarf_frame *dwarf_unwind_stack(unsigned long, 3758c2ecf20Sopenharmony_ci struct dwarf_frame *); 3768c2ecf20Sopenharmony_ciextern void dwarf_free_frame(struct dwarf_frame *); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ciextern int module_dwarf_finalize(const Elf_Ehdr *, const Elf_Shdr *, 3798c2ecf20Sopenharmony_ci struct module *); 3808c2ecf20Sopenharmony_ciextern void module_dwarf_cleanup(struct module *); 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci#define CFI_STARTPROC .cfi_startproc 3858c2ecf20Sopenharmony_ci#define CFI_ENDPROC .cfi_endproc 3868c2ecf20Sopenharmony_ci#define CFI_DEF_CFA .cfi_def_cfa 3878c2ecf20Sopenharmony_ci#define CFI_REGISTER .cfi_register 3888c2ecf20Sopenharmony_ci#define CFI_REL_OFFSET .cfi_rel_offset 3898c2ecf20Sopenharmony_ci#define CFI_UNDEFINED .cfi_undefined 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci#else 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci/* 3948c2ecf20Sopenharmony_ci * Use the asm comment character to ignore the rest of the line. 3958c2ecf20Sopenharmony_ci */ 3968c2ecf20Sopenharmony_ci#define CFI_IGNORE ! 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci#define CFI_STARTPROC CFI_IGNORE 3998c2ecf20Sopenharmony_ci#define CFI_ENDPROC CFI_IGNORE 4008c2ecf20Sopenharmony_ci#define CFI_DEF_CFA CFI_IGNORE 4018c2ecf20Sopenharmony_ci#define CFI_REGISTER CFI_IGNORE 4028c2ecf20Sopenharmony_ci#define CFI_REL_OFFSET CFI_IGNORE 4038c2ecf20Sopenharmony_ci#define CFI_UNDEFINED CFI_IGNORE 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 4068c2ecf20Sopenharmony_cistatic inline void dwarf_unwinder_init(void) 4078c2ecf20Sopenharmony_ci{ 4088c2ecf20Sopenharmony_ci} 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci#define module_dwarf_finalize(hdr, sechdrs, me) (0) 4118c2ecf20Sopenharmony_ci#define module_dwarf_cleanup(mod) do { } while (0) 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci#endif 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci#endif /* CONFIG_DWARF_UNWINDER */ 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci#endif /* __ASM_SH_DWARF_H */ 418