Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36612 )
Change subject: arch/x86: Link NO_XIP_EARLY_STAGES like other stages
......................................................................
arch/x86: Link NO_XIP_EARLY_STAGES like other stages
If stages are not run XIP they can be linked like other stages, which
includes a (*.data) section.
Change-Id: Ib165058abfb07e385461cdcca4aef31928ec7572
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/arch/x86/assembly_entry.S
M src/arch/x86/car.ld
M src/include/rules.h
M src/lib/program.ld
4 files changed, 7 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/36612/1
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S
index c36dc1c..a838b6d 100644
--- a/src/arch/x86/assembly_entry.S
+++ b/src/arch/x86/assembly_entry.S
@@ -32,7 +32,8 @@
/* reset stack pointer to CAR stack */
mov $_car_stack_end, %esp
- /* clear .bss section as it is not shared */
+ /* clear .bss section as it is not shared if stages are run XIP*/
+#if !ENV_STAGE_HAS_DATA_SECTION
cld
xor %eax, %eax
movl $(_ebss), %ecx
@@ -40,6 +41,7 @@
sub %edi, %ecx
shrl $2, %ecx
rep stosl
+#endif
#if ((ENV_VERSTAGE && CONFIG(VERSTAGE_DEBUG_SPINLOOP)) \
|| (ENV_ROMSTAGE && CONFIG(ROMSTAGE_DEBUG_SPINLOOP)))
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index 6ccbd8c..a68b635 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -69,6 +69,7 @@
* cbmem console. This is useful for clearing this area on a per-stage
* basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */
+#if !ENV_STAGE_HAS_DATA_SECTION
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bss = .;
#if ENV_STAGE_HAS_BSS_SECTION
@@ -84,6 +85,7 @@
#endif
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_ebss = .;
+#endif
_car_unallocated_start = .;
#if !CONFIG(C_ENVIRONMENT_BOOTBLOCK)
diff --git a/src/include/rules.h b/src/include/rules.h
index 0436198..fe162f8 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -274,7 +274,7 @@
/* Indicates memory layout is determined with arch/x86/car.ld. */
#define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM))
/* No .data sections with execute-in-place from ROM. */
-#define ENV_STAGE_HAS_DATA_SECTION !ENV_CACHE_AS_RAM
+#define ENV_STAGE_HAS_DATA_SECTION (!ENV_CACHE_AS_RAM || CONFIG(NO_XIP_EARLY_STAGES))
/* No .bss sections for stage with CAR teardown. */
#define ENV_STAGE_HAS_BSS_SECTION !(ENV_ROMSTAGE && CONFIG(CAR_GLOBAL_MIGRATION))
#else
diff --git a/src/lib/program.ld b/src/lib/program.ld
index a9d4e48..d323ac1 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -125,7 +125,7 @@
}
#endif
-#if ENV_STAGE_HAS_BSS_SECTION && !ENV_CACHE_AS_RAM
+#if ENV_STAGE_HAS_BSS_SECTION && ENV_STAGE_HAS_DATA_SECTION
.bss . : {
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bss = .;
--
To view, visit https://review.coreboot.org/c/coreboot/+/36612
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib165058abfb07e385461cdcca4aef31928ec7572
Gerrit-Change-Number: 36612
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange