blob: 29d3a1524bce818a287e32b754b8ba9e7ac427eb [file] [log] [blame]
Greg Ungereracc46c02006-09-14 00:28:26 +10001/*
Russell King4baa9922008-08-02 10:55:55 +01002 * arch/arm/include/asm/flat.h -- uClinux flat-format executables
Greg Ungereracc46c02006-09-14 00:28:26 +10003 */
4
5#ifndef __ARM_FLAT_H__
6#define __ARM_FLAT_H__
7
Al Viro468138d2017-05-02 19:52:17 -04008#include <linux/uaccess.h>
9
Greg Ungereracc46c02006-09-14 00:28:26 +100010#define flat_argvp_envp_on_stack() 1
11#define flat_old_ram_flag(flags) (flags)
12#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
Al Viro468138d2017-05-02 19:52:17 -040013
14static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
15 u32 *addr, u32 *persistent)
16{
17#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
18 return copy_from_user(addr, rp, 4) ? -EFAULT : 0;
19#else
20 return get_user(*addr, rp);
21#endif
22}
23
24static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
25{
26#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
27 return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
28#else
29 return put_user(addr, rp);
30#endif
31}
32
Greg Ungereracc46c02006-09-14 00:28:26 +100033#define flat_get_relocate_addr(rel) (rel)
Russell Kingfd3d7282007-10-27 21:48:43 +010034#define flat_set_persistent(relval, p) 0
Greg Ungereracc46c02006-09-14 00:28:26 +100035
36#endif /* __ARM_FLAT_H__ */