162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. 362306a36Sopenharmony_ci// Mapping of DWARF debug register numbers into register names. 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <stddef.h> 662306a36Sopenharmony_ci#include <dwarf-regs.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#if defined(__CSKYABIV2__) 962306a36Sopenharmony_ci#define CSKY_MAX_REGS 73 1062306a36Sopenharmony_ciconst char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { 1162306a36Sopenharmony_ci /* r0 ~ r8 */ 1262306a36Sopenharmony_ci "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3", 1362306a36Sopenharmony_ci /* r9 ~ r15 */ 1462306a36Sopenharmony_ci "%regs4", "%regs5", "%regs6", "%regs7", "%regs8", "%regs9", "%sp", 1562306a36Sopenharmony_ci "%lr", 1662306a36Sopenharmony_ci /* r16 ~ r23 */ 1762306a36Sopenharmony_ci "%exregs0", "%exregs1", "%exregs2", "%exregs3", "%exregs4", 1862306a36Sopenharmony_ci "%exregs5", "%exregs6", "%exregs7", 1962306a36Sopenharmony_ci /* r24 ~ r31 */ 2062306a36Sopenharmony_ci "%exregs8", "%exregs9", "%exregs10", "%exregs11", "%exregs12", 2162306a36Sopenharmony_ci "%exregs13", "%exregs14", "%tls", 2262306a36Sopenharmony_ci "%pc", NULL, NULL, NULL, "%hi", "%lo", NULL, NULL, 2362306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2462306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2562306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2662306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2762306a36Sopenharmony_ci "%epc", 2862306a36Sopenharmony_ci}; 2962306a36Sopenharmony_ci#else 3062306a36Sopenharmony_ci#define CSKY_MAX_REGS 57 3162306a36Sopenharmony_ciconst char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { 3262306a36Sopenharmony_ci /* r0 ~ r8 */ 3362306a36Sopenharmony_ci "%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", 3462306a36Sopenharmony_ci /* r9 ~ r15 */ 3562306a36Sopenharmony_ci "%regs2", "%regs3", "%regs4", "%regs5", "%regs6", "%regs7", "%regs8", 3662306a36Sopenharmony_ci "%lr", 3762306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3862306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3962306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4062306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4162306a36Sopenharmony_ci NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4262306a36Sopenharmony_ci "%epc", 4362306a36Sopenharmony_ci}; 4462306a36Sopenharmony_ci#endif 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciconst char *get_arch_regstr(unsigned int n) 4762306a36Sopenharmony_ci{ 4862306a36Sopenharmony_ci return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL; 4962306a36Sopenharmony_ci} 50