Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * dwarf-regs.c : Mapping of DWARF debug register numbers into register names.
0004  *
0005  * Copyright (C) 2013 Cavium, Inc.
0006  *
0007  * This program is free software; you can redistribute it and/or modify
0008  * it under the terms of the GNU General Public License as published by
0009  * the Free Software Foundation; either version 2 of the License, or
0010  * (at your option) any later version.
0011  *
0012  * This program is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015  * GNU General Public License for more details.
0016  *
0017  */
0018 
0019 #include <stdio.h>
0020 #include <dwarf-regs.h>
0021 
0022 static const char *mips_gpr_names[32] = {
0023     "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9",
0024     "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19",
0025     "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29",
0026     "$30", "$31"
0027 };
0028 
0029 const char *get_arch_regstr(unsigned int n)
0030 {
0031     if (n < 32)
0032         return mips_gpr_names[n];
0033     if (n == 64)
0034         return "hi";
0035     if (n == 65)
0036         return "lo";
0037     return NULL;
0038 }