cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

dwarf-regs.c (1613B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
      3// Mapping of DWARF debug register numbers into register names.
      4
      5#include <stddef.h>
      6#include <dwarf-regs.h>
      7
      8#if defined(__CSKYABIV2__)
      9#define CSKY_MAX_REGS 73
     10const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
     11	/* r0 ~ r8 */
     12	"%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3",
     13	/* r9 ~ r15 */
     14	"%regs4", "%regs5", "%regs6", "%regs7", "%regs8", "%regs9", "%sp",
     15	"%lr",
     16	/* r16 ~ r23 */
     17	"%exregs0", "%exregs1", "%exregs2", "%exregs3", "%exregs4",
     18	"%exregs5", "%exregs6", "%exregs7",
     19	/* r24 ~ r31 */
     20	"%exregs8", "%exregs9", "%exregs10", "%exregs11", "%exregs12",
     21	"%exregs13", "%exregs14", "%tls",
     22	"%pc", NULL, NULL, NULL, "%hi", "%lo", NULL, NULL,
     23	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     24	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     25	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     26	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     27	"%epc",
     28};
     29#else
     30#define CSKY_MAX_REGS 57
     31const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
     32	/* r0 ~ r8 */
     33	"%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1",
     34	/* r9 ~ r15 */
     35	"%regs2", "%regs3", "%regs4", "%regs5", "%regs6", "%regs7", "%regs8",
     36	"%lr",
     37	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     38	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     39	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     40	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     41	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     42	"%epc",
     43};
     44#endif
     45
     46const char *get_arch_regstr(unsigned int n)
     47{
     48	return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL;
     49}