ptrace.h (9b031c86506cef9acae45e61339fcf9deaabb793) ptrace.h (7fa95f9adaee7e5cbb195d3359741120829e488b)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2001 PPC64 Team, IBM Corp
4 *
5 * This struct defines the way the registers are stored on the
6 * kernel stack during a system call or other kernel entry.
7 *
8 * this should only contain volatile regs

--- 165 unchanged lines hidden (view full) ---

174struct task_struct;
175extern int ptrace_get_reg(struct task_struct *task, int regno,
176 unsigned long *data);
177extern int ptrace_put_reg(struct task_struct *task, int regno,
178 unsigned long data);
179
180#define current_pt_regs() \
181 ((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2001 PPC64 Team, IBM Corp
4 *
5 * This struct defines the way the registers are stored on the
6 * kernel stack during a system call or other kernel entry.
7 *
8 * this should only contain volatile regs

--- 165 unchanged lines hidden (view full) ---

174struct task_struct;
175extern int ptrace_get_reg(struct task_struct *task, int regno,
176 unsigned long *data);
177extern int ptrace_put_reg(struct task_struct *task, int regno,
178 unsigned long data);
179
180#define current_pt_regs() \
181 ((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
182
183#ifdef __powerpc64__
184#ifdef CONFIG_PPC_BOOK3S
185#define TRAP_FLAGS_MASK 0x10
186#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
187#define FULL_REGS(regs) true
188#define SET_FULL_REGS(regs) do { } while (0)
189#else
190#define TRAP_FLAGS_MASK 0x11
191#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
192#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
193#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
194#endif
195#define CHECK_FULL_REGS(regs) BUG_ON(!FULL_REGS(regs))
196#define NV_REG_POISON 0xdeadbeefdeadbeefUL
197#else
182/*
183 * We use the least-significant bit of the trap field to indicate
184 * whether we have saved the full set of registers, or only a
185 * partial set. A 1 there means the partial set.
186 * On 4xx we use the next bit to indicate whether the exception
187 * is a critical exception (1 means it is).
188 */
198/*
199 * We use the least-significant bit of the trap field to indicate
200 * whether we have saved the full set of registers, or only a
201 * partial set. A 1 there means the partial set.
202 * On 4xx we use the next bit to indicate whether the exception
203 * is a critical exception (1 means it is).
204 */
205#define TRAP_FLAGS_MASK 0x1F
206#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
189#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
207#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
190#ifndef __powerpc64__
208#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
191#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
192#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
193#define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
209#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
210#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
211#define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
194#endif /* ! __powerpc64__ */
195#define TRAP(regs) ((regs)->trap & ~0xF)
196#ifdef __powerpc64__
197#define NV_REG_POISON 0xdeadbeefdeadbeefUL
198#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
199#else
200#define NV_REG_POISON 0xdeadbeef
201#define CHECK_FULL_REGS(regs) \
202do { \
203 if ((regs)->trap & 1) \
204 printk(KERN_CRIT "%s: partial register set\n", __func__); \
205} while (0)
206#endif /* __powerpc64__ */
207
212#define NV_REG_POISON 0xdeadbeef
213#define CHECK_FULL_REGS(regs) \
214do { \
215 if ((regs)->trap & 1) \
216 printk(KERN_CRIT "%s: partial register set\n", __func__); \
217} while (0)
218#endif /* __powerpc64__ */
219
220static inline void set_trap(struct pt_regs *regs, unsigned long val)
221{
222 regs->trap = (regs->trap & TRAP_FLAGS_MASK) | (val & ~TRAP_FLAGS_MASK);
223}
224
225static inline bool trap_is_scv(struct pt_regs *regs)
226{
227 return (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x3000);
228}
229
230static inline bool trap_is_syscall(struct pt_regs *regs)
231{
232 return (trap_is_scv(regs) || TRAP(regs) == 0xc00);
233}
234
235static inline bool trap_norestart(struct pt_regs *regs)
236{
237 return regs->trap & 0x10;
238}
239
240static inline void set_trap_norestart(struct pt_regs *regs)
241{
242 regs->trap |= 0x10;
243}
244
208#define arch_has_single_step() (1)
209#ifndef CONFIG_BOOK3S_601
210#define arch_has_block_step() (true)
211#else
212#define arch_has_block_step() (false)
213#endif
214#define ARCH_HAS_USER_SINGLE_STEP_REPORT
215

--- 76 unchanged lines hidden ---
245#define arch_has_single_step() (1)
246#ifndef CONFIG_BOOK3S_601
247#define arch_has_block_step() (true)
248#else
249#define arch_has_block_step() (false)
250#endif
251#define ARCH_HAS_USER_SINGLE_STEP_REPORT
252

--- 76 unchanged lines hidden ---