flat.h 1005 B

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