]> Git Repo - linux.git/blame - arch/riscv/include/asm/ptrace.h
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux.git] / arch / riscv / include / asm / ptrace.h
CommitLineData
e2c0cdfb
PD
1/*
2 * Copyright (C) 2012 Regents of the University of California
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _ASM_RISCV_PTRACE_H
15#define _ASM_RISCV_PTRACE_H
16
17#include <uapi/asm/ptrace.h>
18#include <asm/csr.h>
19
20#ifndef __ASSEMBLY__
21
22struct pt_regs {
23 unsigned long sepc;
24 unsigned long ra;
25 unsigned long sp;
26 unsigned long gp;
27 unsigned long tp;
28 unsigned long t0;
29 unsigned long t1;
30 unsigned long t2;
31 unsigned long s0;
32 unsigned long s1;
33 unsigned long a0;
34 unsigned long a1;
35 unsigned long a2;
36 unsigned long a3;
37 unsigned long a4;
38 unsigned long a5;
39 unsigned long a6;
40 unsigned long a7;
41 unsigned long s2;
42 unsigned long s3;
43 unsigned long s4;
44 unsigned long s5;
45 unsigned long s6;
46 unsigned long s7;
47 unsigned long s8;
48 unsigned long s9;
49 unsigned long s10;
50 unsigned long s11;
51 unsigned long t3;
52 unsigned long t4;
53 unsigned long t5;
54 unsigned long t6;
55 /* Supervisor CSRs */
56 unsigned long sstatus;
57 unsigned long sbadaddr;
58 unsigned long scause;
10febb3e
DA
59 /* a0 value before the syscall */
60 unsigned long orig_a0;
e2c0cdfb
PD
61};
62
63#ifdef CONFIG_64BIT
64#define REG_FMT "%016lx"
65#else
66#define REG_FMT "%08lx"
67#endif
68
1125203c 69#define user_mode(regs) (((regs)->sstatus & SR_SPP) == 0)
e2c0cdfb
PD
70
71
72/* Helpers for working with the instruction pointer */
73#define GET_IP(regs) ((regs)->sepc)
74#define SET_IP(regs, val) (GET_IP(regs) = (val))
75
76static inline unsigned long instruction_pointer(struct pt_regs *regs)
77{
78 return GET_IP(regs);
79}
80static inline void instruction_pointer_set(struct pt_regs *regs,
81 unsigned long val)
82{
83 SET_IP(regs, val);
84}
85
86#define profile_pc(regs) instruction_pointer(regs)
87
88/* Helpers for working with the user stack pointer */
89#define GET_USP(regs) ((regs)->sp)
90#define SET_USP(regs, val) (GET_USP(regs) = (val))
91
92static inline unsigned long user_stack_pointer(struct pt_regs *regs)
93{
94 return GET_USP(regs);
95}
96static inline void user_stack_pointer_set(struct pt_regs *regs,
97 unsigned long val)
98{
99 SET_USP(regs, val);
100}
101
102/* Helpers for working with the frame pointer */
103#define GET_FP(regs) ((regs)->s0)
104#define SET_FP(regs, val) (GET_FP(regs) = (val))
105
106static inline unsigned long frame_pointer(struct pt_regs *regs)
107{
108 return GET_FP(regs);
109}
110static inline void frame_pointer_set(struct pt_regs *regs,
111 unsigned long val)
112{
113 SET_FP(regs, val);
114}
115
116#endif /* __ASSEMBLY__ */
117
118#endif /* _ASM_RISCV_PTRACE_H */
This page took 0.123868 seconds and 4 git commands to generate.