arch/arm64/include/asm/ptrace.h
Source file repositories/reference/linux-study-clean/arch/arm64/include/asm/ptrace.h
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/include/asm/ptrace.h- Extension
.h- Size
- 9532 bytes
- Lines
- 366
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/cpufeature.huapi/asm/ptrace.hlinux/irqchip/arm-gic-v3-prio.hlinux/bug.hlinux/types.hasm/stacktrace/frame.h
Detected Declarations
struct pt_regsstruct task_structfunction Copyrightfunction pstate_to_compat_psrfunction in_syscallfunction forget_syscallfunction regs_irqs_disabledfunction user_stack_pointerfunction regs_get_registerfunction pt_regs_read_regfunction pt_regs_write_regfunction kernel_stack_pointerfunction regs_return_valuefunction regs_set_return_valuefunction regs_get_kernel_argumentfunction instruction_pointerfunction instruction_pointer_setfunction frame_pointerfunction procedure_link_pointer_set
Annotated Snippet
struct pt_regs {
union {
struct user_pt_regs user_regs;
struct {
u64 regs[31];
u64 sp;
u64 pc;
u64 pstate;
};
};
u64 orig_x0;
s32 syscallno;
u32 pmr;
u64 sdei_ttbr1;
struct frame_record_meta stackframe;
};
/* For correct stack alignment, pt_regs has to be a multiple of 16 bytes. */
static_assert(IS_ALIGNED(sizeof(struct pt_regs), 16));
static inline bool in_syscall(struct pt_regs const *regs)
{
return regs->syscallno != NO_SYSCALL;
}
static inline void forget_syscall(struct pt_regs *regs)
{
regs->syscallno = NO_SYSCALL;
}
#define MAX_REG_OFFSET offsetof(struct pt_regs, pstate)
#define arch_has_single_step() (1)
#ifdef CONFIG_COMPAT
#define compat_thumb_mode(regs) \
(((regs)->pstate & PSR_AA32_T_BIT))
#else
#define compat_thumb_mode(regs) (0)
#endif
#define user_mode(regs) \
(((regs)->pstate & PSR_MODE_MASK) == PSR_MODE_EL0t)
#define compat_user_mode(regs) \
(((regs)->pstate & (PSR_MODE32_BIT | PSR_MODE_MASK)) == \
(PSR_MODE32_BIT | PSR_MODE_EL0t))
#define processor_mode(regs) \
((regs)->pstate & PSR_MODE_MASK)
#define irqs_priority_unmasked(regs) \
(system_uses_irq_prio_masking() ? \
(regs)->pmr == GIC_PRIO_IRQON : \
true)
static __always_inline bool regs_irqs_disabled(const struct pt_regs *regs)
{
return (regs->pstate & PSR_I_BIT) || !irqs_priority_unmasked(regs);
}
#define interrupts_enabled(regs) (!regs_irqs_disabled(regs))
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
{
if (compat_user_mode(regs))
return regs->compat_sp;
return regs->sp;
}
extern int regs_query_register_offset(const char *name);
extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
unsigned int n);
/**
* regs_get_register() - get register value from its offset
* @regs: pt_regs from which register value is gotten
* @offset: offset 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 u64 regs_get_register(struct pt_regs *regs, unsigned int offset)
{
u64 val = 0;
WARN_ON(offset & 7);
Annotation
- Immediate include surface: `asm/cpufeature.h`, `uapi/asm/ptrace.h`, `linux/irqchip/arm-gic-v3-prio.h`, `linux/bug.h`, `linux/types.h`, `asm/stacktrace/frame.h`.
- Detected declarations: `struct pt_regs`, `struct task_struct`, `function Copyright`, `function pstate_to_compat_psr`, `function in_syscall`, `function forget_syscall`, `function regs_irqs_disabled`, `function user_stack_pointer`, `function regs_get_register`, `function pt_regs_read_reg`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.