1f510aeaeSMarc Zyngier #ifndef __ASM_SECURE_H 2f510aeaeSMarc Zyngier #define __ASM_SECURE_H 3f510aeaeSMarc Zyngier 4f510aeaeSMarc Zyngier #include <config.h> 5f510aeaeSMarc Zyngier 6afc1f65fSChen-Yu Tsai #define __secure __attribute__ ((section ("._secure.text"))) 7a5aa7ff3SChen-Yu Tsai #define __secure_data __attribute__ ((section ("._secure.data"))) 8afc1f65fSChen-Yu Tsai 9*9a561753Smacro.wave.z@gmail.com #if defined(CONFIG_ARMV7_SECURE_BASE) || defined(CONFIG_ARMV8_SECURE_BASE) 10f510aeaeSMarc Zyngier /* 11f510aeaeSMarc Zyngier * Warning, horror ahead. 12f510aeaeSMarc Zyngier * 13f510aeaeSMarc Zyngier * The target code lives in our "secure ram", but u-boot doesn't know 14f510aeaeSMarc Zyngier * that, and has blindly added reloc_off to every relocation 15f510aeaeSMarc Zyngier * entry. Gahh. Do the opposite conversion. This hack also prevents 16f510aeaeSMarc Zyngier * GCC from generating code veeners, which u-boot doesn't relocate at 17f510aeaeSMarc Zyngier * all... 18f510aeaeSMarc Zyngier */ 19f510aeaeSMarc Zyngier #define secure_ram_addr(_fn) ({ \ 20f510aeaeSMarc Zyngier DECLARE_GLOBAL_DATA_PTR; \ 21f510aeaeSMarc Zyngier void *__fn = _fn; \ 22f510aeaeSMarc Zyngier typeof(_fn) *__tmp = (__fn - gd->reloc_off); \ 23f510aeaeSMarc Zyngier __tmp; \ 24f510aeaeSMarc Zyngier }) 25f510aeaeSMarc Zyngier #else 26f510aeaeSMarc Zyngier #define secure_ram_addr(_fn) (_fn) 27f510aeaeSMarc Zyngier #endif 28f510aeaeSMarc Zyngier 29f510aeaeSMarc Zyngier #endif 30