diff --git a/test/asm/init_regs.s b/test/asm/init_regs.s index 48c767bd8..853a40a15 100644 --- a/test/asm/init_regs.s +++ b/test/asm/init_regs.s @@ -35,6 +35,7 @@ .endm .macro INIT_REGS_ALLOCATION -.org 0x100 +.section .init_regs, "a", @nobits .skip 0x80 +.previous .endm diff --git a/test/asm/interrupt.asm b/test/asm/interrupt.asm index ccf079245..a3b59b30e 100644 --- a/test/asm/interrupt.asm +++ b/test/asm/interrupt.asm @@ -101,5 +101,4 @@ fail: j int_handler li x31, 0xae # should never happen -.bss - INIT_REGS_ALLOCATION +INIT_REGS_ALLOCATION diff --git a/test/asm/link.ld b/test/asm/link.ld index e47674779..506019a64 100644 --- a/test/asm/link.ld +++ b/test/asm/link.ld @@ -1,4 +1,4 @@ -OUTPUT_ARCH( "riscv" ) +OTPUT_ARCH( "riscv" ) start = 0; @@ -6,6 +6,12 @@ SECTIONS { .text : { *(.text) } . = 0x100000000; /* start from 2**32 - trick to emulate Harvard architecture (memory addresses will start from 0) */ - .data : { *(.data) *(.bss) } - _end = .; + .data : { + *(.data) + *(.bss) + + . = _end_init_regs > . ? 0x1000 : .; /* skip .init_regs origin allocation if not used */ + *(.init_regs) + _end_init_regs = .; + } } diff --git a/test/asm/wfi_int.asm b/test/asm/wfi_int.asm index 838e0b5f8..39ceda94a 100644 --- a/test/asm/wfi_int.asm +++ b/test/asm/wfi_int.asm @@ -29,5 +29,4 @@ skip: .org 0x100 j handler -.data - INIT_REGS_ALLOCATION +INIT_REGS_ALLOCATION