arch/sparc/include/asm/ptrace.h
Source file repositories/reference/linux-study-clean/arch/sparc/include/asm/ptrace.h
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/include/asm/ptrace.h- Extension
.h- Size
- 4240 bytes
- Lines
- 163
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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
uapi/asm/ptrace.hlinux/compiler.hlinux/threads.hasm/switch_to.h
Detected Declarations
struct global_reg_snapshotstruct global_pmu_snapshotfunction pt_regs_trap_typefunction pt_regs_is_syscallfunction pt_regs_clear_syscallfunction is_syscall_successfunction regs_return_valuefunction regs_get_registerfunction kernel_stack_pointerfunction pt_regs_is_syscallfunction pt_regs_clear_syscall
Annotated Snippet
struct global_reg_snapshot {
unsigned long tstate;
unsigned long tpc;
unsigned long tnpc;
unsigned long o7;
unsigned long i7;
unsigned long rpc;
struct thread_info *thread;
unsigned long pad1;
};
struct global_pmu_snapshot {
unsigned long pcr[4];
unsigned long pic[4];
};
union global_cpu_snapshot {
struct global_reg_snapshot reg;
struct global_pmu_snapshot pmu;
};
extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
#define force_successful_syscall_return() set_thread_noerror(1)
#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
#define instruction_pointer(regs) ((regs)->tpc)
#define instruction_pointer_set(regs, val) do { \
(regs)->tpc = (val); \
(regs)->tnpc = (val)+4; \
} while (0)
#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
static inline int is_syscall_success(struct pt_regs *regs)
{
return !(regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY));
}
static inline long regs_return_value(struct pt_regs *regs)
{
return regs->u_regs[UREG_I0];
}
#ifdef CONFIG_SMP
unsigned long profile_pc(struct pt_regs *);
#else
#define profile_pc(regs) instruction_pointer(regs)
#endif
#define MAX_REG_OFFSET (offsetof(struct pt_regs, magic))
int regs_query_register_offset(const char *name);
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 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 long offset)
{
if (unlikely(offset >= MAX_REG_OFFSET))
return 0;
if (offset == PT_V9_Y)
return *(unsigned int *)((unsigned long)regs + offset);
return *(unsigned long *)((unsigned long)regs + offset);
}
/* Valid only for Kernel mode traps. */
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
return regs->u_regs[UREG_I6];
}
#else /* __ASSEMBLER__ */
#endif /* __ASSEMBLER__ */
#else /* (defined(__sparc__) && defined(__arch64__)) */
#ifndef __ASSEMBLER__
#include <asm/switch_to.h>
static inline bool pt_regs_is_syscall(struct pt_regs *regs)
{
return (regs->psr & PSR_SYSCALL);
}
static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
{
return (regs->psr &= ~PSR_SYSCALL);
Annotation
- Immediate include surface: `uapi/asm/ptrace.h`, `linux/compiler.h`, `linux/threads.h`, `asm/switch_to.h`.
- Detected declarations: `struct global_reg_snapshot`, `struct global_pmu_snapshot`, `function pt_regs_trap_type`, `function pt_regs_is_syscall`, `function pt_regs_clear_syscall`, `function is_syscall_success`, `function regs_return_value`, `function regs_get_register`, `function kernel_stack_pointer`, `function pt_regs_is_syscall`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.