2019-06-04 08:11:33 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2013-01-18 09:42:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/ptrace.h>
|
2017-02-08 17:51:37 +00:00
|
|
|
#include <linux/sched/task_stack.h>
|
2013-01-18 09:42:22 +00:00
|
|
|
#include <linux/regset.h>
|
|
|
|
#include <linux/unistd.h>
|
|
|
|
#include <linux/elf.h>
|
|
|
|
|
2022-04-14 08:17:23 +00:00
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
|
#include <trace/events/syscalls.h>
|
|
|
|
|
2022-04-14 08:17:21 +00:00
|
|
|
struct pt_regs_offset {
|
|
|
|
const char *name;
|
|
|
|
int offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)}
|
|
|
|
#define REG_OFFSET_END {.name = NULL, .offset = 0}
|
|
|
|
|
|
|
|
#ifdef CONFIG_ISA_ARCOMPACT
|
|
|
|
static const struct pt_regs_offset regoffset_table[] = {
|
|
|
|
REG_OFFSET_NAME(bta),
|
|
|
|
REG_OFFSET_NAME(lp_start),
|
|
|
|
REG_OFFSET_NAME(lp_end),
|
|
|
|
REG_OFFSET_NAME(lp_count),
|
|
|
|
REG_OFFSET_NAME(status32),
|
|
|
|
REG_OFFSET_NAME(ret),
|
|
|
|
REG_OFFSET_NAME(blink),
|
|
|
|
REG_OFFSET_NAME(fp),
|
|
|
|
REG_OFFSET_NAME(r26),
|
|
|
|
REG_OFFSET_NAME(r12),
|
|
|
|
REG_OFFSET_NAME(r11),
|
|
|
|
REG_OFFSET_NAME(r10),
|
|
|
|
REG_OFFSET_NAME(r9),
|
|
|
|
REG_OFFSET_NAME(r8),
|
|
|
|
REG_OFFSET_NAME(r7),
|
|
|
|
REG_OFFSET_NAME(r6),
|
|
|
|
REG_OFFSET_NAME(r5),
|
|
|
|
REG_OFFSET_NAME(r4),
|
|
|
|
REG_OFFSET_NAME(r3),
|
|
|
|
REG_OFFSET_NAME(r2),
|
|
|
|
REG_OFFSET_NAME(r1),
|
|
|
|
REG_OFFSET_NAME(r0),
|
|
|
|
REG_OFFSET_NAME(sp),
|
|
|
|
REG_OFFSET_NAME(orig_r0),
|
2020-05-22 00:44:32 +00:00
|
|
|
REG_OFFSET_NAME(ecr),
|
2022-04-14 08:17:21 +00:00
|
|
|
REG_OFFSET_END,
|
|
|
|
};
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static const struct pt_regs_offset regoffset_table[] = {
|
|
|
|
REG_OFFSET_NAME(orig_r0),
|
2020-05-22 00:44:32 +00:00
|
|
|
REG_OFFSET_NAME(ecr),
|
2022-04-14 08:17:21 +00:00
|
|
|
REG_OFFSET_NAME(bta),
|
|
|
|
REG_OFFSET_NAME(r26),
|
|
|
|
REG_OFFSET_NAME(fp),
|
|
|
|
REG_OFFSET_NAME(sp),
|
|
|
|
REG_OFFSET_NAME(r12),
|
|
|
|
REG_OFFSET_NAME(r30),
|
|
|
|
#ifdef CONFIG_ARC_HAS_ACCL_REGS
|
|
|
|
REG_OFFSET_NAME(r58),
|
|
|
|
REG_OFFSET_NAME(r59),
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARC_DSP_SAVE_RESTORE_REGS
|
|
|
|
REG_OFFSET_NAME(DSP_CTRL),
|
|
|
|
#endif
|
|
|
|
REG_OFFSET_NAME(r0),
|
|
|
|
REG_OFFSET_NAME(r1),
|
|
|
|
REG_OFFSET_NAME(r2),
|
|
|
|
REG_OFFSET_NAME(r3),
|
|
|
|
REG_OFFSET_NAME(r4),
|
|
|
|
REG_OFFSET_NAME(r5),
|
|
|
|
REG_OFFSET_NAME(r6),
|
|
|
|
REG_OFFSET_NAME(r7),
|
|
|
|
REG_OFFSET_NAME(r8),
|
|
|
|
REG_OFFSET_NAME(r9),
|
|
|
|
REG_OFFSET_NAME(r10),
|
|
|
|
REG_OFFSET_NAME(r11),
|
|
|
|
REG_OFFSET_NAME(blink),
|
|
|
|
REG_OFFSET_NAME(lp_end),
|
|
|
|
REG_OFFSET_NAME(lp_start),
|
|
|
|
REG_OFFSET_NAME(lp_count),
|
|
|
|
REG_OFFSET_NAME(ei),
|
|
|
|
REG_OFFSET_NAME(ldi),
|
|
|
|
REG_OFFSET_NAME(jli),
|
|
|
|
REG_OFFSET_NAME(ret),
|
|
|
|
REG_OFFSET_NAME(status32),
|
|
|
|
REG_OFFSET_END,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2013-01-18 09:42:22 +00:00
|
|
|
static struct callee_regs *task_callee_regs(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
struct callee_regs *tmp = (struct callee_regs *)tsk->thread.callee_reg;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int genregs_get(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
2020-06-16 06:01:10 +00:00
|
|
|
struct membuf to)
|
2013-01-18 09:42:22 +00:00
|
|
|
{
|
|
|
|
const struct pt_regs *ptregs = task_pt_regs(target);
|
|
|
|
const struct callee_regs *cregs = task_callee_regs(target);
|
|
|
|
unsigned int stop_pc_val;
|
|
|
|
|
2020-06-16 06:01:10 +00:00
|
|
|
membuf_zero(&to, 4); // pad
|
|
|
|
membuf_store(&to, ptregs->bta);
|
|
|
|
membuf_store(&to, ptregs->lp_start);
|
|
|
|
membuf_store(&to, ptregs->lp_end);
|
|
|
|
membuf_store(&to, ptregs->lp_count);
|
|
|
|
membuf_store(&to, ptregs->status32);
|
|
|
|
membuf_store(&to, ptregs->ret);
|
|
|
|
membuf_store(&to, ptregs->blink);
|
|
|
|
membuf_store(&to, ptregs->fp);
|
|
|
|
membuf_store(&to, ptregs->r26); // gp
|
|
|
|
membuf_store(&to, ptregs->r12);
|
|
|
|
membuf_store(&to, ptregs->r11);
|
|
|
|
membuf_store(&to, ptregs->r10);
|
|
|
|
membuf_store(&to, ptregs->r9);
|
|
|
|
membuf_store(&to, ptregs->r8);
|
|
|
|
membuf_store(&to, ptregs->r7);
|
|
|
|
membuf_store(&to, ptregs->r6);
|
|
|
|
membuf_store(&to, ptregs->r5);
|
|
|
|
membuf_store(&to, ptregs->r4);
|
|
|
|
membuf_store(&to, ptregs->r3);
|
|
|
|
membuf_store(&to, ptregs->r2);
|
|
|
|
membuf_store(&to, ptregs->r1);
|
|
|
|
membuf_store(&to, ptregs->r0);
|
|
|
|
membuf_store(&to, ptregs->sp);
|
|
|
|
membuf_zero(&to, 4); // pad2
|
|
|
|
membuf_store(&to, cregs->r25);
|
|
|
|
membuf_store(&to, cregs->r24);
|
|
|
|
membuf_store(&to, cregs->r23);
|
|
|
|
membuf_store(&to, cregs->r22);
|
|
|
|
membuf_store(&to, cregs->r21);
|
|
|
|
membuf_store(&to, cregs->r20);
|
|
|
|
membuf_store(&to, cregs->r19);
|
|
|
|
membuf_store(&to, cregs->r18);
|
|
|
|
membuf_store(&to, cregs->r17);
|
|
|
|
membuf_store(&to, cregs->r16);
|
|
|
|
membuf_store(&to, cregs->r15);
|
|
|
|
membuf_store(&to, cregs->r14);
|
|
|
|
membuf_store(&to, cregs->r13);
|
|
|
|
membuf_store(&to, target->thread.fault_address); // efa
|
|
|
|
|
|
|
|
if (in_brkpt_trap(ptregs)) {
|
|
|
|
stop_pc_val = target->thread.fault_address;
|
|
|
|
pr_debug("\t\tstop_pc (brk-pt)\n");
|
|
|
|
} else {
|
|
|
|
stop_pc_val = ptregs->ret;
|
|
|
|
pr_debug("\t\tstop_pc (others)\n");
|
2013-01-18 09:42:22 +00:00
|
|
|
}
|
|
|
|
|
2020-06-16 06:01:10 +00:00
|
|
|
return membuf_store(&to, stop_pc_val); // stop_pc
|
2013-01-18 09:42:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int genregs_set(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf)
|
|
|
|
{
|
|
|
|
const struct pt_regs *ptregs = task_pt_regs(target);
|
|
|
|
const struct callee_regs *cregs = task_callee_regs(target);
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
#define REG_IN_CHUNK(FIRST, NEXT, PTR) \
|
|
|
|
if (!ret) \
|
|
|
|
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \
|
|
|
|
(void *)(PTR), \
|
|
|
|
offsetof(struct user_regs_struct, FIRST), \
|
|
|
|
offsetof(struct user_regs_struct, NEXT));
|
|
|
|
|
|
|
|
#define REG_IN_ONE(LOC, PTR) \
|
|
|
|
if (!ret) \
|
|
|
|
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \
|
|
|
|
(void *)(PTR), \
|
|
|
|
offsetof(struct user_regs_struct, LOC), \
|
|
|
|
offsetof(struct user_regs_struct, LOC) + 4);
|
|
|
|
|
|
|
|
#define REG_IGNORE_ONE(LOC) \
|
|
|
|
if (!ret) \
|
2022-10-14 21:22:23 +00:00
|
|
|
user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, \
|
2013-01-18 09:42:22 +00:00
|
|
|
offsetof(struct user_regs_struct, LOC), \
|
|
|
|
offsetof(struct user_regs_struct, LOC) + 4);
|
|
|
|
|
2013-05-28 04:13:17 +00:00
|
|
|
REG_IGNORE_ONE(pad);
|
2014-05-14 14:05:15 +00:00
|
|
|
|
|
|
|
REG_IN_ONE(scratch.bta, &ptregs->bta);
|
|
|
|
REG_IN_ONE(scratch.lp_start, &ptregs->lp_start);
|
|
|
|
REG_IN_ONE(scratch.lp_end, &ptregs->lp_end);
|
|
|
|
REG_IN_ONE(scratch.lp_count, &ptregs->lp_count);
|
|
|
|
|
|
|
|
REG_IGNORE_ONE(scratch.status32);
|
|
|
|
|
|
|
|
REG_IN_ONE(scratch.ret, &ptregs->ret);
|
|
|
|
REG_IN_ONE(scratch.blink, &ptregs->blink);
|
|
|
|
REG_IN_ONE(scratch.fp, &ptregs->fp);
|
|
|
|
REG_IN_ONE(scratch.gp, &ptregs->r26);
|
|
|
|
REG_IN_ONE(scratch.r12, &ptregs->r12);
|
|
|
|
REG_IN_ONE(scratch.r11, &ptregs->r11);
|
|
|
|
REG_IN_ONE(scratch.r10, &ptregs->r10);
|
|
|
|
REG_IN_ONE(scratch.r9, &ptregs->r9);
|
|
|
|
REG_IN_ONE(scratch.r8, &ptregs->r8);
|
|
|
|
REG_IN_ONE(scratch.r7, &ptregs->r7);
|
|
|
|
REG_IN_ONE(scratch.r6, &ptregs->r6);
|
|
|
|
REG_IN_ONE(scratch.r5, &ptregs->r5);
|
|
|
|
REG_IN_ONE(scratch.r4, &ptregs->r4);
|
|
|
|
REG_IN_ONE(scratch.r3, &ptregs->r3);
|
|
|
|
REG_IN_ONE(scratch.r2, &ptregs->r2);
|
|
|
|
REG_IN_ONE(scratch.r1, &ptregs->r1);
|
|
|
|
REG_IN_ONE(scratch.r0, &ptregs->r0);
|
|
|
|
REG_IN_ONE(scratch.sp, &ptregs->sp);
|
|
|
|
|
2013-05-27 16:13:41 +00:00
|
|
|
REG_IGNORE_ONE(pad2);
|
2014-05-14 14:05:15 +00:00
|
|
|
|
|
|
|
REG_IN_ONE(callee.r25, &cregs->r25);
|
|
|
|
REG_IN_ONE(callee.r24, &cregs->r24);
|
|
|
|
REG_IN_ONE(callee.r23, &cregs->r23);
|
|
|
|
REG_IN_ONE(callee.r22, &cregs->r22);
|
|
|
|
REG_IN_ONE(callee.r21, &cregs->r21);
|
|
|
|
REG_IN_ONE(callee.r20, &cregs->r20);
|
|
|
|
REG_IN_ONE(callee.r19, &cregs->r19);
|
|
|
|
REG_IN_ONE(callee.r18, &cregs->r18);
|
|
|
|
REG_IN_ONE(callee.r17, &cregs->r17);
|
|
|
|
REG_IN_ONE(callee.r16, &cregs->r16);
|
|
|
|
REG_IN_ONE(callee.r15, &cregs->r15);
|
|
|
|
REG_IN_ONE(callee.r14, &cregs->r14);
|
|
|
|
REG_IN_ONE(callee.r13, &cregs->r13);
|
|
|
|
|
2013-01-18 09:42:22 +00:00
|
|
|
REG_IGNORE_ONE(efa); /* efa update invalid */
|
2014-05-14 14:05:15 +00:00
|
|
|
REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */
|
2013-01-18 09:42:22 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-05-03 18:21:31 +00:00
|
|
|
#ifdef CONFIG_ISA_ARCV2
|
|
|
|
static int arcv2regs_get(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
2020-06-16 06:01:10 +00:00
|
|
|
struct membuf to)
|
2017-05-03 18:21:31 +00:00
|
|
|
{
|
|
|
|
const struct pt_regs *regs = task_pt_regs(target);
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_ARC_HAS_ACCL_REGS))
|
2020-06-16 06:01:10 +00:00
|
|
|
/*
|
|
|
|
* itemized copy not needed like above as layout of regs (r30,r58,r59)
|
|
|
|
* is exactly same in kernel (pt_regs) and userspace (user_regs_arcv2)
|
|
|
|
*/
|
|
|
|
return membuf_write(&to, ®s->r30, sizeof(struct user_regs_arcv2));
|
2017-05-03 18:21:31 +00:00
|
|
|
|
|
|
|
|
2020-06-16 06:01:10 +00:00
|
|
|
membuf_write(&to, ®s->r30, 4); /* r30 only */
|
|
|
|
return membuf_zero(&to, sizeof(struct user_regs_arcv2) - 4);
|
2017-05-03 18:21:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int arcv2regs_set(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf)
|
|
|
|
{
|
|
|
|
const struct pt_regs *regs = task_pt_regs(target);
|
|
|
|
int ret, copy_sz;
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_ARC_HAS_ACCL_REGS))
|
|
|
|
copy_sz = sizeof(struct user_regs_arcv2);
|
|
|
|
else
|
|
|
|
copy_sz = 4; /* r30 only */
|
|
|
|
|
|
|
|
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, (void *)®s->r30,
|
|
|
|
0, copy_sz);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-01-18 09:42:22 +00:00
|
|
|
enum arc_getset {
|
2017-05-03 18:21:31 +00:00
|
|
|
REGSET_CMN,
|
|
|
|
REGSET_ARCV2,
|
2013-01-18 09:42:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct user_regset arc_regsets[] = {
|
2017-05-03 18:21:31 +00:00
|
|
|
[REGSET_CMN] = {
|
2013-01-18 09:42:22 +00:00
|
|
|
.core_note_type = NT_PRSTATUS,
|
|
|
|
.n = ELF_NGREG,
|
|
|
|
.size = sizeof(unsigned long),
|
|
|
|
.align = sizeof(unsigned long),
|
2020-06-16 06:01:10 +00:00
|
|
|
.regset_get = genregs_get,
|
2013-01-18 09:42:22 +00:00
|
|
|
.set = genregs_set,
|
2017-05-03 18:21:31 +00:00
|
|
|
},
|
|
|
|
#ifdef CONFIG_ISA_ARCV2
|
|
|
|
[REGSET_ARCV2] = {
|
|
|
|
.core_note_type = NT_ARC_V2,
|
|
|
|
.n = ELF_ARCV2REG,
|
|
|
|
.size = sizeof(unsigned long),
|
|
|
|
.align = sizeof(unsigned long),
|
2020-06-16 06:01:10 +00:00
|
|
|
.regset_get = arcv2regs_get,
|
2017-05-03 18:21:31 +00:00
|
|
|
.set = arcv2regs_set,
|
|
|
|
},
|
|
|
|
#endif
|
2013-01-18 09:42:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct user_regset_view user_arc_view = {
|
2020-04-13 01:32:40 +00:00
|
|
|
.name = "arc",
|
ARCv2: Support for ARCv2 ISA and HS38x cores
The notable features are:
- SMP configurations of upto 4 cores with coherency
- Optional L2 Cache and IO-Coherency
- Revised Interrupt Architecture (multiple priorites, reg banks,
auto stack switch, auto regfile save/restore)
- MMUv4 (PIPT dcache, Huge Pages)
- Instructions for
* 64bit load/store: LDD, STD
* Hardware assisted divide/remainder: DIV, REM
* Function prologue/epilogue: ENTER_S, LEAVE_S
* IRQ enable/disable: CLRI, SETI
* pop count: FFS, FLS
* SETcc, BMSKN, XBFU...
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2013-05-13 13:00:41 +00:00
|
|
|
.e_machine = EM_ARC_INUSE,
|
2013-01-18 09:42:22 +00:00
|
|
|
.regsets = arc_regsets,
|
|
|
|
.n = ARRAY_SIZE(arc_regsets)
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct user_regset_view *task_user_regset_view(struct task_struct *task)
|
|
|
|
{
|
|
|
|
return &user_arc_view;
|
|
|
|
}
|
2013-01-18 09:42:21 +00:00
|
|
|
|
|
|
|
void ptrace_disable(struct task_struct *child)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
long arch_ptrace(struct task_struct *child, long request,
|
|
|
|
unsigned long addr, unsigned long data)
|
|
|
|
{
|
|
|
|
int ret = -EIO;
|
2013-01-18 09:42:22 +00:00
|
|
|
|
|
|
|
pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data);
|
|
|
|
|
|
|
|
switch (request) {
|
2014-06-20 16:28:39 +00:00
|
|
|
case PTRACE_GET_THREAD_AREA:
|
|
|
|
ret = put_user(task_thread_info(child)->thr_ptr,
|
|
|
|
(unsigned long __user *)data);
|
|
|
|
break;
|
2013-01-18 09:42:22 +00:00
|
|
|
default:
|
|
|
|
ret = ptrace_request(child, request, addr, data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-18 09:42:21 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-05-19 23:01:52 +00:00
|
|
|
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
|
2013-01-18 09:42:22 +00:00
|
|
|
{
|
2022-04-14 08:17:23 +00:00
|
|
|
if (test_thread_flag(TIF_SYSCALL_TRACE))
|
|
|
|
if (ptrace_report_syscall_entry(regs))
|
|
|
|
return ULONG_MAX;
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
|
|
|
|
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
|
|
|
|
trace_sys_enter(regs, syscall_get_nr(current, regs));
|
|
|
|
#endif
|
2013-01-18 09:42:21 +00:00
|
|
|
|
2013-01-18 09:42:22 +00:00
|
|
|
return regs->r8;
|
|
|
|
}
|
|
|
|
|
|
|
|
asmlinkage void syscall_trace_exit(struct pt_regs *regs)
|
2013-01-18 09:42:21 +00:00
|
|
|
{
|
2022-04-14 08:17:23 +00:00
|
|
|
if (test_thread_flag(TIF_SYSCALL_TRACE))
|
|
|
|
ptrace_report_syscall_exit(regs, 0);
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
|
|
|
|
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
|
|
|
|
trace_sys_exit(regs, regs_return_value(regs));
|
|
|
|
#endif
|
2013-01-18 09:42:21 +00:00
|
|
|
}
|
2022-04-14 08:17:21 +00:00
|
|
|
|
|
|
|
int regs_query_register_offset(const char *name)
|
|
|
|
{
|
|
|
|
const struct pt_regs_offset *roff;
|
|
|
|
|
|
|
|
for (roff = regoffset_table; roff->name != NULL; roff++)
|
|
|
|
if (!strcmp(roff->name, name))
|
|
|
|
return roff->offset;
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *regs_query_register_name(unsigned int offset)
|
|
|
|
{
|
|
|
|
const struct pt_regs_offset *roff;
|
|
|
|
for (roff = regoffset_table; roff->name != NULL; roff++)
|
|
|
|
if (roff->offset == offset)
|
|
|
|
return roff->name;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
|
|
|
|
{
|
|
|
|
return (addr & ~(THREAD_SIZE - 1)) ==
|
|
|
|
(kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|