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