arch/arm64/kernel/signal32.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/signal32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/signal32.c- Extension
.c- Size
- 14956 bytes
- Lines
- 499
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compat.hlinux/signal.hlinux/syscalls.hlinux/ratelimit.hasm/esr.hasm/fpsimd.hasm/signal32.hasm/traps.hlinux/uaccess.hasm/unistd_compat_32.hasm/vdso.h
Detected Declarations
struct compat_vfp_sigframestruct compat_user_vfpstruct compat_user_vfp_excstruct compat_aux_sigframefunction put_sigset_tfunction get_sigset_tfunction compat_preserve_vfp_contextfunction compat_restore_vfp_contextfunction compat_restore_sigframefunction compat_setup_returnfunction compat_setup_sigframefunction compat_setup_rt_framefunction compat_setup_framefunction compat_setup_restart_syscall
Annotated Snippet
struct compat_vfp_sigframe {
compat_ulong_t magic;
compat_ulong_t size;
struct compat_user_vfp {
compat_u64 fpregs[32];
compat_ulong_t fpscr;
} ufp;
struct compat_user_vfp_exc {
compat_ulong_t fpexc;
compat_ulong_t fpinst;
compat_ulong_t fpinst2;
} ufp_exc;
} __attribute__((__aligned__(8)));
#define VFP_MAGIC 0x56465001
#define VFP_STORAGE_SIZE sizeof(struct compat_vfp_sigframe)
#define FSR_WRITE_SHIFT (11)
struct compat_aux_sigframe {
struct compat_vfp_sigframe vfp;
/* Something that isn't a valid magic number for any coprocessor. */
unsigned long end_magic;
} __attribute__((__aligned__(8)));
static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
{
compat_sigset_t cset;
cset.sig[0] = set->sig[0] & 0xffffffffull;
cset.sig[1] = set->sig[0] >> 32;
return copy_to_user(uset, &cset, sizeof(*uset));
}
static inline int get_sigset_t(sigset_t *set,
const compat_sigset_t __user *uset)
{
compat_sigset_t s32;
if (copy_from_user(&s32, uset, sizeof(*uset)))
return -EFAULT;
set->sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
return 0;
}
/*
* VFP save/restore code.
*
* We have to be careful with endianness, since the fpsimd context-switch
* code operates on 128-bit (Q) register values whereas the compat ABI
* uses an array of 64-bit (D) registers. Consequently, we need to swap
* the two halves of each Q register when running on a big-endian CPU.
*/
union __fpsimd_vreg {
__uint128_t raw;
struct {
#ifdef __AARCH64EB__
u64 hi;
u64 lo;
#else
u64 lo;
u64 hi;
#endif
};
};
static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
{
struct user_fpsimd_state const *fpsimd =
¤t->thread.uw.fpsimd_state;
compat_ulong_t magic = VFP_MAGIC;
compat_ulong_t size = VFP_STORAGE_SIZE;
compat_ulong_t fpscr, fpexc;
int i, err = 0;
/*
* Save the hardware registers to the fpsimd_state structure.
* Note that this also saves V16-31, which aren't visible
* in AArch32.
*/
fpsimd_save_and_flush_current_state();
/* Place structure header on the stack */
__put_user_error(magic, &frame->magic, err);
__put_user_error(size, &frame->size, err);
/*
Annotation
- Immediate include surface: `linux/compat.h`, `linux/signal.h`, `linux/syscalls.h`, `linux/ratelimit.h`, `asm/esr.h`, `asm/fpsimd.h`, `asm/signal32.h`, `asm/traps.h`.
- Detected declarations: `struct compat_vfp_sigframe`, `struct compat_user_vfp`, `struct compat_user_vfp_exc`, `struct compat_aux_sigframe`, `function put_sigset_t`, `function get_sigset_t`, `function compat_preserve_vfp_context`, `function compat_restore_vfp_context`, `function compat_restore_sigframe`, `function compat_setup_return`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.