Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MTIP bit in mip register is read-only #62

Closed
SKTT1Ryze opened this issue Jan 11, 2021 · 1 comment · Fixed by #108
Closed

The MTIP bit in mip register is read-only #62

SKTT1Ryze opened this issue Jan 11, 2021 · 1 comment · Fixed by #108

Comments

@SKTT1Ryze
Copy link

In the riscv-privileged manual, it is said that "The MTIP bit (in mip) is read-only and is cleared by writing to the memory-mapped machine-mode timer compare register."
But in the riscv crate, there is an interface like this:

use riscv::register::mip;
use riscv_rt::entry;

#[entry]  
fn main() {
    mip::set_mtimer();
}

We can write the code mip::set_mtimer() to set the 7th bit, the MTIP bit, of the mip register, which does not permitted in riscv-privileged manual.
Is there some reason for the existence of mip::set_mtimer()? If not, I suggest remove it.
Thanks.

@luojia65
Copy link
Contributor

This should be a mistake, we should check and delete them in future releases.

bors bot added a commit that referenced this issue Aug 14, 2022
108: fix: clearify that mip.{MSIP, MTIP} are read-only r=almindor a=luojia65

closes #62

In RISC-V privileged specification, it says:

> Bits mip.MTIP and mie.MTIE are the interrupt-pending and interrupt-enable bits for machine timer interrupts. MTIP is read-only in mip, and is cleared by writing to the memory-mapped machine-mode timer compare register.
>
> Bits mip.MSIP and mie.MSIE are the interrupt-pending and interrupt-enable bits for machine-level software interrupts. MSIP is read-only in mip, and is written by accesses to memory-mapped control registers, which are used by remote harts to provide machine-level interprocessor interrupts.

indicated by the specification, mip.MSIP and mip.MTIP bits are read-only. This pull request clearifies this by removing {set, clear}_{msoft, mtimer} functions from mip module of riscv crate.

Co-authored-by: luojia65 <me@luojia.cc>
@bors bors bot closed this as completed in 9418b6c Aug 14, 2022
romancardenas pushed a commit that referenced this issue Nov 17, 2023
62: Preserve .eh_frame and .eh_frame_hdr r=almindor a=Disasm

Preserving the `.eh_frame` section improves gdb stack traces on nightly.
Preserving the `.eh_frame_hdr` section fixes the linker problem `rust-lld: error: no memory region specified for section '.eh_frame_hdr'` introduced in rust-lang/rust#73564

Co-authored-by: Vadim Kaushan <admin@disasm.info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants