导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

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

    MR Series
    1
    1
    844
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • F
      fishingkids LV 2 最后由 编辑

      使用板子是全志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 条回复 最后回复 回复 引用 分享 0
      • 1 / 1
      • First post
        Last post

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

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