Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 1 | /* |
Alexei Fedorov | 490ace7 | 2020-05-30 17:33:26 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. |
Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | #ifndef ARM_RECLAIM_INIT_LD_S |
| 7 | #define ARM_RECLAIM_INIT_LD_S |
| 8 | |
| 9 | SECTIONS |
| 10 | { |
| 11 | .init __STACKS_START__ : { |
| 12 | . = . + PLATFORM_STACK_SIZE; |
| 13 | . = ALIGN(PAGE_SIZE); |
| 14 | __INIT_CODE_START__ = .; |
Alexei Fedorov | 490ace7 | 2020-05-30 17:33:26 +0100 | [diff] [blame] | 15 | *(*text.init*); |
Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 16 | __INIT_CODE_END__ = .; |
David Horstmann | 8f15ca3 | 2020-10-14 15:17:49 +0100 | [diff] [blame] | 17 | INIT_CODE_END_ALIGNED = ALIGN(PAGE_SIZE); |
Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 18 | } >RAM |
| 19 | |
| 20 | #ifdef BL31_PROGBITS_LIMIT |
| 21 | ASSERT(__INIT_CODE_END__ <= BL31_PROGBITS_LIMIT, |
| 22 | "BL31 init has exceeded progbits limit.") |
| 23 | #endif |
Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 24 | } |
| 25 | |
Alexei Fedorov | 490ace7 | 2020-05-30 17:33:26 +0100 | [diff] [blame] | 26 | #define ABS ABSOLUTE |
Alexei Fedorov | 490ace7 | 2020-05-30 17:33:26 +0100 | [diff] [blame] | 27 | |
David Horstmann | 8f15ca3 | 2020-10-14 15:17:49 +0100 | [diff] [blame] | 28 | #define STACK_SECTION \ |
| 29 | stacks (NOLOAD) : { \ |
| 30 | __STACKS_START__ = .; \ |
| 31 | *(tzfw_normal_stacks) \ |
| 32 | __STACKS_END__ = .; \ |
| 33 | /* Allow room for the init section where necessary. */ \ |
| 34 | OFFSET = ABS(SIZEOF(.init) - (. - __STACKS_START__)); \ |
| 35 | /* Offset sign */ \ |
| 36 | SIGN = ABS(OFFSET) & (1 << 63); \ |
| 37 | /* Offset mask */ \ |
| 38 | MASK = ABS(SIGN >> 63) - 1; \ |
| 39 | . += ABS(OFFSET) & ABS(MASK); \ |
| 40 | . = ALIGN(PAGE_SIZE); \ |
Alexei Fedorov | 490ace7 | 2020-05-30 17:33:26 +0100 | [diff] [blame] | 41 | } |
David Horstmann | 8f15ca3 | 2020-10-14 15:17:49 +0100 | [diff] [blame] | 42 | |
Daniel Boulby | b1b058d | 2018-09-18 11:52:49 +0100 | [diff] [blame] | 43 | #endif /* ARM_RECLAIM_INIT_LD_S */ |