1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
14 #ifndef __ASM_OPENRISC_PTRACE_H
15 #define __ASM_OPENRISC_PTRACE_H
18 #include <asm/spr_defs.h>
19 #include <uapi/asm/ptrace.h>
22 * Make kernel PTrace/register structures opaque to userspace... userspace can
23 * access thread state via the regset mechanism. This allows us a bit of
24 * flexibility in how we order the registers on the stack, permitting some
25 * optimizations like packing call-clobbered registers together so that
26 * they share a cacheline (not done yet, though... future optimization).
31 * This struct describes how the registers are laid out on the kernel stack
32 * during a syscall or other kernel entry.
34 * This structure should always be cacheline aligned on the stack.
35 * FIXME: I don't think that's the case right now. The alignment is
36 * taken care of elsewhere... head.S, process.c, etc.
43 long sr
; /* Stored in place of r0 */
57 /* For restarting system calls:
58 * Set to syscall number for syscall exceptions,
59 * -1 for all other exceptions.
61 long orig_gpr11
; /* For restarting system calls */
62 long dummy
; /* Cheap alignment fix */
63 long dummy2
; /* Cheap alignment fix */
66 /* TODO: Rename this to REDZONE because that's what it is */
67 #define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */
69 #define instruction_pointer(regs) ((regs)->pc)
70 #define user_mode(regs) (((regs)->sr & SPR_SR_SM) == 0)
71 #define user_stack_pointer(regs) ((unsigned long)(regs)->sp)
72 #define profile_pc(regs) instruction_pointer(regs)
74 static inline long regs_return_value(struct pt_regs
*regs
)
79 #endif /* __ASSEMBLY__ */
82 * Offsets used by 'ptrace' system call interface.
117 #define PT_ORIG_GPR11 132
119 #endif /* __ASM_OPENRISC_PTRACE_H */