Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | */ |
| 5 | |
| 6 | #include <sizes.h> |
| 7 | |
| 8 | ENTRY(rmm_entry) |
| 9 | |
| 10 | MEMORY { |
| 11 | RAM (rwx): ORIGIN = 0x0, LENGTH = RMM_MAX_SIZE |
| 12 | } |
| 13 | |
| 14 | SECTIONS |
| 15 | { |
| 16 | rmm_base = .; |
| 17 | |
| 18 | .text . : { |
| 19 | rmm_text_start = .; |
| 20 | *head.S.obj(.text*) |
| 21 | . = ALIGN(8); |
| 22 | *(.text*) |
| 23 | . = ALIGN(GRANULE_SIZE); |
| 24 | } >RAM |
| 25 | |
| 26 | rmm_text_end = .; |
| 27 | |
| 28 | ASSERT(rmm_text_end == ALIGN(GRANULE_SIZE), "rmm_text_end is not page aligned") |
| 29 | |
| 30 | .rodata ALIGN(GRANULE_SIZE) : { |
| 31 | rmm_ro_start = .; |
| 32 | *(.rodata*) |
| 33 | . = ALIGN(8); |
| 34 | rmm_got_start = .; |
| 35 | *(.got) |
| 36 | rmm_got_end = .; |
| 37 | } >RAM |
| 38 | |
| 39 | /* |
| 40 | * The xlat_static_table section is for full, aligned page tables. |
| 41 | * The static tables must not change once the MMU is enabled, so |
| 42 | * allocate them on the RO area to keep them protected from writing. |
| 43 | * |
| 44 | * The memory will be cleared by the xlat library during start up. |
| 45 | */ |
| 46 | xlat_table ALIGN(GRANULE_SIZE) : { |
| 47 | *(xlat_static_tables) |
| 48 | } >RAM |
| 49 | |
| 50 | rmm_ro_end = .; |
| 51 | |
| 52 | ASSERT(rmm_ro_end == ALIGN(GRANULE_SIZE), "rmm_ro_end is not page aligned") |
| 53 | |
| 54 | /* Align rw data to the next 2MB block */ |
| 55 | .data ALIGN(SZ_2M) : { |
| 56 | rmm_rw_start = .; |
| 57 | *(.data*) |
| 58 | } >RAM |
| 59 | |
| 60 | /* |
| 61 | * .rela.dyn needs to come after .data for the read-elf utility to |
| 62 | * parse this section correctly. |
| 63 | */ |
| 64 | .rela.dyn ALIGN(8) : { |
| 65 | rmm_rela_start = .; |
| 66 | *(.rela*) |
| 67 | rmm_rela_end = .; |
| 68 | } >RAM |
| 69 | |
| 70 | .percpu ALIGN(GRANULE_SIZE) (NOLOAD) : { |
| 71 | stack_start = .; |
| 72 | . = . + (RMM_NUM_PAGES_PER_STACK * GRANULE_SIZE * MAX_CPUS); |
| 73 | stack_end = .; |
| 74 | } >RAM |
| 75 | |
| 76 | .bss ALIGN(16) (NOLOAD) : { |
| 77 | bss_start = .; |
| 78 | *(.bss*) |
| 79 | bss_end = .; |
| 80 | } >RAM |
| 81 | |
Javier Almansa Sobrino | ed93259 | 2023-01-24 12:50:41 +0000 | [diff] [blame^] | 82 | . = ALIGN(GRANULE_SIZE); |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 83 | rmm_rw_end = .; |
| 84 | rmm_end = rmm_rw_end; |
| 85 | |
| 86 | ASSERT(rmm_rw_end == ALIGN(GRANULE_SIZE), "rmm_rw_end is not page aligned") |
| 87 | |
| 88 | /DISCARD/ : { *(.dynstr*) } |
| 89 | /DISCARD/ : { *(.dynsym*) } |
| 90 | /DISCARD/ : { *(.dynamic*) } |
| 91 | /DISCARD/ : { *(.hash*) } |
| 92 | /DISCARD/ : { *(.plt*) } |
| 93 | /DISCARD/ : { *(.interp*) } |
| 94 | /DISCARD/ : { *(.gnu*) } |
| 95 | /DISCARD/ : { *(.note*) } |
| 96 | } |