| 1 |
/* -*- linux-c -*- |
| 2 |
* |
| 3 |
* s390x dwarf unwinder header file |
| 4 |
* Copyright (C) 2011 Red Hat, Inc. |
| 5 |
* |
| 6 |
* This file is part of systemtap, and is free software. You can |
| 7 |
* redistribute it and/or modify it under the terms of the GNU General |
| 8 |
* Public License (GPL); either version 2, or (at your option) any |
| 9 |
* later version. |
| 10 |
*/ |
| 11 |
#ifndef _STP_S390X_UNWIND_H |
| 12 |
#define _STP_S390X_UNWIND_H |
| 13 |
|
| 14 |
#include <linux/sched.h> |
| 15 |
#include <asm/ptrace.h> |
| 16 |
|
| 17 |
#define _stp_get_unaligned(ptr) (*(ptr)) |
| 18 |
|
| 19 |
#define UNW_PC(frame) (frame)->regs.psw.addr |
| 20 |
#define UNW_SP(frame) (frame)->regs.gprs[15] |
| 21 |
|
| 22 |
#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) |
| 23 |
|
| 24 |
#define UNW_REGISTER_INFO \ |
| 25 |
PTREGS_INFO(gprs[0]), \ |
| 26 |
PTREGS_INFO(gprs[1]), \ |
| 27 |
PTREGS_INFO(gprs[2]), \ |
| 28 |
PTREGS_INFO(gprs[3]), \ |
| 29 |
PTREGS_INFO(gprs[4]), \ |
| 30 |
PTREGS_INFO(gprs[5]), \ |
| 31 |
PTREGS_INFO(gprs[6]), \ |
| 32 |
PTREGS_INFO(gprs[7]), \ |
| 33 |
PTREGS_INFO(gprs[8]), \ |
| 34 |
PTREGS_INFO(gprs[9]), \ |
| 35 |
PTREGS_INFO(gprs[10]), \ |
| 36 |
PTREGS_INFO(gprs[11]), \ |
| 37 |
PTREGS_INFO(gprs[12]), \ |
| 38 |
PTREGS_INFO(gprs[13]), \ |
| 39 |
PTREGS_INFO(gprs[14]), \ |
| 40 |
PTREGS_INFO(gprs[15]), \ |
| 41 |
PTREGS_INFO(psw.addr), \ |
| 42 |
PTREGS_INFO(psw.mask) |
| 43 |
|
| 44 |
#define DWARF_REG_MAP(r) \ |
| 45 |
((r >= 0 && r <= 15) ? r /* gpr0-15 */ \ |
| 46 |
: (r == 64) ? 16 /* PSW addr */ \ |
| 47 |
: (r == 65) ? 17 /* PSW mask */ \ |
| 48 |
: 9999) |
| 49 |
|
| 50 |
#define UNW_PC_IDX 16 |
| 51 |
#define UNW_SP_IDX 15 |
| 52 |
|
| 53 |
#define UNW_SP_FROM_CFA 0 /* Stack pointer is just gprs15, normal cfi. */ |
| 54 |
|
| 55 |
static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, |
| 56 |
/*const*/ struct pt_regs *regs, |
| 57 |
int sanitize) |
| 58 |
{ |
| 59 |
if (&info->regs == regs) { /* happens when unwinding kernel->user */ |
| 60 |
info->call_frame = 1; |
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
memset(info, 0, sizeof(*info)); |
| 65 |
/* XXX handle sanitize??? */ |
| 66 |
info->regs = *regs; |
| 67 |
} |
| 68 |
|
| 69 |
#endif /* _STP_S390X_UNWIND_H */ |