diff --git a/rust/pvimg/boot/stage3a.h b/rust/pvimg/boot/stage3a.h index 538c876d..aae565b6 100644 --- a/rust/pvimg/boot/stage3a.h +++ b/rust/pvimg/boot/stage3a.h @@ -13,6 +13,8 @@ #include "lib/zt_common.h" #include "boot/loaders_layout.h" +#define STAGE3A_BSS_ADDRESS _AC(0xc000, UL) +#define STAGE3A_BSS_SIZE _AC(0x1000, UL) #define STAGE3A_INIT_ENTRY IMAGE_ENTRY #define STAGE3A_ENTRY (STAGE3A_INIT_ENTRY + _AC(0x1000, UL)) #define STAGE3A_LOAD_ADDRESS IMAGE_LOAD_ADDRESS diff --git a/rust/pvimg/boot/stage3a.lds.S b/rust/pvimg/boot/stage3a.lds.S index cc50948d..9b77c6ea 100644 --- a/rust/pvimg/boot/stage3a.lds.S +++ b/rust/pvimg/boot/stage3a.lds.S @@ -32,6 +32,16 @@ SECTIONS } __heap_stop = .; + . = STAGE3A_BSS_ADDRESS; + __bss_start = .; + .bss : { + *(.bss .bss.*) + . = ALIGN(4096); + ASSERT(__bss_stop - __bss_start == STAGE3A_BSS_SIZE, + "Stack section doesn't conform to the described memory layout"); + } + __bss_stop = .; + . = STACK_ADDRESS; __stack_start = .; .stack : { @@ -64,12 +74,6 @@ SECTIONS __ex_table_stop = .; } - .bss ALIGN(16) : { - __bss_start = .; - *(.bss) - __bss_stop = .; - } - .rodata ALIGN(16) : { *(.rodata) *(.rodata*)