Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 2 | * Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform_def.h> |
| 8 | #include <xlat_tables_defs.h> |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 9 | #include <host_realm_mem_layout.h> |
| 10 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 11 | |
| 12 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 13 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
| 14 | ENTRY(tftf_entrypoint) |
| 15 | |
| 16 | MEMORY { |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 17 | RAM (rwx): ORIGIN = TFTF_BASE, LENGTH = DRAM_SIZE |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | |
| 21 | SECTIONS |
| 22 | { |
| 23 | . = TFTF_BASE; |
| 24 | __TFTF_BASE__ = .; |
| 25 | |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 26 | .text . : { |
| 27 | __TEXT_START__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 28 | *entrypoint.o(.text*) |
| 29 | *(.text*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 30 | *(.vectors) |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 31 | . = NEXT(PAGE_SIZE); |
| 32 | __TEXT_END__ = .; |
| 33 | } >RAM |
| 34 | |
| 35 | .rodata . : { |
| 36 | __RODATA_START__ = .; |
| 37 | *(.rodata*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 38 | /* |
| 39 | * Memory page(s) mapped to this section will be marked as |
| 40 | * read-only, executable. No RW data from the next section must |
| 41 | * creep in. Ensure the rest of the current memory page is unused. |
| 42 | */ |
| 43 | . = NEXT(PAGE_SIZE); |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 44 | __RODATA_END__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 45 | } >RAM |
| 46 | |
| 47 | .data : { |
| 48 | __DATA_START__ = .; |
| 49 | *(.data*) |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 50 | . = NEXT(PAGE_SIZE); /* This ensures tftf.bin is aligned to page size. */ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 51 | __DATA_END__ = .; |
| 52 | } >RAM |
| 53 | |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 54 | /* End of LOAD Sections. NOLOAD sections begin here. */ |
| 55 | /* |
| 56 | * Memory for Realm Image has to follow next as it will appended to end |
| 57 | * of tftf.bin. |
| 58 | */ |
| 59 | realm_payload (NOLOAD) : { |
| 60 | __REALM_PAYLOAD_START__ = .; |
| 61 | . = __REALM_PAYLOAD_START__ + REALM_MAX_LOAD_IMG_SIZE; |
| 62 | __REALM_PAYLOAD_END__ = .; |
| 63 | } >RAM |
| 64 | |
| 65 | /* Memory pool for Realm payload tests. */ |
| 66 | realm_pool (NOLOAD) : ALIGN(PAGE_SIZE) { |
| 67 | __REALM_POOL_START__ = .; |
| 68 | . = __REALM_POOL_START__ + NS_REALM_SHARED_MEM_SIZE + PAGE_POOL_MAX_SIZE; |
| 69 | __REALM_POOL_END__ = .; |
| 70 | } >RAM |
| 71 | |
| 72 | stacks (NOLOAD) : ALIGN(16) { |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 73 | __STACKS_START__ = .; |
| 74 | *(tftf_normal_stacks) |
| 75 | __STACKS_END__ = .; |
| 76 | } >RAM |
| 77 | |
| 78 | /* |
| 79 | * The .bss section gets initialised to 0 at runtime. |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 80 | * Its base address is always PAGE_SIZE aligned. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 81 | */ |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 82 | .bss : { |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 83 | __BSS_START__ = .; |
| 84 | *(SORT_BY_ALIGNMENT(.bss*)) |
| 85 | *(COMMON) |
| 86 | __BSS_END__ = .; |
| 87 | } >RAM |
| 88 | |
| 89 | /* |
| 90 | * The xlat_table section is for full, aligned page tables (4K). |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 91 | * Removing them from .bss eliminates the unecessary zero init |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 92 | */ |
Soby Mathew | 6e5c996 | 2023-10-06 16:38:13 +0100 | [diff] [blame] | 93 | xlat_table (NOLOAD) : ALIGN(PAGE_SIZE) { |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 94 | *(xlat_table) |
| 95 | } >RAM |
| 96 | |
| 97 | /* |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 98 | * The SMC fuzzing module requires alignment due to malloc |
| 99 | * constraints. Also size must be at least around 64K |
| 100 | */ |
| 101 | smcfuzz (NOLOAD) : { |
| 102 | *(smcfuzz) |
| 103 | } >RAM |
| 104 | |
| 105 | /* |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 106 | * The base address of the coherent memory section must be page-aligned (4K) |
| 107 | * to guarantee that the coherent data are stored on their own pages and |
| 108 | * are not mixed with normal data. This is required to set up the correct |
| 109 | * memory attributes for the coherent data page tables. |
| 110 | */ |
| 111 | coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { |
| 112 | __COHERENT_RAM_START__ = .; |
| 113 | *(tftf_coherent_stacks) |
| 114 | *(tftf_coherent_mem) |
| 115 | __COHERENT_RAM_END_UNALIGNED__ = .; |
| 116 | /* |
| 117 | * Memory page(s) mapped to this section will be marked |
| 118 | * as device memory. No other unexpected data must creep in. |
| 119 | * Ensure the rest of the current memory page is unused. |
| 120 | */ |
| 121 | . = NEXT(PAGE_SIZE); |
| 122 | __COHERENT_RAM_END__ = .; |
| 123 | } >RAM |
| 124 | |
| 125 | __COHERENT_RAM_UNALIGNED_SIZE__ = |
| 126 | __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; |
| 127 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 128 | __TFTF_END__ = .; |
| 129 | |
| 130 | __BSS_SIZE__ = SIZEOF(.bss); |
| 131 | |
| 132 | } |