diff --git a/include/common/bl_common.ld.h b/include/common/bl_common.ld.h index 3fc8e97..8ea7d6a 100644 --- a/include/common/bl_common.ld.h +++ b/include/common/bl_common.ld.h @@ -58,13 +58,32 @@ *(.got) \ __GOT_END__ = .; +/* + * The base xlat table + * + * It is put into the rodata section if PLAT_RO_XLAT_TABLES=1, + * or into the bss section otherwise. + */ +#define BASE_XLAT_TABLE \ + . = ALIGN(16); \ + *(base_xlat_table) + +#if PLAT_RO_XLAT_TABLES +#define BASE_XLAT_TABLE_RO BASE_XLAT_TABLE +#define BASE_XLAT_TABLE_BSS +#else +#define BASE_XLAT_TABLE_RO +#define BASE_XLAT_TABLE_BSS BASE_XLAT_TABLE +#endif + #define RODATA_COMMON \ RT_SVC_DESCS \ FCONF_POPULATOR \ PMF_SVC_DESCS \ PARSER_LIB_DESCS \ CPU_OPS \ - GOT + GOT \ + BASE_XLAT_TABLE_RO #define STACK_SECTION \ stacks (NOLOAD) : { \ @@ -142,6 +161,7 @@ *(COMMON) \ BAKERY_LOCK_NORMAL \ PMF_TIMESTAMP \ + BASE_XLAT_TABLE_BSS \ __BSS_END__ = .; \ } diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h index ab311f4..9fe4a6e 100644 --- a/include/lib/xlat_tables/xlat_tables_v2.h +++ b/include/lib/xlat_tables/xlat_tables_v2.h @@ -164,20 +164,15 @@ * Would typically be PLAT_VIRT_ADDR_SPACE_SIZE * (resp. PLAT_PHY_ADDR_SPACE_SIZE) for the translation context describing the * BL image currently executing. - - * _base_table_section: - * Specify the name of the section where the base translation tables have to - * be placed by the linker. */ #define REGISTER_XLAT_CONTEXT(_ctx_name, _mmap_count, _xlat_tables_count, \ - _virt_addr_space_size, _phy_addr_space_size, \ - _base_table_section) \ + _virt_addr_space_size, _phy_addr_space_size) \ REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ (_xlat_tables_count), \ (_virt_addr_space_size), \ (_phy_addr_space_size), \ EL_REGIME_INVALID, \ - "xlat_table", (_base_table_section)) + "xlat_table", "base_xlat_table") /* * Same as REGISTER_XLAT_CONTEXT plus the additional parameters: diff --git a/lib/xlat_tables_v2/xlat_tables_context.c b/lib/xlat_tables_v2/xlat_tables_context.c index 032e142..95dae88 100644 --- a/lib/xlat_tables_v2/xlat_tables_context.c +++ b/lib/xlat_tables_v2/xlat_tables_context.c @@ -25,15 +25,8 @@ * Allocate and initialise the default translation context for the BL image * currently executing. */ -#if PLAT_RO_XLAT_TABLES -#define BASE_XLAT_TABLE_SECTION ".rodata" -#else -#define BASE_XLAT_TABLE_SECTION ".bss" -#endif - REGISTER_XLAT_CONTEXT(tf, MAX_MMAP_REGIONS, MAX_XLAT_TABLES, - PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE, - BASE_XLAT_TABLE_SECTION); + PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE); void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, size_t size, unsigned int attr)