tools/testing/selftests/arm64/abi/hwcap.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/arm64/abi/hwcap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/arm64/abi/hwcap.c- Extension
.c- Size
- 29691 bytes
- Lines
- 1462
- 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
errno.hsignal.hstdbool.hstddef.hstdio.hstdlib.hstring.hunistd.hlinux/auxvec.hlinux/compiler.hsys/auxv.hsys/prctl.hasm/hwcap.hasm/sigcontext.hasm/unistd.hkselftest.h
Detected Declarations
function aes_sigillfunction atomics_sigillfunction cmpbr_sigillfunction crc32_sigillfunction cssc_sigillfunction f8cvt_sigillfunction f8dp2_sigillfunction f8dp4_sigillfunction f8fma_sigillfunction f8mm4_sigillfunction f8mm8_sigillfunction f16f32dot_sigillfunction f16f32mm_sigillfunction f16mm_sigillfunction faminmax_sigillfunction fp_sigillfunction fpmr_sigillfunction fprcvt_sigillfunction gcs_sigillfunction ilrcpc_sigillfunction jscvt_sigillfunction lrcpc_sigillfunction lse128_sigillfunction lsfe_sigillfunction lut_sigillfunction sve_lut6_sigillfunction mops_sigillfunction pmull_sigillfunction poe_sigillfunction rng_sigillfunction sha1_sigillfunction sha2_sigillfunction sha512_sigillfunction sme_sigillfunction sme2_sigillfunction sme2p1_sigillfunction sme2p2_sigillfunction sme2p3_sigillfunction sme_aes_sigillfunction sme_sbitperm_sigillfunction smei16i32_sigillfunction smebi32i32_sigillfunction smeb16b16_sigillfunction smef16f16_sigillfunction smef8f16_sigillfunction smef8f32_sigillfunction smelut6_sigillfunction smelutv2_sigill
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2022 ARM Limited.
*/
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <linux/auxvec.h>
#include <linux/compiler.h>
#include <sys/auxv.h>
#include <sys/prctl.h>
#include <asm/hwcap.h>
#include <asm/sigcontext.h>
#include <asm/unistd.h>
#include <linux/auxvec.h>
#include "kselftest.h"
#define TESTS_PER_HWCAP 3
#ifndef AT_HWCAP3
#define AT_HWCAP3 29
#endif
/*
* Function expected to generate exception when the feature is not
* supported and return when it is supported. If the specific exception
* is generated then the handler must be able to skip over the
* instruction safely.
*
* Note that it is expected that for many architecture extensions
* there are no specific traps due to no architecture state being
* added so we may not fault if running on a kernel which doesn't know
* to add the hwcap.
*/
typedef void (*sig_fn)(void);
static void aes_sigill(void)
{
/* AESE V0.16B, V0.16B */
asm volatile(".inst 0x4e284800" : : : );
}
static void atomics_sigill(void)
{
/* STADD W0, [SP] */
asm volatile(".inst 0xb82003ff" : : : );
}
static void cmpbr_sigill(void)
{
asm volatile(".inst 0x74C00040\n" /* CBEQ w0, w0, +8 */
"udf #0" : : : "cc"); /* UDF #0 */
}
static void crc32_sigill(void)
{
/* CRC32W W0, W0, W1 */
asm volatile(".inst 0x1ac14800" : : : );
}
static void cssc_sigill(void)
{
/* CNT x0, x0 */
asm volatile(".inst 0xdac01c00" : : : "x0");
}
static void f8cvt_sigill(void)
{
/* FSCALE V0.4H, V0.4H, V0.4H */
asm volatile(".inst 0x2ec03c00");
}
static void f8dp2_sigill(void)
{
/* FDOT V0.4H, V0.4H, V0.5H */
asm volatile(".inst 0xe40fc00");
}
static void f8dp4_sigill(void)
{
/* FDOT V0.2S, V0.2S, V0.2S */
asm volatile(".inst 0xe00fc00");
Annotation
- Immediate include surface: `errno.h`, `signal.h`, `stdbool.h`, `stddef.h`, `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`.
- Detected declarations: `function aes_sigill`, `function atomics_sigill`, `function cmpbr_sigill`, `function crc32_sigill`, `function cssc_sigill`, `function f8cvt_sigill`, `function f8dp2_sigill`, `function f8dp4_sigill`, `function f8fma_sigill`, `function f8mm4_sigill`.
- 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.