2003-09-28 19:12:27 +04:00
|
|
|
// syscall_args.h
|
|
|
|
|
|
|
|
#ifndef _SYSCALL_ARGS_H
|
|
|
|
#define _SYSCALL_ARGS_H
|
|
|
|
|
|
|
|
#include <vm.h>
|
|
|
|
|
2003-09-29 22:50:02 +04:00
|
|
|
// Hack to be able to use the CHECK_USER_ADDRESS macro when compiling for R5.
|
|
|
|
#ifdef R5_MEMORY_LAYOUT
|
|
|
|
# undef KERNEL_BASE
|
|
|
|
# define KERNEL_BASE 0x0
|
|
|
|
#endif
|
|
|
|
|
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)
|
|
|
|
{
|
2003-09-29 22:50:02 +04:00
|
|
|
if (!CHECK_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)
|
|
|
|
{
|
2003-09-29 22:50:02 +04:00
|
|
|
if (!CHECK_USER_ADDRESS(user))
|
2003-09-28 19:12:27 +04:00
|
|
|
return B_BAD_ADDRESS;
|
|
|
|
return user_memcpy(user, &kernel, sizeof(T));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _SYSCALL_ARGS_H
|