tools/testing/selftests/powerpc/ptrace/ptrace.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/ptrace/ptrace.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/ptrace/ptrace.h- Extension
.h- Size
- 15688 bytes
- Lines
- 810
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
inttypes.hunistd.hstdlib.hstring.hmalloc.herrno.htime.hsys/ptrace.hsys/ioctl.hsys/uio.hsys/types.hsys/wait.hsys/signal.hsys/ipc.hsys/shm.hsys/user.hsys/syscall.hlinux/elf.hlinux/types.hlinux/auxvec.hreg.hutils.h
Detected Declarations
struct fpr_regsstruct tm_spr_regsfunction start_tracefunction stop_tracefunction cont_tracefunction ptrace_read_regsfunction ptrace_write_regsfunction show_tar_registersfunction write_tar_registersfunction show_tm_checkpointed_statefunction write_ckpt_tar_registersfunction show_fprfunction write_fprfunction show_ckpt_fprfunction write_ckpt_fprfunction show_gprfunction sys_ptracefunction poke_fprsfunction write_gprfunction show_ckpt_gprfunction write_ckpt_gprfunction show_vmxfunction show_vmx_ckptfunction write_vmxfunction write_vmx_ckptfunction show_vsxfunction show_vsx_ckptfunction write_vsxfunction write_vsx_ckptfunction show_tm_sprfunction get_tfiarfunction analyse_texasr
Annotated Snippet
struct fpr_regs {
__u64 fpr[32];
__u64 fpscr;
};
struct tm_spr_regs {
unsigned long tm_tfhar;
unsigned long tm_texasr;
unsigned long tm_tfiar;
};
#ifndef NT_PPC_TAR
#define NT_PPC_TAR 0x103
#define NT_PPC_PPR 0x104
#define NT_PPC_DSCR 0x105
#define NT_PPC_EBB 0x106
#define NT_PPC_PMU 0x107
#define NT_PPC_TM_CGPR 0x108
#define NT_PPC_TM_CFPR 0x109
#define NT_PPC_TM_CVMX 0x10a
#define NT_PPC_TM_CVSX 0x10b
#define NT_PPC_TM_SPR 0x10c
#define NT_PPC_TM_CTAR 0x10d
#define NT_PPC_TM_CPPR 0x10e
#define NT_PPC_TM_CDSCR 0x10f
#endif
/* Basic ptrace operations */
int start_trace(pid_t child)
{
int ret;
ret = ptrace(PTRACE_ATTACH, child, NULL, NULL);
if (ret) {
perror("ptrace(PTRACE_ATTACH) failed");
return TEST_FAIL;
}
ret = waitpid(child, NULL, 0);
if (ret != child) {
perror("waitpid() failed");
return TEST_FAIL;
}
return TEST_PASS;
}
int stop_trace(pid_t child)
{
int ret;
ret = ptrace(PTRACE_DETACH, child, NULL, NULL);
if (ret) {
perror("ptrace(PTRACE_DETACH) failed");
return TEST_FAIL;
}
return TEST_PASS;
}
int cont_trace(pid_t child)
{
int ret;
ret = ptrace(PTRACE_CONT, child, NULL, NULL);
if (ret) {
perror("ptrace(PTRACE_CONT) failed");
return TEST_FAIL;
}
return TEST_PASS;
}
int ptrace_read_regs(pid_t child, unsigned long type, unsigned long regs[],
int n)
{
struct iovec iov;
long ret;
FAIL_IF(start_trace(child));
iov.iov_base = regs;
iov.iov_len = n * sizeof(unsigned long);
ret = ptrace(PTRACE_GETREGSET, child, type, &iov);
if (ret)
return ret;
FAIL_IF(stop_trace(child));
return TEST_PASS;
}
long ptrace_write_regs(pid_t child, unsigned long type, unsigned long regs[],
Annotation
- Immediate include surface: `inttypes.h`, `unistd.h`, `stdlib.h`, `string.h`, `malloc.h`, `errno.h`, `time.h`, `sys/ptrace.h`.
- Detected declarations: `struct fpr_regs`, `struct tm_spr_regs`, `function start_trace`, `function stop_trace`, `function cont_trace`, `function ptrace_read_regs`, `function ptrace_write_regs`, `function show_tar_registers`, `function write_tar_registers`, `function show_tm_checkpointed_state`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.