ARM: Move __secure definition to common asm/secure.h
[oweals/u-boot.git] / arch / arm / include / asm / secure.h
1 #ifndef __ASM_SECURE_H
2 #define __ASM_SECURE_H
3
4 #include <config.h>
5
6 #define __secure __attribute__ ((section ("._secure.text")))
7
8 #ifdef CONFIG_ARMV7_SECURE_BASE
9 /*
10  * Warning, horror ahead.
11  *
12  * The target code lives in our "secure ram", but u-boot doesn't know
13  * that, and has blindly added reloc_off to every relocation
14  * entry. Gahh. Do the opposite conversion. This hack also prevents
15  * GCC from generating code veeners, which u-boot doesn't relocate at
16  * all...
17  */
18 #define secure_ram_addr(_fn) ({                                         \
19                         DECLARE_GLOBAL_DATA_PTR;                        \
20                         void *__fn = _fn;                               \
21                         typeof(_fn) *__tmp = (__fn - gd->reloc_off);    \
22                         __tmp;                                          \
23                 })
24 #else
25 #define secure_ram_addr(_fn)    (_fn)
26 #endif
27
28 #endif