Skip to content

Commit 953ad99

Browse files
Merge pull request #312 from rust-embedded/rvrt-asm
`riscv-rt`: remove general-purpose register zeroing
2 parents 512c00d + 410b7f0 commit 953ad99

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616
- In M-mode, the hart ID is moved to `a0` at the beginning of the runtime.
1717
- `abort` function no longer needs to be close to `_start`.
1818
- In multi-hart targets, the hart ID is now validated earlier in the boot process.
19+
- General purpose registers are no longer zeroed, as this is not strictly necessary.
20+
This aligns with the `cortex-m-rt` crate.
1921

2022
### Fixed
2123

riscv-rt/src/asm.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ _abs_start:
8282
1:", // only valid harts reach this point
8383
);
8484

85-
// ZERO OUT GENERAL-PURPOSE REGISTERS
86-
riscv_rt_macros::loop_global_asm!(" li x{}, 0", 1, 10);
87-
// a0..a2 (x10..x12) skipped
88-
riscv_rt_macros::loop_global_asm!(" li x{}, 0", 13, 16);
89-
#[cfg(riscvi)]
90-
riscv_rt_macros::loop_global_asm!(" li x{}, 0", 16, 32);
91-
9285
// INITIALIZE GLOBAL POINTER, STACK POINTER, AND FRAME POINTER
9386
cfg_global_asm!(
9487
".option push
@@ -193,13 +186,6 @@ cfg_global_asm!(
193186
csrrs x0, mstatus, t2",
194187
"fscsr x0",
195188
);
196-
// ZERO OUT FLOATING POINT REGISTERS
197-
#[cfg(all(target_arch = "riscv32", riscvd))]
198-
riscv_rt_macros::loop_global_asm!(" fcvt.d.w f{}, x0", 32);
199-
#[cfg(all(target_arch = "riscv64", riscvd))]
200-
riscv_rt_macros::loop_global_asm!(" fmv.d.x f{}, x0", 32);
201-
#[cfg(all(riscvf, not(riscvd)))]
202-
riscv_rt_macros::loop_global_asm!(" fmv.w.x f{}, x0", 32);
203189

204190
// SET UP INTERRUPTS, RESTORE a0..a2, AND JUMP TO MAIN RUST FUNCTION
205191
cfg_global_asm!(

0 commit comments

Comments
 (0)