ARM+RISC-V: BSS handling improvements
PATCH 1/1 ARM+RISC-V: BSS handling improvements
* Correct comments in arm{32,64}/head.S
* Provide Linker assertions to check the safety of the zeroing loops
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Bob Eshleman <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Connor Davis <[email protected]>
CC: Oleksii Kurochko <[email protected]>
Pulled out of the very start of my work to try and unify the handling of xen_phys_addr across architectures.
--- xen/arch/arm/arm32/head.S | 2 +- xen/arch/arm/arm64/head.S | 2 +- xen/arch/arm/xen.lds.S | 2 ++ xen/arch/riscv/xen.lds.S | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-)
xen/arch/arm/arm32/head.S +1 -1
@@ -301,7 +301,7 @@ ENDPROC(check_cpu_mode) zero_bss: PRINT("- Zero BSS -\r\n") mov_w r0, __bss_start /* r0 := vaddr(__bss_start) */ - mov_w r1, __bss_end /* r1 := vaddr(__bss_start) */ + mov_w r1, __bss_end /* r1 := vaddr(__bss_end) */ mov r2, #0 1: str r2, [r0], #4
xen/arch/arm/arm64/head.S +1 -1
@@ -437,7 +437,7 @@ zero_bss: PRINT("- Zero BSS -\r\n") ldr x0, =__bss_start /* x0 := vaddr(__bss_start) */ - ldr x1, =__bss_end /* x1 := vaddr(__bss_start) */ + ldr x1, =__bss_end /* x1 := vaddr(__bss_end) */ 1: str xzr, [x0], #8 cmp x0, x1
xen/arch/arm/xen.lds.S +2 -0
@@ -240,3 +240,5 @@ ASSERT(_idmap_end - _idmap_start <= PAGE_SIZE, "Identity mapped code is larger t */ ASSERT(IS_ALIGNED(__init_begin, 4), "__init_begin is misaligned") ASSERT(IS_ALIGNED(__init_end, 4), "__init_end is misaligned") +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")
xen/arch/riscv/xen.lds.S +4 -0
@@ -1,3 +1,4 @@ +#include <xen/lib.h> #include <xen/xen.lds.h> #undef ENTRY
@@ -156,3 +157,6 @@ SECTIONS ELF_DETAILS_SECTIONS } + +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")
Signature · 1 line
2.30.2
Hi Andrew,
Quoted 4 lines · Andrew Cooper
* Correct comments in
arm{32,64}/head.S
* Provide Linker assertions to check the safety of the zeroing loopsSigned-off-by Andrew Cooper <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Quoted 5 lines · Andrew Cooper
* Correct comments in
arm{32,64}/head.S
* Provide Linker assertions to check the safety of the zeroing loopsSigned-off-by Andrew Cooper <[email protected]>
Alistair
Quoted 75 lines
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Bob Eshleman <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Connor Davis <[email protected]>
CC: Oleksii Kurochko <[email protected]>Pulled out of the very start of my work to try and unify the handling of
xen_phys_addracross architectures.--- xen/arch/arm/arm32/head.S | 2 +- xen/arch/arm/arm64/head.S | 2 +- xen/arch/arm/xen.lds.S | 2 ++ xen/arch/riscv/xen.lds.S | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-)xen/arch/arm/arm32/head.S +1
-1@@ -301,7 +301,7 @@ ENDPROC(check_cpu_mode) zero_bss: PRINT("- Zero BSS -\r\n") mov_w r0, __bss_start /* r0 := vaddr(__bss_start) */ - mov_w r1, __bss_end /* r1 := vaddr(__bss_start) */ + mov_w r1, __bss_end /* r1 := vaddr(__bss_end) */ mov r2, #0 1: str r2, [r0], #4xen/arch/arm/arm64/head.S +1
-1@@ -437,7 +437,7 @@ zero_bss: PRINT("- Zero BSS -\r\n") ldr x0, =__bss_start /* x0 := vaddr(__bss_start) */ - ldr x1, =__bss_end /* x1 := vaddr(__bss_start) */ + ldr x1, =__bss_end /* x1 := vaddr(__bss_end) */ 1: str xzr, [x0], #8 cmp x0, x1xen/arch/arm/xen.lds.S +2
-0@@ -240,3 +240,5 @@ ASSERT(_idmap_end - _idmap_start <= PAGE_SIZE, "Identity mapped code is larger t */ ASSERT(IS_ALIGNED(__init_begin, 4), "__init_begin is misaligned") ASSERT(IS_ALIGNED(__init_end, 4), "__init_end is misaligned") +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")xen/arch/riscv/xen.lds.S +4
-1@@ -1,3 +1,4 @@ +#include <xen/lib.h> #include <xen/xen.lds.h> #undef ENTRY@@ -156,3 +157,6 @@ SECTIONS ELF_DETAILS_SECTIONS } + +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned") --2.30.2
Hi,
Quoted 4 lines · Andrew Cooper
* Correct comments in
arm{32,64}/head.S
* Provide Linker assertions to check the safety of the zeroing loopsSigned-off-by Andrew Cooper <[email protected]>
It is now fully acked. So I have committed the patch.
Cheers,
Quoted 71 lines
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Bob Eshleman <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Connor Davis <[email protected]>
CC: Oleksii Kurochko <[email protected]>Pulled out of the very start of my work to try and unify the handling of
xen_phys_addracross architectures.--- xen/arch/arm/arm32/head.S | 2 +- xen/arch/arm/arm64/head.S | 2 +- xen/arch/arm/xen.lds.S | 2 ++ xen/arch/riscv/xen.lds.S | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-)xen/arch/arm/arm32/head.S +1
-1@@ -301,7 +301,7 @@ ENDPROC(check_cpu_mode) zero_bss: PRINT("- Zero BSS -\r\n") mov_w r0, __bss_start /* r0 := vaddr(__bss_start) */ - mov_w r1, __bss_end /* r1 := vaddr(__bss_start) */ + mov_w r1, __bss_end /* r1 := vaddr(__bss_end) */ mov r2, #0 1: str r2, [r0], #4xen/arch/arm/arm64/head.S +1
-1@@ -437,7 +437,7 @@ zero_bss: PRINT("- Zero BSS -\r\n") ldr x0, =__bss_start /* x0 := vaddr(__bss_start) */ - ldr x1, =__bss_end /* x1 := vaddr(__bss_start) */ + ldr x1, =__bss_end /* x1 := vaddr(__bss_end) */ 1: str xzr, [x0], #8 cmp x0, x1xen/arch/arm/xen.lds.S +2
-0@@ -240,3 +240,5 @@ ASSERT(_idmap_end - _idmap_start <= PAGE_SIZE, "Identity mapped code is larger t */ ASSERT(IS_ALIGNED(__init_begin, 4), "__init_begin is misaligned") ASSERT(IS_ALIGNED(__init_end, 4), "__init_end is misaligned") +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")xen/arch/riscv/xen.lds.S +4
-0@@ -1,3 +1,4 @@ +#include <xen/lib.h> #include <xen/xen.lds.h> #undef ENTRY@@ -156,3 +157,6 @@ SECTIONS ELF_DETAILS_SECTIONS } + +ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") +ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")
Signature · 1 line
Julien Grall