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