162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * dwarf-regs.c : Mapping of DWARF debug register numbers into register names.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2013 Cavium, Inc.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
862306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by
962306a36Sopenharmony_ci * the Free Software Foundation; either version 2 of the License, or
1062306a36Sopenharmony_ci * (at your option) any later version.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful,
1362306a36Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
1462306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1562306a36Sopenharmony_ci * GNU General Public License for more details.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#include <stdio.h>
2062306a36Sopenharmony_ci#include <dwarf-regs.h>
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cistatic const char *mips_gpr_names[32] = {
2362306a36Sopenharmony_ci	"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9",
2462306a36Sopenharmony_ci	"$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19",
2562306a36Sopenharmony_ci	"$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29",
2662306a36Sopenharmony_ci	"$30", "$31"
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciconst char *get_arch_regstr(unsigned int n)
3062306a36Sopenharmony_ci{
3162306a36Sopenharmony_ci	if (n < 32)
3262306a36Sopenharmony_ci		return mips_gpr_names[n];
3362306a36Sopenharmony_ci	if (n == 64)
3462306a36Sopenharmony_ci		return "hi";
3562306a36Sopenharmony_ci	if (n == 65)
3662306a36Sopenharmony_ci		return "lo";
3762306a36Sopenharmony_ci	return NULL;
3862306a36Sopenharmony_ci}
39