Skip to content

Commit

Permalink
Add DWARF register mapping table for Hexagon. (#3981)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 authored Nov 16, 2023
1 parent 7f82cdb commit ac33831
Show file tree
Hide file tree
Showing 2 changed files with 248 additions and 0 deletions.
4 changes: 4 additions & 0 deletions librz/analysis/dwarf_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ static const char *map_dwarf_reg_to_arm64(ut32 reg_num) {
}
}

#include "hexagon_dwarf_reg_num_table.inc"

static const char *map_dwarf_register_dummy(ut32 reg_num) {
static char buf[32];
return rz_strf(buf, "reg%u", reg_num);
Expand Down Expand Up @@ -543,6 +545,8 @@ static DWARF_RegisterMapping dwarf_register_mapping_query(RZ_NONNULL char *arch,
} else if (bits <= 32) {
return map_dwarf_reg_to_arm32;
}
} else if (RZ_STR_EQ(arch, "hexagon")) {
return map_dwarf_reg_to_hexagon_reg;
}
RZ_LOG_ERROR("No DWARF register mapping function defined for %s %d bits\n", arch, bits);
return map_dwarf_register_dummy;
Expand Down
244 changes: 244 additions & 0 deletions librz/analysis/hexagon_dwarf_reg_num_table.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
// SPDX-FileCopyrightText: 2023 Rot127 <[email protected]>
// SPDX-License-Identifier: LGPL-3.0-only

// LLVM commit: b6f51787f6c8e77143f0aef6b58ddc7c55741d5c
// LLVM commit date: 2023-11-15 07:10:59 -0800 (ISO 8601 format)
// Date of code generation: 2023-11-15 14:59:38-05:00
//========================================
// The following code is generated.
// Do not edit. Repository of code generator:
// https://github.com/rizinorg/rz-hexagon

static const char *map_dwarf_reg_to_hexagon_reg(ut32 reg_num) {
switch (reg_num) {
default:
rz_warn_if_reached();
return "unsupported_reg";
case 0: return "R0";
case 1: return "R1";
case 2: return "R2";
case 3: return "R3";
case 4: return "R4";
case 5: return "R5";
case 6: return "R6";
case 7: return "R7";
case 8: return "R8";
case 9: return "R9";
case 10: return "R10";
case 11: return "R11";
case 12: return "R12";
case 13: return "R13";
case 14: return "R14";
case 15: return "R15";
case 16: return "R16";
case 17: return "R17";
case 18: return "R18";
case 19: return "R19";
case 20: return "R20";
case 21: return "R21";
case 22: return "R22";
case 23: return "R23";
case 24: return "R24";
case 25: return "R25";
case 26: return "R26";
case 27: return "R27";
case 28: return "R28";
case 29: return "R29";
case 30: return "R30";
case 31: return "R31";
case 32: return "R1:0";
case 34: return "R3:2";
case 36: return "R5:4";
case 38: return "R7:6";
case 40: return "R9:8";
case 42: return "R11:10";
case 44: return "R13:12";
case 46: return "R15:14";
case 48: return "R17:16";
case 50: return "R19:18";
case 52: return "R21:20";
case 54: return "R23:22";
case 56: return "R25:24";
case 58: return "R27:26";
case 60: return "R29:28";
case 62: return "R31:30";
case 63: return "P0";
case 64: return "P1";
case 65: return "P2";
case 66: return "P3";
case 67: return "C0";
case 68: return "C1";
case 69: return "C2";
case 70: return "C3";
case 71: return "C4";
case 72: return "C5";
case 73: return "C6";
case 74: return "C7";
case 75: return "C8";
case 76: return "C9";
case 77: return "C10";
case 78: return "C11";
case 79: return "C12";
case 80: return "C13";
case 81: return "C14";
case 82: return "C15";
case 83: return "C16";
case 84: return "C17";
case 85: return "C18";
case 86: return "C19";
case 97: return "C30";
case 98: return "C31";
case 99: return "V0";
case 100: return "V1";
case 101: return "V2";
case 102: return "V3";
case 103: return "V4";
case 104: return "V5";
case 105: return "V6";
case 106: return "V7";
case 107: return "V8";
case 108: return "V9";
case 109: return "V10";
case 110: return "V11";
case 111: return "V12";
case 112: return "V13";
case 113: return "V14";
case 114: return "V15";
case 115: return "V16";
case 116: return "V17";
case 117: return "V18";
case 118: return "V19";
case 119: return "V20";
case 120: return "V21";
case 121: return "V22";
case 122: return "V23";
case 123: return "V24";
case 124: return "V25";
case 125: return "V26";
case 126: return "V27";
case 127: return "V28";
case 128: return "V29";
case 129: return "V30";
case 130: return "V31";
case 131: return "Q0";
case 132: return "Q1";
case 133: return "Q2";
case 134: return "Q3";
case 144: return "S0";
case 145: return "S1";
case 146: return "S2";
case 147: return "S3";
case 148: return "S4";
case 149: return "S5";
case 150: return "S6";
case 151: return "S7";
case 152: return "S8";
case 153: return "S9";
case 154: return "S10";
case 155: return "S11";
case 156: return "S12";
case 157: return "S13";
case 158: return "S14";
case 159: return "S15";
case 160: return "S16";
case 161: return "S17";
case 162: return "S18";
case 163: return "S19";
case 164: return "S20";
case 165: return "S21";
case 166: return "S22";
case 167: return "S23";
case 168: return "S24";
case 169: return "S25";
case 170: return "S26";
case 171: return "S27";
case 172: return "S28";
case 173: return "S29";
case 174: return "S30";
case 175: return "S31";
case 176: return "S32";
case 177: return "S33";
case 178: return "S34";
case 179: return "S35";
case 180: return "S36";
case 181: return "S37";
case 182: return "S38";
case 183: return "S39";
case 184: return "S40";
case 185: return "S41";
case 186: return "S42";
case 187: return "S43";
case 188: return "S44";
case 189: return "S45";
case 190: return "S46";
case 191: return "S47";
case 192: return "S48";
case 193: return "S49";
case 194: return "S50";
case 195: return "S51";
case 196: return "S52";
case 197: return "S53";
case 198: return "S54";
case 199: return "S55";
case 200: return "S56";
case 201: return "S57";
case 202: return "S58";
case 203: return "S59";
case 204: return "S60";
case 205: return "S61";
case 206: return "S62";
case 207: return "S63";
case 208: return "S64";
case 209: return "S65";
case 210: return "S66";
case 211: return "S67";
case 212: return "S68";
case 213: return "S69";
case 214: return "S70";
case 215: return "S71";
case 216: return "S72";
case 217: return "S73";
case 218: return "S74";
case 219: return "S75";
case 220: return "G0";
case 221: return "G1";
case 222: return "G2";
case 223: return "G3";
case 224: return "G4";
case 225: return "G5";
case 226: return "G6";
case 227: return "G7";
case 228: return "G8";
case 229: return "G9";
case 230: return "G10";
case 231: return "G11";
case 232: return "G12";
case 233: return "G13";
case 234: return "G14";
case 235: return "G15";
case 236: return "G16";
case 237: return "G17";
case 238: return "G18";
case 239: return "G19";
case 240: return "G20";
case 241: return "G21";
case 242: return "G22";
case 243: return "G23";
case 244: return "G24";
case 245: return "G25";
case 246: return "G26";
case 247: return "G27";
case 248: return "G28";
case 249: return "G29";
case 250: return "G30";
case 251: return "G31";
case 252: return "V3:0";
case 253: return "V7:4";
case 254: return "V11:8";
case 255: return "V15:12";
case 256: return "V19:16";
case 257: return "V23:20";
case 258: return "V27:24";
case 259: return "V31:28";
}
}

0 comments on commit ac33831

Please sign in to comment.