Marc Zyngier | f510aea | 2014-07-12 14:24:03 +0100 | [diff] [blame^] | 1 | #ifndef __ASM_SECURE_H |
| 2 | #define __ASM_SECURE_H |
| 3 | |
| 4 | #include <config.h> |
| 5 | |
| 6 | #ifdef CONFIG_ARMV7_SECURE_BASE |
| 7 | /* |
| 8 | * Warning, horror ahead. |
| 9 | * |
| 10 | * The target code lives in our "secure ram", but u-boot doesn't know |
| 11 | * that, and has blindly added reloc_off to every relocation |
| 12 | * entry. Gahh. Do the opposite conversion. This hack also prevents |
| 13 | * GCC from generating code veeners, which u-boot doesn't relocate at |
| 14 | * all... |
| 15 | */ |
| 16 | #define secure_ram_addr(_fn) ({ \ |
| 17 | DECLARE_GLOBAL_DATA_PTR; \ |
| 18 | void *__fn = _fn; \ |
| 19 | typeof(_fn) *__tmp = (__fn - gd->reloc_off); \ |
| 20 | __tmp; \ |
| 21 | }) |
| 22 | #else |
| 23 | #define secure_ram_addr(_fn) (_fn) |
| 24 | #endif |
| 25 | |
| 26 | #endif |