arch/um/os-Linux/registers.c
Source file repositories/reference/linux-study-clean/arch/um/os-Linux/registers.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/os-Linux/registers.c- Extension
.c- Size
- 910 bytes
- Lines
- 44
- Domain
- Architecture Layer
- Bucket
- arch/um
- 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.
Dependency Surface
errno.hstring.hsys/ptrace.hsysdep/ptrace.hsysdep/ptrace_user.hregisters.hstdlib.h
Detected Declarations
function init_pid_registersfunction get_safe_registers
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2004 PathScale, Inc
* Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
*/
#include <errno.h>
#include <string.h>
#include <sys/ptrace.h>
#include <sysdep/ptrace.h>
#include <sysdep/ptrace_user.h>
#include <registers.h>
#include <stdlib.h>
/* This is set once at boot time and not changed thereafter */
unsigned long exec_regs[MAX_REG_NR];
unsigned long *exec_fp_regs;
int init_pid_registers(int pid)
{
int err;
err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
if (err < 0)
return -errno;
err = arch_init_registers(pid);
if (err < 0)
return err;
exec_fp_regs = malloc(host_fp_size);
get_fp_registers(pid, exec_fp_regs);
return 0;
}
void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
{
memcpy(regs, exec_regs, sizeof(exec_regs));
if (fp_regs)
memcpy(fp_regs, exec_fp_regs, host_fp_size);
}
Annotation
- Immediate include surface: `errno.h`, `string.h`, `sys/ptrace.h`, `sysdep/ptrace.h`, `sysdep/ptrace_user.h`, `registers.h`, `stdlib.h`.
- Detected declarations: `function init_pid_registers`, `function get_safe_registers`.
- Atlas domain: Architecture Layer / arch/um.
- 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.