tools/testing/selftests/arm64/fp/fp-ptrace.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/arm64/fp/fp-ptrace.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/arm64/fp/fp-ptrace.c- Extension
.c- Size
- 40301 bytes
- Lines
- 1693
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hstdbool.hstddef.hstdio.hstdlib.hstring.hunistd.hsys/auxv.hsys/prctl.hsys/ptrace.hsys/types.hsys/uio.hsys/wait.hlinux/kernel.hasm/sigcontext.hasm/sve_context.hasm/ptrace.hkselftest.hfp-ptrace.hlinux/bits.h
Detected Declarations
struct test_configstruct test_definitionfunction handle_alarmfunction arm64_cpu_to_le128function arm64_cpu_to_le128function sve_supportedfunction sme_supportedfunction sme2_supportedfunction fa64_supportedfunction fpmr_supportedfunction compare_bufferfunction vl_infunction vl_expectedfunction run_childfunction read_one_child_regsfunction read_child_regsfunction continue_breakpointfunction check_ptrace_values_svefunction check_ptrace_values_ssvefunction check_ptrace_values_zafunction check_ptrace_values_ztfunction check_ptrace_values_fpmrfunction check_ptrace_valuesfunction run_parentfunction fill_randomfunction fill_random_ffrfunction fpsimd_to_svefunction set_initial_valuesfunction check_memory_valuesfunction sve_sme_samefunction sve_write_supportedfunction sve_write_fpsimd_supportedfunction fpsimd_write_expectedfunction fpsimd_writefunction fpmr_write_supportedfunction fpmr_write_expectedfunction fpmr_writefunction sve_write_expectedfunction sve_write_svefunction sve_write_fpsimdfunction za_write_supportedfunction za_write_expectedfunction za_writefunction zt_write_supportedfunction zt_write_expectedfunction zt_writefunction run_testfunction run_tests
Annotated Snippet
struct test_config {
int sve_vl_in;
int sve_vl_expected;
int sme_vl_in;
int sme_vl_expected;
int svcr_in;
int svcr_expected;
};
struct test_definition {
const char *name;
bool sve_vl_change;
bool (*supported)(struct test_config *config);
void (*set_expected_values)(struct test_config *config);
void (*modify_values)(pid_t child, struct test_config *test_config);
};
static int vl_in(struct test_config *config)
{
int vl;
if (config->svcr_in & SVCR_SM)
vl = config->sme_vl_in;
else
vl = config->sve_vl_in;
return vl;
}
static int vl_expected(struct test_config *config)
{
int vl;
if (config->svcr_expected & SVCR_SM)
vl = config->sme_vl_expected;
else
vl = config->sve_vl_expected;
return vl;
}
static void run_child(struct test_config *config)
{
int ret, flags;
/* Let the parent attach to us */
ret = ptrace(PTRACE_TRACEME, 0, 0, 0);
if (ret < 0)
ksft_exit_fail_msg("PTRACE_TRACEME failed: %s (%d)\n",
strerror(errno), errno);
/* VL setup */
if (sve_supported()) {
ret = prctl(PR_SVE_SET_VL, config->sve_vl_in);
if (ret != config->sve_vl_in) {
ksft_print_msg("Failed to set SVE VL %d: %d\n",
config->sve_vl_in, ret);
}
}
if (sme_supported()) {
ret = prctl(PR_SME_SET_VL, config->sme_vl_in);
if (ret != config->sme_vl_in) {
ksft_print_msg("Failed to set SME VL %d: %d\n",
config->sme_vl_in, ret);
}
}
/* Load values and wait for the parent */
flags = 0;
if (sve_supported())
flags |= HAVE_SVE;
if (sme_supported())
flags |= HAVE_SME;
if (sme2_supported())
flags |= HAVE_SME2;
if (fa64_supported())
flags |= HAVE_FA64;
if (fpmr_supported())
flags |= HAVE_FPMR;
load_and_save(flags);
exit(0);
}
static void read_one_child_regs(pid_t child, char *name,
struct iovec *iov_parent,
struct iovec *iov_child)
{
Annotation
- Immediate include surface: `errno.h`, `stdbool.h`, `stddef.h`, `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`, `sys/auxv.h`.
- Detected declarations: `struct test_config`, `struct test_definition`, `function handle_alarm`, `function arm64_cpu_to_le128`, `function arm64_cpu_to_le128`, `function sve_supported`, `function sme_supported`, `function sme2_supported`, `function fa64_supported`, `function fpmr_supported`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.