| ... | ... | @@ -341,7 +341,7 @@ pub const X86 = struct { |
| 341 | 341 | // x86-macos is a deprecated target which is not supported by the Zig Standard Library. |
| 342 | 342 | 0...8 => return @ptrCast(&ctx.gprs.values[register_num]), |
| 343 | 343 | |
| 344 | | 9 => return error.UnsupportedRegister, // rflags |
| 344 | 9 => return error.UnsupportedRegister, // eflags |
| 345 | 345 | 11...18 => return error.UnsupportedRegister, // st0 - st7 |
| 346 | 346 | 21...28 => return error.UnsupportedRegister, // xmm0 - xmm7 |
| 347 | 347 | 29...36 => return error.UnsupportedRegister, // mm0 - mm7 |
| ... | ... | @@ -349,7 +349,7 @@ pub const X86 = struct { |
| 349 | 349 | 40...45 => return error.UnsupportedRegister, // es, cs, ss, ds, fs, gs |
| 350 | 350 | 48 => return error.UnsupportedRegister, // tr |
| 351 | 351 | 49 => return error.UnsupportedRegister, // ldtr |
| 352 | | 93...94 => return error.UnsupportedRegister, // fs.base, gs.base |
| 352 | 93...100 => return error.UnsupportedRegister, // k0 - k7 (AVX-512) |
| 353 | 353 | |
| 354 | 354 | else => return error.InvalidRegister, |
| 355 | 355 | } |
| ... | ... | @@ -417,6 +417,9 @@ pub const X86_64 = struct { |
| 417 | 417 | 64 => return error.UnsupportedRegister, // mxcsr |
| 418 | 418 | 65 => return error.UnsupportedRegister, // fcw |
| 419 | 419 | 66 => return error.UnsupportedRegister, // fsw |
| 420 | 67...82 => return error.UnsupportedRegister, // xmm16 - xmm31 (AVX-512) |
| 421 | 118...125 => return error.UnsupportedRegister, // k0 - k7 (AVX-512) |
| 422 | 130...145 => return error.UnsupportedRegister, // r16 - r31 (APX) |
| 420 | 423 | |
| 421 | 424 | else => return error.InvalidRegister, |
| 422 | 425 | } |
| ... | ... | @@ -520,13 +523,13 @@ pub const Aarch64 = extern struct { |
| 520 | 523 | 31 => return @ptrCast(&ctx.sp), |
| 521 | 524 | 32 => return @ptrCast(&ctx.pc), |
| 522 | 525 | |
| 523 | | 33 => return error.UnsupportedRegister, // ELF_mode |
| 526 | 33 => return error.UnsupportedRegister, // ELR_mode |
| 524 | 527 | 34 => return error.UnsupportedRegister, // RA_SIGN_STATE |
| 525 | 528 | 35 => return error.UnsupportedRegister, // TPIDRRO_ELO |
| 526 | | 36 => return error.UnsupportedRegister, // RPIDR_ELO |
| 527 | | 37 => return error.UnsupportedRegister, // RPIDR_EL1 |
| 528 | | 38 => return error.UnsupportedRegister, // RPIDR_EL2 |
| 529 | | 39 => return error.UnsupportedRegister, // RPIDR_EL3 |
| 529 | 36 => return error.UnsupportedRegister, // TPIDR_ELO |
| 530 | 37 => return error.UnsupportedRegister, // TPIDR_EL1 |
| 531 | 38 => return error.UnsupportedRegister, // TPIDR_EL2 |
| 532 | 39 => return error.UnsupportedRegister, // TPIDR_EL3 |
| 530 | 533 | 46 => return error.UnsupportedRegister, // VG |
| 531 | 534 | 47 => return error.UnsupportedRegister, // FFR |
| 532 | 535 | 48...63 => return error.UnsupportedRegister, // P0 - P15 |
| ... | ... | @@ -701,6 +704,8 @@ pub const LoongArch = extern struct { |
| 701 | 704 | 0...31 => return @ptrCast(&ctx.r[register_num]), |
| 702 | 705 | 64 => return @ptrCast(&ctx.pc), |
| 703 | 706 | |
| 707 | 32...63 => return error.UnsupportedRegister, // f0 - f31 |
| 708 | |
| 704 | 709 | else => return error.InvalidRegister, |
| 705 | 710 | } |
| 706 | 711 | } |
| ... | ... | @@ -811,6 +816,18 @@ pub const Mips = extern struct { |
| 811 | 816 | 0...31 => return @ptrCast(&ctx.r[register_num]), |
| 812 | 817 | 66 => return @ptrCast(&ctx.pc), |
| 813 | 818 | |
| 819 | // Who the hell knows what numbers exist for this architecture? What's an ABI |
| 820 | // specification anyway? We don't need that nonsense. |
| 821 | 32...63 => return error.UnsupportedRegister, // f0 - f31, w0 - w31 |
| 822 | 64 => return error.UnsupportedRegister, // hi0 (ac0) |
| 823 | 65 => return error.UnsupportedRegister, // lo0 (ac0) |
| 824 | 176 => return error.UnsupportedRegister, // hi1 (ac1) |
| 825 | 177 => return error.UnsupportedRegister, // lo1 (ac1) |
| 826 | 178 => return error.UnsupportedRegister, // hi2 (ac2) |
| 827 | 179 => return error.UnsupportedRegister, // lo2 (ac2) |
| 828 | 180 => return error.UnsupportedRegister, // hi3 (ac3) |
| 829 | 181 => return error.UnsupportedRegister, // lo3 (ac3) |
| 830 | |
| 814 | 831 | else => return error.InvalidRegister, |
| 815 | 832 | } |
| 816 | 833 | } |
| ... | ... | @@ -914,11 +931,59 @@ pub const Powerpc = extern struct { |
| 914 | 931 | } |
| 915 | 932 | |
| 916 | 933 | pub fn dwarfRegisterBytes(ctx: *Powerpc, register_num: u16) DwarfRegisterError![]u8 { |
| 934 | // References: |
| 935 | // |
| 936 | // * System V Application Binary Interface - PowerPC Processor Supplement §3-46 |
| 937 | // * Power Architecture 32-bit Application Binary Interface Supplement 1.0 - Linux & Embedded §3.4 |
| 938 | // * 64-bit ELF V2 ABI Specification - Power Architecture Revision 1.5 §2.4 |
| 939 | // * ??? AIX? |
| 940 | // |
| 941 | // Are we having fun yet? |
| 942 | |
| 943 | if (Gpr == u64) switch (register_num) { |
| 944 | 65 => return @ptrCast(&ctx.lr), // lr |
| 945 | |
| 946 | 66 => return error.UnsupportedRegister, // ctr |
| 947 | 68...75 => return error.UnsupportedRegister, // cr0 - cr7 |
| 948 | 76 => return error.UnsupportedRegister, // xer |
| 949 | 77...108 => return error.UnsupportedRegister, // vr0 - vr31 |
| 950 | 109 => return error.UnsupportedRegister, // vrsave (LLVM) |
| 951 | 110 => return error.UnsupportedRegister, // vscr |
| 952 | 114 => return error.UnsupportedRegister, // tfhar |
| 953 | 115 => return error.UnsupportedRegister, // tfiar |
| 954 | 116 => return error.UnsupportedRegister, // texasr |
| 955 | |
| 956 | else => {}, |
| 957 | } else switch (register_num) { |
| 958 | 65 => return @ptrCast(&ctx.lr), // fpscr (SVR4 / EABI), or lr if you ask LLVM |
| 959 | 108 => return @ptrCast(&ctx.lr), |
| 960 | |
| 961 | 64 => return error.UnsupportedRegister, // cr |
| 962 | 66 => return error.UnsupportedRegister, // msr (SVR4 / EABI), or ctr if you ask LLVM |
| 963 | 68...75 => return error.UnsupportedRegister, // cr0 - cr7 if you ask LLVM |
| 964 | 76 => return error.UnsupportedRegister, // xer if you ask LLVM |
| 965 | 99 => return error.UnsupportedRegister, // acc |
| 966 | 100 => return error.UnsupportedRegister, // mq |
| 967 | 101 => return error.UnsupportedRegister, // xer |
| 968 | 102...107 => return error.UnsupportedRegister, // SPRs |
| 969 | 109 => return error.UnsupportedRegister, // ctr |
| 970 | 110...111 => return error.UnsupportedRegister, // SPRs |
| 971 | 112 => return error.UnsupportedRegister, // spefscr |
| 972 | 113...1123 => return error.UnsupportedRegister, // SPRs |
| 973 | 1124...1155 => return error.UnsupportedRegister, // SPE v0 - v31 |
| 974 | 1200...1231 => return error.UnsupportedRegister, // SPE upper r0 - r31 |
| 975 | 3072...4095 => return error.UnsupportedRegister, // DCRs |
| 976 | 4096...5120 => return error.UnsupportedRegister, // PMRs |
| 977 | |
| 978 | else => {}, |
| 979 | } |
| 980 | |
| 917 | 981 | switch (register_num) { |
| 918 | 982 | 0...31 => return @ptrCast(&ctx.r[register_num]), |
| 919 | | 65 => return @ptrCast(&ctx.lr), |
| 920 | 983 | 67 => return @ptrCast(&ctx.pc), |
| 921 | 984 | |
| 985 | 32...63 => return error.UnsupportedRegister, // f0 - f31 |
| 986 | |
| 922 | 987 | else => return error.InvalidRegister, |
| 923 | 988 | } |
| 924 | 989 | } |
| ... | ... | @@ -1019,6 +1084,12 @@ pub const Riscv = extern struct { |
| 1019 | 1084 | 0...31 => return @ptrCast(&ctx.r[register_num]), |
| 1020 | 1085 | 65 => return @ptrCast(&ctx.pc), |
| 1021 | 1086 | |
| 1087 | 32...63 => return error.UnsupportedRegister, // f0 - f31 |
| 1088 | 64 => return error.UnsupportedRegister, // Alternate Frame Return Column |
| 1089 | 96...127 => return error.UnsupportedRegister, // v0 - v31 |
| 1090 | 3072...4095 => return error.UnsupportedRegister, // Custom extensions |
| 1091 | 4096...8191 => return error.UnsupportedRegister, // CSRs |
| 1092 | |
| 1022 | 1093 | else => return error.InvalidRegister, |
| 1023 | 1094 | } |
| 1024 | 1095 | } |
| ... | ... | @@ -1057,7 +1128,9 @@ pub const S390x = extern struct { |
| 1057 | 1128 | 65 => return @ptrCast(&ctx.psw.addr), |
| 1058 | 1129 | |
| 1059 | 1130 | 16...31 => return error.UnsupportedRegister, // f0 - f15 |
| 1131 | 32...47 => return error.UnsupportedRegister, // cr0 - cr15 |
| 1060 | 1132 | 48...63 => return error.UnsupportedRegister, // a0 - a15 |
| 1133 | 66...67 => return error.UnsupportedRegister, // z/OS stuff??? |
| 1061 | 1134 | 68...83 => return error.UnsupportedRegister, // v16 - v31 |
| 1062 | 1135 | |
| 1063 | 1136 | else => return error.InvalidRegister, |