| 1 |
/* -*- linux-c -*- |
| 2 |
* |
| 3 |
* RISC-V dwarf unwinder header file |
| 4 |
* |
| 5 |
* This file is part of systemtap, and is free software. You can |
| 6 |
* redistribute it and/or modify it under the terms of the GNU General |
| 7 |
* Public License (GPL); either version 2, or (at your option) any |
| 8 |
* later version. |
| 9 |
*/ |
| 10 |
#ifndef _STP_RISCV_UNWIND_H |
| 11 |
#define _STP_RISCV_UNWIND_H |
| 12 |
|
| 13 |
#include <linux/sched.h> |
| 14 |
#include <asm/ptrace.h> |
| 15 |
|
| 16 |
#define _stp_get_unaligned(ptr) (*(ptr)) |
| 17 |
|
| 18 |
#define UNW_PC(frame) (frame)->regs.epc |
| 19 |
#define UNW_SP(frame) (frame)->regs.sp |
| 20 |
|
| 21 |
#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) |
| 22 |
|
| 23 |
#define UNW_REGISTER_INFO \ |
| 24 |
PTREGS_INFO(epc), \ |
| 25 |
PTREGS_INFO(ra), \ |
| 26 |
PTREGS_INFO(sp), \ |
| 27 |
PTREGS_INFO(gp), \ |
| 28 |
PTREGS_INFO(tp), \ |
| 29 |
PTREGS_INFO(t0), \ |
| 30 |
PTREGS_INFO(t1), \ |
| 31 |
PTREGS_INFO(t2), \ |
| 32 |
PTREGS_INFO(s0), \ |
| 33 |
PTREGS_INFO(s1), \ |
| 34 |
PTREGS_INFO(a0), \ |
| 35 |
PTREGS_INFO(a1), \ |
| 36 |
PTREGS_INFO(a2), \ |
| 37 |
PTREGS_INFO(a3), \ |
| 38 |
PTREGS_INFO(a4), \ |
| 39 |
PTREGS_INFO(a5), \ |
| 40 |
PTREGS_INFO(a6), \ |
| 41 |
PTREGS_INFO(a7), \ |
| 42 |
PTREGS_INFO(s2), \ |
| 43 |
PTREGS_INFO(s3), \ |
| 44 |
PTREGS_INFO(s4), \ |
| 45 |
PTREGS_INFO(s5), \ |
| 46 |
PTREGS_INFO(s6), \ |
| 47 |
PTREGS_INFO(s7), \ |
| 48 |
PTREGS_INFO(s8), \ |
| 49 |
PTREGS_INFO(s9), \ |
| 50 |
PTREGS_INFO(s10), \ |
| 51 |
PTREGS_INFO(s11), \ |
| 52 |
PTREGS_INFO(t3), \ |
| 53 |
PTREGS_INFO(t4), \ |
| 54 |
PTREGS_INFO(t5), \ |
| 55 |
PTREGS_INFO(t6) |
| 56 |
|
| 57 |
#define UNW_PC_IDX 0 |
| 58 |
#define UNW_SP_IDX 2 |
| 59 |
|
| 60 |
/* Use default rules. The stack pointer should be set from the CFA. |
| 61 |
And the instruction pointer should be set from the return address |
| 62 |
column (which normally is the return register (regs[31]). */ |
| 63 |
|
| 64 |
static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, |
| 65 |
/*const*/ struct pt_regs *regs, |
| 66 |
int sanitize) |
| 67 |
{ |
| 68 |
if (&info->regs == regs) { /* happens when unwinding kernel->user */ |
| 69 |
info->call_frame = 1; |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
memset(info, 0, sizeof(*info)); |
| 74 |
/* XXX handle sanitize??? */ |
| 75 |
info->regs = *regs; |
| 76 |
} |
| 77 |
|
| 78 |
#endif /* _STP_RISCV_UNWIND_H */ |