arch/mips/include/asm/uaccess.h
Source file repositories/reference/linux-study-clean/arch/mips/include/asm/uaccess.h
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/include/asm/uaccess.h- Extension
.h- Size
- 14995 bytes
- Lines
- 564
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/kernel.hlinux/string.hasm/asm-eva.hasm/extable.hasm-generic/access_ok.h
Detected Declarations
struct __large_structfunction raw_copy_from_userfunction raw_copy_to_userfunction access_okfunction strncpy_from_userfunction strnlen_user
Annotated Snippet
struct __large_struct { unsigned long buf[100]; };
#define __m(x) (*(struct __large_struct __user *)(x))
#ifdef CONFIG_32BIT
#define __GET_DW(val, insn, ptr) __get_data_asm_ll32(val, insn, ptr)
#endif
#ifdef CONFIG_64BIT
#define __GET_DW(val, insn, ptr) __get_data_asm(val, insn, ptr)
#endif
#define __get_data_asm(val, insn, addr) \
{ \
long __gu_tmp; \
\
__asm__ __volatile__( \
"1: "insn("%1", "%3")" \n" \
"2: \n" \
" .insn \n" \
" .section .fixup,\"ax\" \n" \
"3: li %0, %4 \n" \
" move %1, $0 \n" \
" j 2b \n" \
" .previous \n" \
" .section __ex_table,\"a\" \n" \
" "__UA_ADDR "\t1b, 3b \n" \
" .previous \n" \
: "=r" (__gu_err), "=r" (__gu_tmp) \
: "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
\
(val) = (__typeof__(*(addr))) __gu_tmp; \
}
/*
* Get a long long 64 using 32 bit registers.
*/
#define __get_data_asm_ll32(val, insn, addr) \
{ \
union { \
unsigned long long l; \
__typeof__(*(addr)) t; \
} __gu_tmp; \
\
__asm__ __volatile__( \
"1: " insn("%1", "(%3)")" \n" \
"2: " insn("%D1", "4(%3)")" \n" \
"3: \n" \
" .insn \n" \
" .section .fixup,\"ax\" \n" \
"4: li %0, %4 \n" \
" move %1, $0 \n" \
" move %D1, $0 \n" \
" j 3b \n" \
" .previous \n" \
" .section __ex_table,\"a\" \n" \
" " __UA_ADDR " 1b, 4b \n" \
" " __UA_ADDR " 2b, 4b \n" \
" .previous \n" \
: "=r" (__gu_err), "=&r" (__gu_tmp.l) \
: "0" (0), "r" (addr), "i" (-EFAULT)); \
\
(val) = __gu_tmp.t; \
}
#define __get_kernel_nofault(dst, src, type, err_label) \
do { \
int __gu_err; \
\
switch (sizeof(type)) { \
case 1: \
__get_data_asm(*(type *)(dst), kernel_lb, \
(__force type *)(src)); \
break; \
case 2: \
__get_data_asm(*(type *)(dst), kernel_lh, \
(__force type *)(src)); \
break; \
case 4: \
__get_data_asm(*(type *)(dst), kernel_lw, \
(__force type *)(src)); \
break; \
case 8: \
__GET_DW(*(type *)(dst), kernel_ld, \
(__force type *)(src)); \
break; \
default: \
BUILD_BUG(); \
break; \
} \
if (unlikely(__gu_err)) \
goto err_label; \
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `asm/asm-eva.h`, `asm/extable.h`, `asm-generic/access_ok.h`.
- Detected declarations: `struct __large_struct`, `function raw_copy_from_user`, `function raw_copy_to_user`, `function access_ok`, `function strncpy_from_user`, `function strnlen_user`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.