1 // syscall_args.h 2 3 #ifndef _SYSCALL_ARGS_H 4 #define _SYSCALL_ARGS_H 5 6 #include <kernel.h> 7 8 9 // copy_ref_var_from_user 10 template<typename T> 11 inline 12 status_t 13 copy_ref_var_from_user(T *user, T &kernel) 14 { 15 if (!IS_USER_ADDRESS(user)) 16 return B_BAD_ADDRESS; 17 return user_memcpy(&kernel, user, sizeof(T)); 18 } 19 20 // copy_ref_var_to_user 21 template<typename T> 22 inline 23 status_t 24 copy_ref_var_to_user(T &kernel, T *user) 25 { 26 if (!IS_USER_ADDRESS(user)) 27 return B_BAD_ADDRESS; 28 return user_memcpy(user, &kernel, sizeof(T)); 29 } 30 31 32 #endif // _SYSCALL_ARGS_H 33