diff --git a/arm11/link.ld b/arm11/link.ld index 36642423a..51122881f 100644 --- a/arm11/link.ld +++ b/arm11/link.ld @@ -16,7 +16,7 @@ SECTIONS __text_va = ABSOLUTE(.); *(.text*) . = ALIGN(4K); - __text_len = . - __text_va; + __text_va_end = .; } >AXIWRAM .data : ALIGN(4K) @@ -25,7 +25,7 @@ SECTIONS __data_va = ABSOLUTE(.); *(.data*) . = ALIGN(4K); - __data_len = . - __data_va; + __data_va_end = .; } >AXIWRAM .rodata : ALIGN(4K) @@ -34,7 +34,7 @@ SECTIONS __rodata_va = ABSOLUTE(.); *(.rodata*) . = ALIGN(4K); - __rodata_len = . - __rodata_va; + __rodata_va_end = .; } >AXIWRAM .shared (NOLOAD) : ALIGN(4K) @@ -43,7 +43,7 @@ SECTIONS __shared_va = ABSOLUTE(.); *(.shared*) . = ALIGN(4K); - __shared_len = . - __shared_va; + __shared_va_end = .; } >AXIWRAM .bss (NOLOAD) : ALIGN(4K) @@ -52,6 +52,6 @@ SECTIONS __bss_va = ABSOLUTE(.); *(.bss*) . = ALIGN(4K); - __bss_len = . - __bss_va; + __bss_va_end = .; } >AXIWRAM } diff --git a/arm11/source/boot.s b/arm11/source/boot.s index 9e7deef36..5b2167b65 100644 --- a/arm11/source/boot.s +++ b/arm11/source/boot.s @@ -76,10 +76,12 @@ __boot: b 1b corezero_start: - @ assume __bss_len is 128 byte aligned + @ assumes the .bss section size is 128 byte aligned (or zero) ldr r0, =__bss_pa - ldr r1, =__bss_len - add r1, r0, r1 + ldr r1, =__bss_va_end @ calculate the length of .bss using the VA start and end + ldr r2, =__bss_va + sub r1, r1, r2 + add r1, r0, r1 @ fixup to be PA start and end mov r2, #0 mov r3, #0 mov r4, #0 diff --git a/arm11/source/system/sections.h b/arm11/source/system/sections.h index 008f93a6a..21e5f1294 100755 --- a/arm11/source/system/sections.h +++ b/arm11/source/system/sections.h @@ -20,7 +20,7 @@ #include -#define DEF_SECT_(n) extern u32 __##n##_pa, __##n##_va, __##n##_len; +#define DEF_SECT_(n) extern u32 __##n##_pa, __##n##_va, __##n##_va_end; DEF_SECT_(text) DEF_SECT_(data) DEF_SECT_(rodata) @@ -30,6 +30,6 @@ DEF_SECT_(shared) #define SECTION_VA(n) ((u32)&__##n##_va) #define SECTION_PA(n) ((u32)&__##n##_pa) -#define SECTION_LEN(n) ((u32)&__##n##_len) +#define SECTION_LEN(n) (((u32)(&__##n##_va_end) - (u32)(&__##n##_va))) #define SECTION_TRI(n) SECTION_VA(n), SECTION_PA(n), SECTION_LEN(n)