12 #ifndef __ASM_M32R_FLAT_H
13 #define __ASM_M32R_FLAT_H
15 #define flat_argvp_envp_on_stack() 0
16 #define flat_old_ram_flag(flags) (flags)
17 #define flat_set_persistent(relval, p) 0
18 #define flat_reloc_valid(reloc, size) \
19 (((reloc) - textlen_for_m32r_lo16_data) <= (size))
20 #define flat_get_addr_from_rp(rp, relval, flags, persistent) \
21 m32r_flat_get_addr_from_rp(rp, relval, (text_len) )
23 #define flat_put_addr_at_rp(rp, addr, relval) \
24 m32r_flat_put_addr_at_rp(rp, addr, relval)
27 static inline unsigned long
30 return relval & 0x00ffffff;
33 #define flat_m32r_get_reloc_type(relval) ((relval) >> 24)
35 #define M32R_SETH_OPCODE 0xd0c00000
37 #define FLAT_M32R_32 0x00
38 #define FLAT_M32R_24 0x01
39 #define FLAT_M32R_16 0x02
40 #define FLAT_M32R_LO16 0x03
41 #define FLAT_M32R_LO16_DATA 0x04
49 #define FLAT_M32R_HI16_ULO 0x10
56 #define FLAT_M32R_HI16_SLO 0x20
58 static unsigned long textlen_for_m32r_lo16_data = 0;
60 static inline unsigned long m32r_flat_get_addr_from_rp (
unsigned long *
rp,
62 unsigned long textlen)
65 textlen_for_m32r_lo16_data = 0;
84 return htonl(*rp) & 0xFFFF;
88 textlen_for_m32r_lo16_data = textlen;
89 return (
htonl(*rp) & 0xFFFF) + textlen;
91 return htons(*(
unsigned short *)rp) & 0xFFFF;
93 return htonl(*rp) & 0xFFFFFF;
103 static inline void m32r_flat_put_addr_at_rp (
unsigned long *
rp,
105 unsigned long relval)
109 unsigned long Rn = reloc & 0x0f;
116 | ((addr >> 16) & 0xFFFF));
120 | (((addr >> 16) + ((addr & 0x8000) ? 1 : 0))
127 addr -= textlen_for_m32r_lo16_data;
128 textlen_for_m32r_lo16_data = 0;
130 *rp = (
htonl(*rp) & 0xFFFF0000) | (addr & 0xFFFF);
133 *(
unsigned short *)rp = addr & 0xFFFF;
136 *rp = (
htonl(*rp) & 0xFF000000) | (addr & 0xFFFFFF);