arch/sparc/lib/copy_user.S
Source file repositories/reference/linux-study-clean/arch/sparc/lib/copy_user.S
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/lib/copy_user.S- Extension
.S- Size
- 9609 bytes
- Lines
- 395
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
Dependency Surface
linux/export.hasm/ptrace.hasm/asmmacro.hasm/page.hasm/thread_info.h
Detected Declarations
export __copy_user
Annotated Snippet
#include <linux/export.h>
#include <asm/ptrace.h>
#include <asm/asmmacro.h>
#include <asm/page.h>
#include <asm/thread_info.h>
/* Work around cpp -rob */
#define ALLOC #alloc
#define EXECINSTR #execinstr
#define EX_ENTRY(l1, l2) \
.section __ex_table,ALLOC; \
.align 4; \
.word l1, l2; \
.text;
#define EX(x,y,a,b) \
98: x,y; \
.section .fixup,ALLOC,EXECINSTR; \
.align 4; \
99: retl; \
a, b, %o0; \
EX_ENTRY(98b, 99b)
#define EX2(x,y,c,d,e,a,b) \
98: x,y; \
.section .fixup,ALLOC,EXECINSTR; \
.align 4; \
99: c, d, e; \
retl; \
a, b, %o0; \
EX_ENTRY(98b, 99b)
#define EXO2(x,y) \
98: x, y; \
EX_ENTRY(98b, 97f)
#define LD(insn, src, offset, reg, label) \
98: insn [%src + (offset)], %reg; \
.section .fixup,ALLOC,EXECINSTR; \
99: ba label; \
mov offset, %g5; \
EX_ENTRY(98b, 99b)
#define ST(insn, dst, offset, reg, label) \
98: insn %reg, [%dst + (offset)]; \
.section .fixup,ALLOC,EXECINSTR; \
99: ba label; \
mov offset, %g5; \
EX_ENTRY(98b, 99b)
/* Both these macros have to start with exactly the same insn */
/* left: g7 + (g1 % 128) - offset */
#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
LD(ldd, src, offset + 0x00, t0, bigchunk_fault) \
LD(ldd, src, offset + 0x08, t2, bigchunk_fault) \
LD(ldd, src, offset + 0x10, t4, bigchunk_fault) \
LD(ldd, src, offset + 0x18, t6, bigchunk_fault) \
ST(st, dst, offset + 0x00, t0, bigchunk_fault) \
ST(st, dst, offset + 0x04, t1, bigchunk_fault) \
ST(st, dst, offset + 0x08, t2, bigchunk_fault) \
ST(st, dst, offset + 0x0c, t3, bigchunk_fault) \
ST(st, dst, offset + 0x10, t4, bigchunk_fault) \
ST(st, dst, offset + 0x14, t5, bigchunk_fault) \
ST(st, dst, offset + 0x18, t6, bigchunk_fault) \
ST(st, dst, offset + 0x1c, t7, bigchunk_fault)
/* left: g7 + (g1 % 128) - offset */
#define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
LD(ldd, src, offset + 0x00, t0, bigchunk_fault) \
Annotation
- Immediate include surface: `linux/export.h`, `asm/ptrace.h`, `asm/asmmacro.h`, `asm/page.h`, `asm/thread_info.h`.
- Detected declarations: `export __copy_user`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration 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.