~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/arch/loongarch/util/dwarf-regs.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * dwarf-regs.c : Mapping of DWARF debug register numbers into register names.
  4  *
  5  * Copyright (C) 2020-2023 Loongson Technology Corporation Limited
  6  */
  7 
  8 #include <stdio.h>
  9 #include <errno.h> /* for EINVAL */
 10 #include <string.h> /* for strcmp */
 11 #include <dwarf-regs.h>
 12 
 13 struct pt_regs_dwarfnum {
 14         const char *name;
 15         unsigned int dwarfnum;
 16 };
 17 
 18 static struct pt_regs_dwarfnum loongarch_gpr_table[] = {
 19         {"%r0", 0}, {"%r1", 1}, {"%r2", 2}, {"%r3", 3},
 20         {"%r4", 4}, {"%r5", 5}, {"%r6", 6}, {"%r7", 7},
 21         {"%r8", 8}, {"%r9", 9}, {"%r10", 10}, {"%r11", 11},
 22         {"%r12", 12}, {"%r13", 13}, {"%r14", 14}, {"%r15", 15},
 23         {"%r16", 16}, {"%r17", 17}, {"%r18", 18}, {"%r19", 19},
 24         {"%r20", 20}, {"%r21", 21}, {"%r22", 22}, {"%r23", 23},
 25         {"%r24", 24}, {"%r25", 25}, {"%r26", 26}, {"%r27", 27},
 26         {"%r28", 28}, {"%r29", 29}, {"%r30", 30}, {"%r31", 31},
 27         {NULL, 0}
 28 };
 29 
 30 const char *get_arch_regstr(unsigned int n)
 31 {
 32         n %= 32;
 33         return loongarch_gpr_table[n].name;
 34 }
 35 
 36 int regs_query_register_offset(const char *name)
 37 {
 38         const struct pt_regs_dwarfnum *roff;
 39 
 40         for (roff = loongarch_gpr_table; roff->name != NULL; roff++)
 41                 if (!strcmp(roff->name, name))
 42                         return roff->dwarfnum;
 43         return -EINVAL;
 44 }
 45 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php