xref: /kernel/linux/linux-6.6/include/asm-generic/flat.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-6.6/include/asm-generic/
162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_GENERIC_FLAT_H
362306a36Sopenharmony_ci#define _ASM_GENERIC_FLAT_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/uaccess.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_cistatic inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
862306a36Sopenharmony_ci		u32 *addr)
962306a36Sopenharmony_ci{
1062306a36Sopenharmony_ci#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
1162306a36Sopenharmony_ci	return copy_from_user(addr, rp, 4) ? -EFAULT : 0;
1262306a36Sopenharmony_ci#else
1362306a36Sopenharmony_ci	return get_user(*addr, rp);
1462306a36Sopenharmony_ci#endif
1562306a36Sopenharmony_ci}
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistatic inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
1862306a36Sopenharmony_ci{
1962306a36Sopenharmony_ci#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
2062306a36Sopenharmony_ci	return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
2162306a36Sopenharmony_ci#else
2262306a36Sopenharmony_ci	return put_user(addr, rp);
2362306a36Sopenharmony_ci#endif
2462306a36Sopenharmony_ci}
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#endif /* _ASM_GENERIC_FLAT_H */
27

Indexes created Thu Nov 07 10:32:03 CST 2024