1
0

flat.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * flat.h -- uClinux flat-format executables
  4. */
  5. #ifndef __M68KNOMMU_FLAT_H__
  6. #define __M68KNOMMU_FLAT_H__
  7. #include <linux/uaccess.h>
  8. #define flat_argvp_envp_on_stack() 1
  9. #define flat_old_ram_flag(flags) (flags)
  10. #define flat_reloc_valid(reloc, size) ((reloc) <= (size))
  11. static 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. static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
  21. {
  22. #ifdef CONFIG_CPU_HAS_NO_UNALIGNED
  23. return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
  24. #else
  25. return put_user(addr, rp);
  26. #endif
  27. }
  28. #define flat_get_relocate_addr(rel) (rel)
  29. static inline int flat_set_persistent(u32 relval, u32 *persistent)
  30. {
  31. return 0;
  32. }
  33. #define FLAT_PLAT_INIT(regs) \
  34. do { \
  35. if (current->mm) \
  36. (regs)->d5 = current->mm->start_data; \
  37. } while (0)
  38. #endif /* __M68KNOMMU_FLAT_H__ */