mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Currently <linux/compiler.h> isn't included at all (not even transitively) in <asm/ptrace.h>. arch/parisc/kernel/asm-offsets.c just happens to include the following chain of includes before <asm/ptrace.h>: <linux/sched.h> -> <asm/processor.h> -> <asm/hardware.h> -> <linux/mod_devicetable.h> -> <linux/uuid.h> -> <linux/string.h> -> <linux/compiler.h> . That chain will be broken, because in one of the next commits <asm/hardware.h> is changed to only include <linux/device-id/parisc.h> instead of <linux/mod_devicetable.h>. So to ensure arch/parisc/kernel/asm-offsets.c knows about unlikely() even after that change, #include <linux/compiler.h> explicitly. Link: https://patch.msgid.link/0574a2b73363c3cbf21c55c27455c3cecfb33583.1782808461.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg
|
|
** Copyright (C) 2000 Grant Grundler, Hewlett-Packard
|
|
*/
|
|
#ifndef _PARISC_PTRACE_H
|
|
#define _PARISC_PTRACE_H
|
|
|
|
#include <asm/assembly.h>
|
|
#include <uapi/asm/ptrace.h>
|
|
#include <linux/compiler.h>
|
|
|
|
#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS))
|
|
|
|
#define arch_has_single_step() 1
|
|
#define arch_has_block_step() 1
|
|
|
|
/* XXX should we use iaoq[1] or iaoq[0] ? */
|
|
#define user_mode(regs) (((regs)->iaoq[0] & 3) != PRIV_KERNEL)
|
|
#define user_space(regs) ((regs)->iasq[1] != PRIV_KERNEL)
|
|
#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)
|
|
#define user_stack_pointer(regs) ((regs)->gr[30])
|
|
unsigned long profile_pc(struct pt_regs *);
|
|
|
|
static inline unsigned long regs_return_value(struct pt_regs *regs)
|
|
{
|
|
return regs->gr[28];
|
|
}
|
|
|
|
static inline void instruction_pointer_set(struct pt_regs *regs,
|
|
unsigned long val)
|
|
{
|
|
regs->iaoq[0] = val;
|
|
regs->iaoq[1] = val + 4;
|
|
}
|
|
|
|
/* Query offset/name of register from its name/offset */
|
|
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, ipsw))
|
|
|
|
#define kernel_stack_pointer(regs) ((regs)->gr[30])
|
|
|
|
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);
|
|
}
|
|
|
|
unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n);
|
|
int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr);
|
|
|
|
#endif
|