1. access_ OK
Static inline int access_ OK (INT type, const void * ADDR, unsigned Long SIZE ){
Extern unsigned long memory_start, memory_end; unsigned long Val = (unsigned long) ADDR; Return (Val> = memory_start) & (Val + size) memory_end ));} its function is to check whether the user space is valid. Its first parameter: type, which has two types: verify_read and verify_write. The former is readable and the latter can be written. Note: if the flag is writeable (verify_write), it must be readable! Because the writable superset is readable (% verify_write is a superset of % verify_read ).
The check process is as follows: ADDR is the starting address and size is the size to be copied. From ADDR to ADDR + size is the space to be checked, if its range is between memory_start and memory_end.
2. _ copy_to_user () Static inline _ kernel_size_t _ copy_to_user (void _ User * To, const void * From, __kernel_size_t N) {return _ copy_user (void _ force *) to, from, n) ;}haha, another function __copy_user (), this function is actually doing underlying replication. Http://lxr.linux.no/linux/arch/cris/arch-v10/lib/usercopy.c#L34 to continue in-depth