diff --git a/headers/private/kernel/util/syscall_args.h b/headers/private/kernel/util/syscall_args.h index f988b8b172..aae8001f7d 100644 --- a/headers/private/kernel/util/syscall_args.h +++ b/headers/private/kernel/util/syscall_args.h @@ -5,13 +5,19 @@ #include +// 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 template inline status_t copy_ref_var_from_user(T *user, T &kernel) { - if (CHECK_USER_ADDRESS(user)) + if (!CHECK_USER_ADDRESS(user)) return B_BAD_ADDRESS; return user_memcpy(&kernel, user, sizeof(T)); } @@ -22,7 +28,7 @@ inline status_t copy_ref_var_to_user(T &kernel, T *user) { - if (CHECK_USER_ADDRESS(user)) + if (!CHECK_USER_ADDRESS(user)) return B_BAD_ADDRESS; return user_memcpy(user, &kernel, sizeof(T)); }