mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-27 15:12:21 +00:00
980d6a5511
Until now we've been using memory beyond psci_text_end as stack space for the secure monitor or PSCI implementation, even if space was not allocated for it. This was partially fixed in ("ARM: allocate extra space for PSCI stack in secure section during link phase"). However, calculating stack space from psci_text_end in one place, while allocating the space in another is error prone. This patch adds a separate empty secure stack section, with space for CONFIG_ARMV7_PSCI_NR_CPUS stacks, each 1 KB. There's also __secure_stack_start and __secure_stack_end symbols. The linker script handles calculating the correct VMAs for the stack section. For platforms that relocate/copy the secure monitor before using it, the space is not allocated in the executable, saving space. For platforms that do not define CONFIG_ARMV7_PSCI_NR_CPUS, a whole page of stack space for 4 CPUs is allocated, matching the previous behavior. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
36 lines
1.8 KiB
C
36 lines
1.8 KiB
C
/*
|
|
* Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
/**
|
|
* These two symbols are declared in a C file so that the linker
|
|
* uses R_ARM_RELATIVE relocation, rather than the R_ARM_ABS32 one
|
|
* it would use if the symbols were defined in the linker file.
|
|
* Using only R_ARM_RELATIVE relocation ensures that references to
|
|
* the symbols are correct after as well as before relocation.
|
|
*
|
|
* We need a 0-byte-size type for these symbols, and the compiler
|
|
* does not allow defining objects of C type 'void'. Using an empty
|
|
* struct is allowed by the compiler, but causes gcc versions 4.4 and
|
|
* below to complain about aliasing. Therefore we use the next best
|
|
* thing: zero-sized arrays, which are both 0-byte-size and exempt from
|
|
* aliasing warnings.
|
|
*/
|
|
|
|
char __bss_start[0] __attribute__((section(".__bss_start")));
|
|
char __bss_end[0] __attribute__((section(".__bss_end")));
|
|
char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
|
|
char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
|
|
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
|
|
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
|
|
char __secure_start[0] __attribute__((section(".__secure_start")));
|
|
char __secure_end[0] __attribute__((section(".__secure_end")));
|
|
char __secure_stack_start[0] __attribute__((section(".__secure_stack_start")));
|
|
char __secure_stack_end[0] __attribute__((section(".__secure_stack_end")));
|
|
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start")));
|
|
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop")));
|
|
char __efi_runtime_rel_start[0] __attribute__((section(".__efi_runtime_rel_start")));
|
|
char __efi_runtime_rel_stop[0] __attribute__((section(".__efi_runtime_rel_stop")));
|
|
char _end[0] __attribute__((section(".__end")));
|