Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    d1板子在supervisor模式下satp的mode字段不可更改

    MR Series
    1
    1
    868
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fishingkids LV 2 last edited by

      使用板子是全志d1,实现一个riscv64的操作系统,在mmu这一部分实现时遇到一个问题,通过opensbi启动之后,系统进入s模式,然后尝试更改satp的mode字段为8,既实现SV39模式,但尝试多次无法更改satp.mode,只能保持默认的0,但是satp的其他字段是可以更改的,使用代码如下

      # set MODE to SV39 (8)
      li t0, 8
      slli t0, t0, 60
      # Right shift the address in the t1 register by 12 bits to get the PFN
      li t1, 0x80000000
      srli t1, t1, 12
      # Combine MODE and PFN
      or t1, t1, t0
      # Set the satp register to SV39 mode, and set the page table base address at the same time
      csrw satp, t1
      # Execute the sfence.vma instruction to flush the TLB
      sfence.vma x0, x0
      
      1 Reply Last reply Reply Quote Share 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策