Skip to content

[libcpu][risc-v] fix the bug when using ASID in the RV64 MMU. #9511

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

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libcpu/risc-v/common64/asid.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ static rt_uint64_t global_asid_generation;

void rt_hw_asid_init(void)
{
unsigned int satp_reg = read_csr(satp);
rt_uint64_t satp_reg = read_csr(satp);
satp_reg |= (((rt_uint64_t)0xffff) << PPN_BITS);
write_csr(satp, satp_reg);
__asm__ volatile("sfence.vma x0, x0");
unsigned short valid_asid_bit = ((read_csr(satp) >> PPN_BITS) & 0xffff);

// The maximal value of ASIDLEN, is 9 for Sv32 or 16 for Sv39, Sv48, and Sv57
Expand Down
Loading