Skip to content

Commit

Permalink
Move init regs to separate section
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 committed Aug 9, 2024
1 parent bf8b0e4 commit ab57393
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion test/asm/init_regs.s
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
.endm

.macro INIT_REGS_ALLOCATION
.org 0x100
.section .init_regs, "a", @nobits
.skip 0x80
.previous
.endm
3 changes: 1 addition & 2 deletions test/asm/interrupt.asm
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,4 @@ fail:
j int_handler
li x31, 0xae # should never happen

.bss
INIT_REGS_ALLOCATION
INIT_REGS_ALLOCATION
12 changes: 9 additions & 3 deletions test/asm/link.ld
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
OUTPUT_ARCH( "riscv" )
OTPUT_ARCH( "riscv" )

start = 0;

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 = .;
}
}
3 changes: 1 addition & 2 deletions test/asm/wfi_int.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ skip:
.org 0x100
j handler

.data
INIT_REGS_ALLOCATION
INIT_REGS_ALLOCATION

0 comments on commit ab57393

Please sign in to comment.