Add basic support for mini2440 board to barebox.
[barebox-mini2440.git] / include / reloc.h
bloba5ad7575b15f153e6ef241c487645fa22ab64d86
1 #ifndef __RELOC_H
2 #define __RELOC_H
4 extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base;
6 #ifdef CONFIG_HAS_EARLY_INIT
8 extern ulong __early_init_data_begin, __early_init_data_end;
11 * The difference between our link address and the address we're
12 * currently running at.
14 unsigned long reloc_offset(void);
17 * When not running at link address, relocate a pointer by
18 * taking reloc_offset() into account
20 #define RELOC(a) (typeof(*a) *)((unsigned long)a + reloc_offset())
23 * dito, used for variables
25 #define RELOC_VAR(v) *(typeof(v)* )((unsigned long)&v + reloc_offset())
27 void early_init(void);
30 * put a variable into early init RAM. This section will
31 * be relocated into SRAM during early init
33 #define __initdata __attribute__ ((__section__ (".early_init_data")))
35 /* Access init data */
36 #define INITDATA(var) *(typeof(var) *)((ulong)(&var) - \
37 (ulong)&__early_init_data_begin + \
38 (ulong)RELOC_VAR(init_data_ptr))
40 extern void *init_data_ptr;
42 #else
44 static inline int reloc_offset(void)
46 return 0;
49 static inline void early_init(void)
53 #define RELOC(a) a
54 #define RELOC_VAR(v) v
56 #define __initdata
58 #define INITDATA(var) var
60 #endif /* CONFIG_HAS_EARLY_INIT */
62 #endif /* __RELOC_H */