Fixed the usage of CHECK_USER_ADDRESS(). R5 has the inverse memory layout, so we need to adjust the KERNEL_BASE macro when compiling for it.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4853 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,13 +5,19 @@
|
|||||||
|
|
||||||
#include <vm.h>
|
#include <vm.h>
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
// copy_ref_var_from_user
|
// copy_ref_var_from_user
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline
|
inline
|
||||||
status_t
|
status_t
|
||||||
copy_ref_var_from_user(T *user, T &kernel)
|
copy_ref_var_from_user(T *user, T &kernel)
|
||||||
{
|
{
|
||||||
if (CHECK_USER_ADDRESS(user))
|
if (!CHECK_USER_ADDRESS(user))
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
return user_memcpy(&kernel, user, sizeof(T));
|
return user_memcpy(&kernel, user, sizeof(T));
|
||||||
}
|
}
|
||||||
@@ -22,7 +28,7 @@ inline
|
|||||||
status_t
|
status_t
|
||||||
copy_ref_var_to_user(T &kernel, T *user)
|
copy_ref_var_to_user(T &kernel, T *user)
|
||||||
{
|
{
|
||||||
if (CHECK_USER_ADDRESS(user))
|
if (!CHECK_USER_ADDRESS(user))
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
return user_memcpy(user, &kernel, sizeof(T));
|
return user_memcpy(user, &kernel, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user