Skip to content

Commit c33a988

Browse files
bors[bot]elfmimiDisasm
authored
Merge #46
46: Assure address of PC at startup. r=Disasm a=elfmimi PR created upon @Disasm 's request. Closes: #44 Need update of library files after merging. Co-authored-by: Ein Terakawa <[email protected]> Co-authored-by: Vadim Kaushan <[email protected]>
2 parents cd419ae + 7e4c1b9 commit c33a988

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

riscv-rt/asm.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@
1212
.global _start
1313

1414
_start:
15+
/* Jump to the absolute address defined by the linker script. */
16+
// for 32bit
17+
.if __riscv_xlen == 32
18+
lui ra, %hi(_abs_start)
19+
jr %lo(_abs_start)(ra)
20+
.endif
21+
22+
// for 64bit
23+
.if __riscv_xlen == 64
24+
1:
25+
auipc ra, %pcrel_hi(1f)
26+
ld ra, %pcrel_lo(1b)(ra)
27+
jr ra
28+
.align 3
29+
1:
30+
.dword _abs_start
31+
.endif
32+
33+
_abs_start:
1534
.cfi_startproc
1635
.cfi_undefined ra
1736

-32 Bytes
Binary file not shown.
-32 Bytes
Binary file not shown.
120 Bytes
Binary file not shown.
120 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)