arch/riscv/include/asm/uaccess.h
Source file repositories/reference/linux-study-clean/arch/riscv/include/asm/uaccess.h
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/include/asm/uaccess.h- Extension
.h- Size
- 14717 bytes
- Lines
- 494
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- 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
asm/asm-extable.hasm/cpufeature.hasm/pgtable.hlinux/errno.hlinux/compiler.hlinux/thread_info.hasm/byteorder.hasm/extable.hasm/asm.hasm-generic/access_ok.hasm-generic/uaccess.h
Detected Declarations
function Copyrightfunction raw_copy_from_userfunction raw_copy_to_userfunction clear_userfunction user_access_beginfunction user_access_savefunction user_access_restore
Annotated Snippet
static inline unsigned long user_access_save(void) { return 0UL; }
static inline void user_access_restore(unsigned long enabled) { }
/*
* We want the unsafe accessors to always be inlined and use
* the error labels - thus the macro games.
*/
#define arch_unsafe_put_user(x, ptr, label) \
__put_user_nocheck(x, (ptr), label)
#define arch_unsafe_get_user(x, ptr, label) do { \
__inttype(*(ptr)) __gu_val; \
__get_user_nocheck(__gu_val, (ptr), label); \
(x) = (__force __typeof__(*(ptr)))__gu_val; \
} while (0)
#define unsafe_copy_to_user(_dst, _src, _len, label) \
if (__asm_copy_to_user_sum_enabled(_dst, _src, _len)) \
goto label;
#define unsafe_copy_from_user(_dst, _src, _len, label) \
if (__asm_copy_from_user_sum_enabled(_dst, _src, _len)) \
goto label;
#else /* CONFIG_MMU */
#include <asm-generic/uaccess.h>
#endif /* CONFIG_MMU */
#endif /* _ASM_RISCV_UACCESS_H */
Annotation
- Immediate include surface: `asm/asm-extable.h`, `asm/cpufeature.h`, `asm/pgtable.h`, `linux/errno.h`, `linux/compiler.h`, `linux/thread_info.h`, `asm/byteorder.h`, `asm/extable.h`.
- Detected declarations: `function Copyright`, `function raw_copy_from_user`, `function raw_copy_to_user`, `function clear_user`, `function user_access_begin`, `function user_access_save`, `function user_access_restore`.
- Atlas domain: Architecture Layer / arch/riscv.
- 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.