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.

Dependency Surface

Detected Declarations

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

Implementation Notes