flat.h (bdd15a288492f2f496a904c69c4b332057ae2ef6) flat.h (7a8998c9d830b59626e049a827678ba444fcf8e2)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * flat.h -- uClinux flat-format executables
4 */
5
6#ifndef __M68KNOMMU_FLAT_H__
7#define __M68KNOMMU_FLAT_H__
8
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * flat.h -- uClinux flat-format executables
4 */
5
6#ifndef __M68KNOMMU_FLAT_H__
7#define __M68KNOMMU_FLAT_H__
8
9#include <linux/uaccess.h>
9#include <asm-generic/flat.h>
10
10
11static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
12 u32 *addr, u32 *persistent)
13{
14#ifdef CONFIG_CPU_HAS_NO_UNALIGNED
15 return copy_from_user(addr, rp, 4) ? -EFAULT : 0;
16#else
17 return get_user(*addr, rp);
18#endif
19}
20
21static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
22{
23#ifdef CONFIG_CPU_HAS_NO_UNALIGNED
24 return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
25#else
26 return put_user(addr, rp);
27#endif
28}
29
30#define FLAT_PLAT_INIT(regs) \
31 do { \
32 if (current->mm) \
33 (regs)->d5 = current->mm->start_data; \
34 } while (0)
35
36#endif /* __M68KNOMMU_FLAT_H__ */
11#define FLAT_PLAT_INIT(regs) \
12 do { \
13 if (current->mm) \
14 (regs)->d5 = current->mm->start_data; \
15 } while (0)
16
17#endif /* __M68KNOMMU_FLAT_H__ */