导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页
    1. 主页
    2. fishingkids
    3. 帖子
    F
    • 资料
    • 关注 0
    • 粉丝 0
    • 我的积分 90
    • 主题 1
    • 帖子 1
    • 最佳 0
    • 群组 0

    fishingkids 发布的帖子

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

      使用板子是全志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
      
      发布在 MR Series
      F
      fishingkids
    • 1 / 1