2003-09-28 19:12:27 +04:00
|
|
|
// syscall_args.h
|
|
|
|
|
|
|
|
#ifndef _SYSCALL_ARGS_H
|
|
|
|
#define _SYSCALL_ARGS_H
|
|
|
|
|
2007-09-27 16:21:33 +04:00
|
|
|
#include <kernel.h>
|
2009-12-02 21:05:10 +03:00
|
|
|
|
2003-09-28 19:12:27 +04:00
|
|
|
|
|
|
|
// copy_ref_var_from_user
|
|
|
|
template<typename T>
|
|
|
|
inline
|
|
|
|
status_t
|
|
|
|
copy_ref_var_from_user(T *user, T &kernel)
|
|
|
|
{
|
2004-02-23 05:18:32 +03:00
|
|
|
if (!IS_USER_ADDRESS(user))
|
2003-09-28 19:12:27 +04:00
|
|
|
return B_BAD_ADDRESS;
|
|
|
|
return user_memcpy(&kernel, user, sizeof(T));
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy_ref_var_to_user
|
|
|
|
template<typename T>
|
|
|
|
inline
|
|
|
|
status_t
|
|
|
|
copy_ref_var_to_user(T &kernel, T *user)
|
|
|
|
{
|
2004-02-23 05:18:32 +03:00
|
|
|
if (!IS_USER_ADDRESS(user))
|
2003-09-28 19:12:27 +04:00
|
|
|
return B_BAD_ADDRESS;
|
|
|
|
return user_memcpy(user, &kernel, sizeof(T));
|
|
|
|
}
|
|
|
|
|
2009-12-02 21:05:10 +03:00
|
|
|
|
2003-09-28 19:12:27 +04:00
|
|
|
#endif // _SYSCALL_ARGS_H
|