flat.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * uClinux flat-format executables
  3. *
  4. * Copyright 2003-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2
  7. */
  8. #ifndef __BLACKFIN_FLAT_H__
  9. #define __BLACKFIN_FLAT_H__
  10. #include <asm/unaligned.h>
  11. #define flat_argvp_envp_on_stack() 0
  12. #define flat_old_ram_flag(flags) (flags)
  13. extern unsigned long bfin_get_addr_from_rp (unsigned long *ptr,
  14. unsigned long relval,
  15. unsigned long flags,
  16. unsigned long *persistent);
  17. extern void bfin_put_addr_at_rp(unsigned long *ptr, unsigned long addr,
  18. unsigned long relval);
  19. /* The amount by which a relocation can exceed the program image limits
  20. without being regarded as an error. */
  21. #define flat_reloc_valid(reloc, size) ((reloc) <= (size))
  22. #define flat_get_addr_from_rp(rp, relval, flags, persistent) \
  23. bfin_get_addr_from_rp(rp, relval, flags, persistent)
  24. #define flat_put_addr_at_rp(rp, val, relval) \
  25. bfin_put_addr_at_rp(rp, val, relval)
  26. /* Convert a relocation entry into an address. */
  27. static inline unsigned long
  28. flat_get_relocate_addr (unsigned long relval)
  29. {
  30. return relval & 0x03ffffff; /* Mask out top 6 bits */
  31. }
  32. static inline int flat_set_persistent(unsigned long relval,
  33. unsigned long *persistent)
  34. {
  35. int type = (relval >> 26) & 7;
  36. if (type == 3) {
  37. *persistent = relval << 16;
  38. return 1;
  39. }
  40. return 0;
  41. }
  42. static inline int flat_addr_absolute(unsigned long relval)
  43. {
  44. return (relval & (1 << 29)) != 0;
  45. }
  46. #endif /* __BLACKFIN_FLAT_H__ */