18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. 38c2ecf20Sopenharmony_ci// Mapping of DWARF debug register numbers into register names. 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <stddef.h> 68c2ecf20Sopenharmony_ci#include <dwarf-regs.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#if defined(__CSKYABIV2__) 98c2ecf20Sopenharmony_ci#define CSKY_MAX_REGS 73 108c2ecf20Sopenharmony_ciconst char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { 118c2ecf20Sopenharmony_ci /* r0 ~ r8 */ 128c2ecf20Sopenharmony_ci "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3", 138c2ecf20Sopenharmony_ci /* r9 ~ r15 */ 148c2ecf20Sopenharmony_ci "%regs4", "%regs5", "%regs6", "%regs7", "%regs8", "%regs9", "%sp", 158c2ecf20Sopenharmony_ci "%lr", 168c2ecf20Sopenharmony_ci /* r16 ~ r23 */ 178c2ecf20Sopenharmony_ci "%exregs0", "%exregs1", "%exregs2", "%exregs3", "%exregs4", 188c2ecf20Sopenharmony_ci "%exregs5", "%exregs6", "%exregs7", 198c2ecf20Sopenharmony_ci /* r24 ~ r31 */ 208c2ecf20Sopenharmony_ci "%exregs8", "%exregs9", "%exregs10", "%exregs11", "%exregs12", 218c2ecf20Sopenharmony_ci "%exregs13", "%exregs14", "%tls", 228c2ecf20Sopenharmony_ci "%pc", NULL, NULL, NULL, "%hi", "%lo", NULL, NULL, 238c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 248c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 258c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 268c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 278c2ecf20Sopenharmony_ci "%epc", 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci#else 308c2ecf20Sopenharmony_ci#define CSKY_MAX_REGS 57 318c2ecf20Sopenharmony_ciconst char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { 328c2ecf20Sopenharmony_ci /* r0 ~ r8 */ 338c2ecf20Sopenharmony_ci "%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", 348c2ecf20Sopenharmony_ci /* r9 ~ r15 */ 358c2ecf20Sopenharmony_ci "%regs2", "%regs3", "%regs4", "%regs5", "%regs6", "%regs7", "%regs8", 368c2ecf20Sopenharmony_ci "%lr", 378c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 388c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 398c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 408c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 418c2ecf20Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 428c2ecf20Sopenharmony_ci "%epc", 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci#endif 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciconst char *get_arch_regstr(unsigned int n) 478c2ecf20Sopenharmony_ci{ 488c2ecf20Sopenharmony_ci return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL; 498c2ecf20Sopenharmony_ci} 50