Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-blackfin/flat.h -- uClinux flat-format executables |
| 3 | * |
| 4 | * Copyright (C) 2003, |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __BLACKFIN_FLAT_H__ |
| 9 | #define __BLACKFIN_FLAT_H__ |
| 10 | |
| 11 | #include <asm/unaligned.h> |
| 12 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 13 | #define flat_argvp_envp_on_stack() 0 |
| 14 | #define flat_old_ram_flag(flags) (flags) |
| 15 | |
| 16 | extern unsigned long bfin_get_addr_from_rp (unsigned long *ptr, |
| 17 | unsigned long relval, |
| 18 | unsigned long flags, |
| 19 | unsigned long *persistent); |
| 20 | |
| 21 | extern void bfin_put_addr_at_rp(unsigned long *ptr, unsigned long addr, |
| 22 | unsigned long relval); |
| 23 | |
| 24 | /* The amount by which a relocation can exceed the program image limits |
| 25 | without being regarded as an error. */ |
| 26 | |
| 27 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) |
| 28 | |
| 29 | #define flat_get_addr_from_rp(rp, relval, flags, persistent) \ |
| 30 | bfin_get_addr_from_rp(rp, relval, flags, persistent) |
| 31 | #define flat_put_addr_at_rp(rp, val, relval) \ |
| 32 | bfin_put_addr_at_rp(rp, val, relval) |
| 33 | |
| 34 | /* Convert a relocation entry into an address. */ |
| 35 | static inline unsigned long |
| 36 | flat_get_relocate_addr (unsigned long relval) |
| 37 | { |
| 38 | return relval & 0x03ffffff; /* Mask out top 6 bits */ |
| 39 | } |
| 40 | |
| 41 | static inline int flat_set_persistent(unsigned long relval, |
| 42 | unsigned long *persistent) |
| 43 | { |
| 44 | int type = (relval >> 26) & 7; |
| 45 | if (type == 3) { |
| 46 | *persistent = relval << 16; |
| 47 | return 1; |
| 48 | } |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | static inline int flat_addr_absolute(unsigned long relval) |
| 53 | { |
| 54 | return (relval & (1 << 29)) != 0; |
| 55 | } |
| 56 | |
| 57 | #endif /* __BLACKFIN_FLAT_H__ */ |