1 // SPDX-License-Identifier: GPL-2.0 2 3 #ifdef HAVE_PERF_REGS_SUPPORT 4 5 #include "../perf_regs.h" 6 #include "../../../arch/x86/include/uapi/asm/perf_regs.h" 7 8 const char *__perf_reg_name_x86(int id) 9 { 10 switch (id) { 11 case PERF_REG_X86_AX: 12 return "AX"; 13 case PERF_REG_X86_BX: 14 return "BX"; 15 case PERF_REG_X86_CX: 16 return "CX"; 17 case PERF_REG_X86_DX: 18 return "DX"; 19 case PERF_REG_X86_SI: 20 return "SI"; 21 case PERF_REG_X86_DI: 22 return "DI"; 23 case PERF_REG_X86_BP: 24 return "BP"; 25 case PERF_REG_X86_SP: 26 return "SP"; 27 case PERF_REG_X86_IP: 28 return "IP"; 29 case PERF_REG_X86_FLAGS: 30 return "FLAGS"; 31 case PERF_REG_X86_CS: 32 return "CS"; 33 case PERF_REG_X86_SS: 34 return "SS"; 35 case PERF_REG_X86_DS: 36 return "DS"; 37 case PERF_REG_X86_ES: 38 return "ES"; 39 case PERF_REG_X86_FS: 40 return "FS"; 41 case PERF_REG_X86_GS: 42 return "GS"; 43 case PERF_REG_X86_R8: 44 return "R8"; 45 case PERF_REG_X86_R9: 46 return "R9"; 47 case PERF_REG_X86_R10: 48 return "R10"; 49 case PERF_REG_X86_R11: 50 return "R11"; 51 case PERF_REG_X86_R12: 52 return "R12"; 53 case PERF_REG_X86_R13: 54 return "R13"; 55 case PERF_REG_X86_R14: 56 return "R14"; 57 case PERF_REG_X86_R15: 58 return "R15"; 59 60 #define XMM(x) \ 61 case PERF_REG_X86_XMM ## x: \ 62 case PERF_REG_X86_XMM ## x + 1: \ 63 return "XMM" #x; 64 XMM(0) 65 XMM(1) 66 XMM(2) 67 XMM(3) 68 XMM(4) 69 XMM(5) 70 XMM(6) 71 XMM(7) 72 XMM(8) 73 XMM(9) 74 XMM(10) 75 XMM(11) 76 XMM(12) 77 XMM(13) 78 XMM(14) 79 XMM(15) 80 #undef XMM 81 default: 82 return NULL; 83 } 84 85 return NULL; 86 } 87 88 uint64_t __perf_reg_ip_x86(void) 89 { 90 return PERF_REG_X86_IP; 91 } 92 93 uint64_t __perf_reg_sp_x86(void) 94 { 95 return PERF_REG_X86_SP; 96 } 97 98 #endif 99