Add PT_REGS macros suitable for ARCompact and ARCv2.
Unified · Split
| @@ -1,5 +1,7 @@ | |||
| 1 | #if defined(__aarch64__) | 1 | #if defined(__aarch64__) |
| 2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h" | 2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h" |
| 3 | #elif defined(__arc__) | ||
| 4 | #include "../../arch/arc/include/uapi/asm/bpf_perf_event.h" | ||
| 3 | #elif defined(__s390__) | 5 | #elif defined(__s390__) |
| 4 | #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h" | 6 | #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h" |
| 5 | #elif defined(__riscv) | 7 | #elif defined(__riscv) |
| @@ -27,6 +27,9 @@ · 26 unmodified lines | |||
| 27 | #elif defined(__TARGET_ARCH_riscv) | 27 | #elif defined(__TARGET_ARCH_riscv) |
| 28 | #define bpf_target_riscv | 28 | #define bpf_target_riscv |
| 29 | #define bpf_target_defined | 29 | #define bpf_target_defined |
| 30 | #elif defined(__TARGET_ARCH_arc) | ||
| 31 | #define bpf_target_arc | ||
| 32 | #define bpf_target_defined | ||
| 30 | #else | 33 | #else |
| 31 | 34 | ||
| 32 | /* Fall back to what the compiler says */ | 35 | /* Fall back to what the compiler says */ |
| @@ -54,6 +57,9 @@ · 21 unmodified lines | |||
| 54 | #elif defined(__riscv) && __riscv_xlen == 64 | 57 | #elif defined(__riscv) && __riscv_xlen == 64 |
| 55 | #define bpf_target_riscv | 58 | #define bpf_target_riscv |
| 56 | #define bpf_target_defined | 59 | #define bpf_target_defined |
| 60 | #elif defined(__arc__) | ||
| 61 | #define bpf_target_arc | ||
| 62 | #define bpf_target_defined | ||
| 57 | #endif /* no compiler target */ | 63 | #endif /* no compiler target */ |
| 58 | 64 | ||
| 59 | #endif | 65 | #endif |
| @@ -233,6 +239,23 @@ struct pt_regs___arm64 { · 173 unmodified lines | |||
| 233 | /* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ | 239 | /* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ |
| 234 | #define PT_REGS_SYSCALL_REGS(ctx) ctx | 240 | #define PT_REGS_SYSCALL_REGS(ctx) ctx |
| 235 | 241 | ||
| 242 | #elif defined(bpf_target_arc) | ||
| 243 | |||
| 244 | /* arc provides struct user_pt_regs instead of struct pt_regs to userspace */ | ||
| 245 | #define __PT_REGS_CAST(x) ((const struct user_regs_struct *)(x)) | ||
| 246 | #define __PT_PARM1_REG scratch.r0 | ||
| 247 | #define __PT_PARM2_REG scratch.r1 | ||
| 248 | #define __PT_PARM3_REG scratch.r2 | ||
| 249 | #define __PT_PARM4_REG scratch.r3 | ||
| 250 | #define __PT_PARM5_REG scratch.r4 | ||
| 251 | #define __PT_RET_REG scratch.blink | ||
| 252 | #define __PT_FP_REG __unsupported__ | ||
| 253 | #define __PT_RC_REG scratch.r0 | ||
| 254 | #define __PT_SP_REG scratch.sp | ||
| 255 | #define __PT_IP_REG scratch.ret | ||
| 256 | /* arc does not select ARCH_HAS_SYSCALL_WRAPPER. */ | ||
| 257 | #define PT_REGS_SYSCALL_REGS(ctx) ctx | ||
| 258 | |||
| 236 | #endif | 259 | #endif |
| 237 | 260 | ||
| 238 | #if defined(bpf_target_defined) | 261 | #if defined(bpf_target_defined) |