2019-05-27 06:55:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 PPC64 Team, IBM Corp
|
|
|
|
*
|
|
|
|
* This struct defines the way the registers are stored on the
|
|
|
|
* kernel stack during a system call or other kernel entry.
|
|
|
|
*
|
|
|
|
* this should only contain volatile regs
|
|
|
|
* since we can keep non-volatile in the thread_struct
|
|
|
|
* should set this up when only volatiles are saved
|
|
|
|
* by intr code.
|
|
|
|
*
|
|
|
|
* Since this is going on the stack, *CARE MUST BE TAKEN* to insure
|
|
|
|
* that the overall structure is a multiple of 16 bytes in length.
|
|
|
|
*
|
|
|
|
* Note that the offsets of the fields in this struct correspond with
|
2005-11-03 04:14:36 +00:00
|
|
|
* the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2012-10-09 08:47:26 +00:00
|
|
|
#ifndef _ASM_POWERPC_PTRACE_H
|
|
|
|
#define _ASM_POWERPC_PTRACE_H
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2021-05-20 11:19:31 +00:00
|
|
|
#include <linux/err.h>
|
2012-10-09 08:47:26 +00:00
|
|
|
#include <uapi/asm/ptrace.h>
|
2018-07-05 16:24:57 +00:00
|
|
|
#include <asm/asm-const.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2018-10-12 12:13:17 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
struct pt_regs
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
struct user_pt_regs user_regs;
|
|
|
|
struct {
|
|
|
|
unsigned long gpr[32];
|
|
|
|
unsigned long nip;
|
|
|
|
unsigned long msr;
|
|
|
|
unsigned long orig_gpr3;
|
|
|
|
unsigned long ctr;
|
|
|
|
unsigned long link;
|
|
|
|
unsigned long xer;
|
|
|
|
unsigned long ccr;
|
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
unsigned long softe;
|
|
|
|
#else
|
|
|
|
unsigned long mq;
|
|
|
|
#endif
|
|
|
|
unsigned long trap;
|
|
|
|
unsigned long dar;
|
|
|
|
unsigned long dsisr;
|
|
|
|
unsigned long result;
|
|
|
|
};
|
|
|
|
};
|
2018-10-12 13:15:16 +00:00
|
|
|
|
2019-04-18 06:51:20 +00:00
|
|
|
union {
|
|
|
|
struct {
|
2018-10-12 13:15:16 +00:00
|
|
|
#ifdef CONFIG_PPC64
|
2019-04-18 06:51:20 +00:00
|
|
|
unsigned long ppr;
|
|
|
|
#endif
|
2020-11-27 04:44:05 +00:00
|
|
|
union {
|
2019-04-18 06:51:20 +00:00
|
|
|
#ifdef CONFIG_PPC_KUAP
|
2020-11-27 04:44:05 +00:00
|
|
|
unsigned long kuap;
|
2018-10-12 13:15:16 +00:00
|
|
|
#endif
|
2020-11-27 04:44:05 +00:00
|
|
|
#ifdef CONFIG_PPC_PKEY
|
|
|
|
unsigned long amr;
|
|
|
|
#endif
|
|
|
|
};
|
2020-11-27 04:44:12 +00:00
|
|
|
#ifdef CONFIG_PPC_PKEY
|
|
|
|
unsigned long iamr;
|
|
|
|
#endif
|
2019-04-18 06:51:20 +00:00
|
|
|
};
|
2020-11-27 04:44:12 +00:00
|
|
|
unsigned long __pad[4]; /* Maintain 16 byte interrupt stack alignment */
|
2019-04-18 06:51:20 +00:00
|
|
|
};
|
2018-10-12 12:13:17 +00:00
|
|
|
};
|
|
|
|
#endif
|
2005-09-10 06:01:08 +00:00
|
|
|
|
powerpc/64: Fix stack trace not displaying final frame
In commit bf13718bc57a ("powerpc: show registers when unwinding
interrupt frames") we changed our stack dumping logic to show the full
registers whenever we find an interrupt frame on the stack.
However we didn't notice that on 64-bit this doesn't show the final
frame, ie. the interrupt that brought us in from userspace, whereas on
32-bit it does.
That is due to confusion about the size of that last frame. The code
in show_stack() calls validate_sp(), passing it STACK_INT_FRAME_SIZE
to check the sp is at least that far below the top of the stack.
However on 64-bit that size is too large for the final frame, because
it includes the red zone, but we don't allocate a red zone for the
first frame.
So add a new define that encodes the correct size for 32-bit and
64-bit, and use it in show_stack().
This results in the full trace being shown on 64-bit, eg:
sysrq: Trigger a crash
Kernel panic - not syncing: sysrq triggered crash
CPU: 0 PID: 83 Comm: sh Not tainted 5.11.0-rc2-gcc-8.2.0-00188-g571abcb96b10-dirty #649
Call Trace:
[c00000000a1c3ac0] [c000000000897b70] dump_stack+0xc4/0x114 (unreliable)
[c00000000a1c3b00] [c00000000014334c] panic+0x178/0x41c
[c00000000a1c3ba0] [c00000000094e600] sysrq_handle_crash+0x40/0x50
[c00000000a1c3c00] [c00000000094ef98] __handle_sysrq+0xd8/0x210
[c00000000a1c3ca0] [c00000000094f820] write_sysrq_trigger+0x100/0x188
[c00000000a1c3ce0] [c0000000005559dc] proc_reg_write+0x10c/0x1b0
[c00000000a1c3d10] [c000000000479950] vfs_write+0xf0/0x360
[c00000000a1c3d60] [c000000000479d9c] ksys_write+0x7c/0x140
[c00000000a1c3db0] [c00000000002bf5c] system_call_exception+0x19c/0x2c0
[c00000000a1c3e10] [c00000000000d35c] system_call_common+0xec/0x278
--- interrupt: c00 at 0x7fff9fbab428
NIP: 00007fff9fbab428 LR: 000000001000b724 CTR: 0000000000000000
REGS: c00000000a1c3e80 TRAP: 0c00 Not tainted (5.11.0-rc2-gcc-8.2.0-00188-g571abcb96b10-dirty)
MSR: 900000000280f033 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 22002884 XER: 00000000
IRQMASK: 0
GPR00: 0000000000000004 00007fffc3cb8960 00007fff9fc59900 0000000000000001
GPR04: 000000002a4b32d0 0000000000000002 0000000000000063 0000000000000063
GPR08: 000000002a4b32d0 0000000000000000 0000000000000000 0000000000000000
GPR12: 0000000000000000 00007fff9fcca9a0 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 00000000100b8fd0
GPR20: 000000002a4b3485 00000000100b8f90 0000000000000000 0000000000000000
GPR24: 000000002a4b0440 00000000100e77b8 0000000000000020 000000002a4b32d0
GPR28: 0000000000000001 0000000000000002 000000002a4b32d0 0000000000000001
NIP [00007fff9fbab428] 0x7fff9fbab428
LR [000000001000b724] 0x1000b724
--- interrupt: c00
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210209141627.2898485-1-mpe@ellerman.id.au
2021-02-09 13:59:20 +00:00
|
|
|
|
|
|
|
#define STACK_FRAME_WITH_PT_REGS (STACK_FRAME_OVERHEAD + sizeof(struct pt_regs))
|
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
|
2014-02-26 06:07:38 +00:00
|
|
|
/*
|
|
|
|
* Size of redzone that userspace is allowed to use below the stack
|
|
|
|
* pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in
|
|
|
|
* the new ELFv2 little-endian ABI, so we allow the larger amount.
|
|
|
|
*
|
|
|
|
* For kernel code we allow a 288-byte redzone, in order to conserve
|
|
|
|
* kernel stack space; gcc currently only uses 288 bytes, and will
|
|
|
|
* hopefully allow explicit control of the redzone size in future.
|
|
|
|
*/
|
|
|
|
#define USER_REDZONE_SIZE 512
|
|
|
|
#define KERNEL_REDZONE_SIZE 288
|
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
|
2008-04-17 04:34:59 +00:00
|
|
|
#define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */
|
|
|
|
#define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265)
|
|
|
|
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \
|
2014-02-26 06:07:38 +00:00
|
|
|
STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
|
2008-04-17 04:34:59 +00:00
|
|
|
#define STACK_FRAME_MARKER 12
|
2005-11-03 04:14:36 +00:00
|
|
|
|
2016-06-06 16:56:10 +00:00
|
|
|
#ifdef PPC64_ELF_ABI_v2
|
2014-08-26 02:44:15 +00:00
|
|
|
#define STACK_FRAME_MIN_SIZE 32
|
|
|
|
#else
|
|
|
|
#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
|
|
|
|
#endif
|
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
/* Size of dummy stack frame allocated when calling signal handler. */
|
|
|
|
#define __SIGNAL_FRAMESIZE 128
|
|
|
|
#define __SIGNAL_FRAMESIZE32 64
|
|
|
|
|
|
|
|
#else /* __powerpc64__ */
|
|
|
|
|
2014-02-26 06:07:38 +00:00
|
|
|
#define USER_REDZONE_SIZE 0
|
|
|
|
#define KERNEL_REDZONE_SIZE 0
|
2005-11-03 04:14:36 +00:00
|
|
|
#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
|
2008-04-17 04:34:59 +00:00
|
|
|
#define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */
|
|
|
|
#define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773)
|
|
|
|
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
|
|
|
|
#define STACK_FRAME_MARKER 2
|
2014-08-26 02:44:15 +00:00
|
|
|
#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
|
2005-11-03 04:14:36 +00:00
|
|
|
|
|
|
|
/* Size of stack frame allocated when calling signal handler. */
|
|
|
|
#define __SIGNAL_FRAMESIZE 64
|
|
|
|
|
|
|
|
#endif /* __powerpc64__ */
|
2005-09-10 06:01:08 +00:00
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2019-06-24 05:47:25 +00:00
|
|
|
static inline unsigned long instruction_pointer(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return regs->nip;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void instruction_pointer_set(struct pt_regs *regs,
|
|
|
|
unsigned long val)
|
|
|
|
{
|
|
|
|
regs->nip = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return regs->gpr[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long frame_pointer(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2012-02-08 04:53:13 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
extern unsigned long profile_pc(struct pt_regs *regs);
|
2019-06-24 05:47:25 +00:00
|
|
|
#else
|
|
|
|
#define profile_pc(regs) instruction_pointer(regs)
|
2012-02-08 04:53:13 +00:00
|
|
|
#endif
|
|
|
|
|
2020-02-25 17:35:34 +00:00
|
|
|
long do_syscall_trace_enter(struct pt_regs *regs);
|
|
|
|
void do_syscall_trace_leave(struct pt_regs *regs);
|
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
#ifdef __powerpc64__
|
2005-04-16 22:20:36 +00:00
|
|
|
#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
|
2005-11-03 04:14:36 +00:00
|
|
|
#else
|
|
|
|
#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
|
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define force_successful_syscall_return() \
|
2005-11-03 04:14:36 +00:00
|
|
|
do { \
|
[PATCH] syscall entry/exit revamp
This cleanup patch speeds up the null syscall path on ppc64 by about 3%,
and brings the ppc32 and ppc64 code slightly closer together.
The ppc64 code was checking current_thread_info()->flags twice in the
syscall exit path; once for TIF_SYSCALL_T_OR_A before disabling
interrupts, and then again for TIF_SIGPENDING|TIF_NEED_RESCHED etc after
disabling interrupts. Now we do the same as ppc32 -- check the flags
only once in the fast path, and re-enable interrupts if necessary in the
ptrace case.
The patch abolishes the 'syscall_noerror' member of struct thread_info
and replaces it with a TIF_NOERROR bit in the flags, which is handled in
the slow path. This shortens the syscall entry code, which no longer
needs to clear syscall_noerror.
The patch adds a TIF_SAVE_NVGPRS flag which causes the syscall exit slow
path to save the non-volatile GPRs into a signal frame. This removes the
need for the assembly wrappers around sys_sigsuspend(),
sys_rt_sigsuspend(), et al which existed solely to save those registers
in advance. It also means I don't have to add new wrappers for ppoll()
and pselect(), which is what I was supposed to be doing when I got
distracted into this...
Finally, it unifies the ppc64 and ppc32 methods of handling syscall exit
directly into a signal handler (as required by sigsuspend et al) by
introducing a TIF_RESTOREALL flag which causes _all_ the registers to be
reloaded from the pt_regs by taking the ret_from_exception path, instead
of the normal syscall exit path which stomps on the callee-saved GPRs.
It appears to pass an LTP test run on ppc64, and passes basic testing on
ppc32 too. Brief tests of ptrace functionality with strace and gdb also
appear OK. I wouldn't send it to Linus for 2.6.15 just yet though :)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-15 18:52:18 +00:00
|
|
|
set_thread_flag(TIF_NOERROR); \
|
2005-11-03 04:14:36 +00:00
|
|
|
} while(0)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2012-08-31 19:48:05 +00:00
|
|
|
#define current_pt_regs() \
|
2019-01-18 07:40:34 +00:00
|
|
|
((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
|
2020-05-07 12:13:29 +00:00
|
|
|
|
2021-03-16 10:42:05 +00:00
|
|
|
/*
|
|
|
|
* The 4 low bits (0xf) are available as flags to overload the trap word,
|
|
|
|
* because interrupt vectors have minimum alignment of 0x10. TRAP_FLAGS_MASK
|
|
|
|
* must cover the bits used as flags, including bit 0 which is used as the
|
|
|
|
* "norestart" bit.
|
|
|
|
*/
|
2020-05-07 12:13:29 +00:00
|
|
|
#ifdef __powerpc64__
|
2021-03-16 10:42:05 +00:00
|
|
|
#define TRAP_FLAGS_MASK 0x1
|
2020-05-07 12:13:29 +00:00
|
|
|
#else
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2021-03-16 10:42:04 +00:00
|
|
|
* On 4xx we use bit 1 in the trap word to indicate whether the exception
|
2005-11-03 04:14:36 +00:00
|
|
|
* is a critical exception (1 means it is).
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2021-03-16 10:42:05 +00:00
|
|
|
#define TRAP_FLAGS_MASK 0xf
|
2007-12-21 04:39:21 +00:00
|
|
|
#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
|
|
|
|
#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
|
2008-04-30 10:44:53 +00:00
|
|
|
#define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
|
2005-11-03 04:14:36 +00:00
|
|
|
#endif /* __powerpc64__ */
|
2021-03-16 10:42:05 +00:00
|
|
|
#define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
|
2005-09-10 06:01:08 +00:00
|
|
|
|
2021-03-10 17:57:07 +00:00
|
|
|
static __always_inline void set_trap(struct pt_regs *regs, unsigned long val)
|
2020-05-07 12:13:30 +00:00
|
|
|
{
|
|
|
|
regs->trap = (regs->trap & TRAP_FLAGS_MASK) | (val & ~TRAP_FLAGS_MASK);
|
|
|
|
}
|
|
|
|
|
2020-06-11 08:12:03 +00:00
|
|
|
static inline bool trap_is_scv(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x3000);
|
|
|
|
}
|
|
|
|
|
2021-02-09 19:29:27 +00:00
|
|
|
static inline bool trap_is_unsupported_scv(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x7ff0;
|
|
|
|
}
|
|
|
|
|
2020-05-07 12:13:31 +00:00
|
|
|
static inline bool trap_is_syscall(struct pt_regs *regs)
|
|
|
|
{
|
2020-06-11 08:12:03 +00:00
|
|
|
return (trap_is_scv(regs) || TRAP(regs) == 0xc00);
|
2020-05-07 12:13:31 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 12:13:32 +00:00
|
|
|
static inline bool trap_norestart(struct pt_regs *regs)
|
|
|
|
{
|
2021-03-16 10:42:05 +00:00
|
|
|
return regs->trap & 0x1;
|
2020-05-07 12:13:32 +00:00
|
|
|
}
|
|
|
|
|
2021-03-19 11:06:57 +00:00
|
|
|
static __always_inline void set_trap_norestart(struct pt_regs *regs)
|
2020-05-07 12:13:32 +00:00
|
|
|
{
|
2021-03-16 10:42:05 +00:00
|
|
|
regs->trap |= 0x1;
|
2020-05-07 12:13:32 +00:00
|
|
|
}
|
|
|
|
|
2021-05-20 11:19:31 +00:00
|
|
|
#define kernel_stack_pointer(regs) ((regs)->gpr[1])
|
|
|
|
static inline int is_syscall_success(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
if (trap_is_scv(regs))
|
|
|
|
return !IS_ERR_VALUE((unsigned long)regs->gpr[3]);
|
|
|
|
else
|
|
|
|
return !(regs->ccr & 0x10000000);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long regs_return_value(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
if (trap_is_scv(regs))
|
|
|
|
return regs->gpr[3];
|
|
|
|
|
|
|
|
if (is_syscall_success(regs))
|
|
|
|
return regs->gpr[3];
|
|
|
|
else
|
|
|
|
return -regs->gpr[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
|
|
|
|
{
|
|
|
|
regs->gpr[3] = rc;
|
|
|
|
}
|
|
|
|
|
2008-01-30 12:30:51 +00:00
|
|
|
#define arch_has_single_step() (1)
|
2019-08-26 15:52:14 +00:00
|
|
|
#define arch_has_block_step() (true)
|
2018-04-16 19:18:26 +00:00
|
|
|
#define ARCH_HAS_USER_SINGLE_STEP_REPORT
|
2009-12-16 00:47:18 +00:00
|
|
|
|
2010-04-07 08:10:20 +00:00
|
|
|
/*
|
|
|
|
* kprobe-based event tracer support
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
#include <linux/thread_info.h>
|
|
|
|
extern int regs_query_register_offset(const char *name);
|
|
|
|
extern const char *regs_query_register_name(unsigned int offset);
|
|
|
|
#define MAX_REG_OFFSET (offsetof(struct pt_regs, dsisr))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* regs_get_register() - get register value from its offset
|
|
|
|
* @regs: pt_regs from which register value is gotten
|
|
|
|
* @offset: offset number of the register.
|
|
|
|
*
|
|
|
|
* regs_get_register returns the value of a register whose offset from @regs.
|
|
|
|
* The @offset is the offset of the register in struct pt_regs.
|
|
|
|
* If @offset is bigger than MAX_REG_OFFSET, this returns 0.
|
|
|
|
*/
|
|
|
|
static inline unsigned long regs_get_register(struct pt_regs *regs,
|
|
|
|
unsigned int offset)
|
|
|
|
{
|
|
|
|
if (unlikely(offset > MAX_REG_OFFSET))
|
|
|
|
return 0;
|
|
|
|
return *(unsigned long *)((unsigned long)regs + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* regs_within_kernel_stack() - check the address in the stack
|
|
|
|
* @regs: pt_regs which contains kernel stack pointer.
|
|
|
|
* @addr: address which is checked.
|
|
|
|
*
|
|
|
|
* regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
|
|
|
|
* If @addr is within the kernel stack, it returns true. If not, returns false.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline bool regs_within_kernel_stack(struct pt_regs *regs,
|
|
|
|
unsigned long addr)
|
|
|
|
{
|
|
|
|
return ((addr & ~(THREAD_SIZE - 1)) ==
|
|
|
|
(kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* regs_get_kernel_stack_nth() - get Nth entry of the stack
|
|
|
|
* @regs: pt_regs which contains kernel stack pointer.
|
|
|
|
* @n: stack entry number.
|
|
|
|
*
|
|
|
|
* regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
|
|
|
|
* is specified by @regs. If the @n th entry is NOT in the kernel stack,
|
|
|
|
* this returns 0.
|
|
|
|
*/
|
|
|
|
static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
|
|
|
|
unsigned int n)
|
|
|
|
{
|
|
|
|
unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
|
|
|
|
addr += n;
|
|
|
|
if (regs_within_kernel_stack(regs, (unsigned long)addr))
|
|
|
|
return *addr;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-09-10 06:01:08 +00:00
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
2005-11-03 04:14:36 +00:00
|
|
|
#ifndef __powerpc64__
|
2020-02-28 00:14:39 +00:00
|
|
|
/* We need PT_SOFTE defined at all time to avoid #ifdefs */
|
|
|
|
#define PT_SOFTE PT_MQ
|
2005-11-03 04:14:36 +00:00
|
|
|
#else /* __powerpc64__ */
|
2005-09-10 06:01:08 +00:00
|
|
|
#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
|
2005-04-16 22:20:36 +00:00
|
|
|
#define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */
|
|
|
|
#define PT_VSCR_32 (PT_VR0 + 32*4 + 3)
|
|
|
|
#define PT_VRSAVE_32 (PT_VR0 + 33*4)
|
2008-06-25 04:07:18 +00:00
|
|
|
#define PT_VSR0_32 300 /* each VSR reg occupies 4 slots in 32-bit */
|
2005-11-03 04:14:36 +00:00
|
|
|
#endif /* __powerpc64__ */
|
|
|
|
#endif /* _ASM_POWERPC_PTRACE_H */
|