Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Ignore hartid in single-hart mode. #126

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

kevin-vigor
Copy link
Contributor

Don't bother checking hart ID on startup in single-hart mode. Allows use of cores with unusual mhartid values and saves a few instructions.

Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! I left you a few comments.

The code becomes a bit more complex but I don't see the performance benefits of this PR. Can you review my suggestions and push a new commit?

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated
use riscv::register::{mcause as xcause, mhartid, mtvec as xtvec, mtvec::TrapMode as xTrapMode};
use riscv::register::{mcause as xcause, mtvec as xtvec, mtvec::TrapMode as xTrapMode};

#[cfg(not(feature = "single-hart"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be #[cfg(not(any(feature = "s-mode", feature = "single-hart"))], as it is only used in multi-hart machine mode.

@romancardenas
Copy link
Contributor

LGMT! Please, look at my last comment and add a short description of your PR in CHANGELOG.md.

Don't bother checking hart ID on startup in single-hart mode. Allows
use of cores with unusual mhartid values and saves a few instructions.
@romancardenas romancardenas added this pull request to the merge queue Nov 9, 2023
Merged via the queue into rust-embedded:master with commit 6624491 Nov 9, 2023
69 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants