Rocket - debug - Example: Read Memory
https://mp.weixin.qq.com/s/ChXNTbx94WDC72GvmE9bGA
介绍riscv-debug的使用实例:使用三种方法读取内存。
1. Using System Bus Access
1) System Bus Access
除了抽象命令,Program Buffer之外,调试模块可以包含一个系统总线访问模块,以在不依赖核心的情况下,访问系统总线(使用物理地址):
访问大小可以是8/16/32/64/128位:
需要自己保证访问的缓存一致性:
2) sbcs/sbaddress/sbdata
a. sbcs
用于控制系统总线访问,以及获取访问状态:
b. sbaddress0..3
存储要访问的系统总线物理地址。
写sbaddress寄存器可能触发对该地址的读操作:
c. sbdata0..3
保存读取和要写入的数据。
读sbdata0寄存器可能触发系统总线的读操作:
写sbdata0寄存器可能触发系统总线的写操作:
3) 实例:Read a word from memory
A. 写sbcs寄存器:
a. sbaccess=2:访问大小为32bit;
b. sbreadonaddr=1:every write to sbaddress0 automatically triggers a system bus read at the new address.
B. 写sbaddress0寄存器:写入要访问的内存物理地址;由于A中把sbreadonaddr置位,所以这一步写sbaddress0寄存器会触发对刚写入的这个内存地址的读操作,读取的内容存放在sbdata0寄存器中;
C. 读sbdata0寄存器,获取目标内存地址处的内容;
4) 实例:Read block of memory
A. 写sbcs寄存器:
a. sbaccess=2:访问大小为32bit;
b. sbreadonaddr=1:every write to sbaddress0 automatically triggers a system bus read at the new address.
c. sbreadondata=1:every read from sbdata0 automatically triggers a system bus read at the (possibly auto-incremented) address.
d. sbautoincrement=1:sbaddress is incremented by the access size (in bytes) selected in sbaccess after every system bus access.
B. 写sbaddress0寄存器:写入要读取的内存的物理地址;这个写入动作会触发针对目标地址的读取操作,读取的内容存放在sbdata0寄存器;读取之后sbaddress0中的内存地址自动增加4个字节;
C. 读sbdata0寄存器:读取目标地址处的内容;这个读取动作会触发针对sbaddress0中地址的读取动作,读取的内容存放在sbdata0寄存器中,读取之后sbaddress0中的内存地址自动增加4个字节;
D. 连续读取sbdata0寄存器,以获取目标内存地址的内容;
E. 写sbcs寄存器:sbcs=0,亦即sbreadondata=0,下一次读取sbdata0时,不会再出发针对sbaddress0中地址的读取动作;
F. 读sbdata0寄存器:获取最后一个需要的内存数据;
2. Using Program Buffer
1) abstractauto
用于触发抽象命令自动执行的配置寄存器,两种触发方式及配置:
a. 修改Program Buffer;
b. 读取sbdata寄存器;
2) 实例:Read a word from memory
A. 准备Program Buffer:
a. 写progbuf0为指令:lw s0 0(s0),即读取s0中地址的内容,存入s0中;
b. 写progbuf1为指令:ebreak,即停止执行,返回调试环境;
B. 写data0寄存器:存入要读取的目标内存地址;
C. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. write=1:访问操作为写操作,即把sbdata0寄存器中的数据写入到寄存器s0中;
c. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
D. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. (补)transfer=1:Do the operation specied by write;
c. write=0:即访问操作为读操作;Copy data from the specified register into arg0 portion of data;
E. 读data0寄存器:读取从s0拷贝过来的数据,即目标内存地址处的内容;
3) 实例:Read block of memory
A. 准备Program Buffer:
a. 写progbuf0为指令:lw s1, 0(s0),即读取s0中地址的内容,存入s1中;
b. 写progbuf1为指令:addi s0, s0, 4,即地址增加4;
c. 写progbuf2为指令:ebreak,即停止执行,返回调试环境;
B. 写data0寄存器:写入目标内存起始地址;
C. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1008:即访问的对象寄存器为s0;
b. write=1:访问操作为写操作,即把sbdata0寄存器中的数据写入到寄存器s0中;
c. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
该命令的效果如下:
a. 把data0中的目标内存地址,写入到s0寄存器;
b. 触发Program Buffer执行;
D. 写command寄存器:写入要执行的抽象命令:
a. regno=0x1009:即访问的对象寄存器为s1;
b. (补)transfer=1:Do the operation specied by write;
c. write=0:即访问操作为读操作;Copy data from the specified register into arg0 portion of data;
d. postexec=1:Execute the program in the Program Buffer exactly once after performing the transfer, if any.
该命令的效果如下:
a. 把s1的值读入data0寄存器;
b. 触发Program Buffer执行;
E. 写abstractauto寄存器:
a. autoexecdata=1:read or write accesses to the corresponding data word cause the command in command to be executed again.
效果是:每次读写data0寄存器都会触发D中命令的执行;
F. 读data0寄存器:
a. 获取目标内存地址处的值;
b. 触发抽象命令的执行:把s1的值读入data0寄存器;
c. 触发Program Buffer执行:读取s0中地址的内容并写入s1,s0中的地址加4;
G. 读data0寄存器:触发连续读取;
H. 写abstractauto寄存器:
a. autoexecdata=0:读取data0寄存器,不会触发抽象命令的执行;
I. 读data0寄存器:获取最后一个数据;
3. Using Abstract Memory Access
1) Access Memory
抽象命令的一种:
其格式如下:
其中:
aam前缀的意义是:Abstract command Access Memory;相较之下,
aar前缀的意义是:Abstract command Access Register;
2) 实例:Read a word from memory
A. 写data1寄存器:存入目标内存地址;
B. 写command寄存器:存入要执行的抽象命令:
a. cmdtype=2:表示命令的类型为Access Memory;
b. aamsize=2:Access the lowest 32 bits of the memory location.
c. aamvirtual=0:Addresses are physical (to the hart they are performed on).
d. write=0:Copy data from the memory location specified in arg1 into arg0 portion of data.
这条命令的效果是:读取data1中地址的内容,并存入data0寄存器;
C. 读data0寄存器:获取从内存地址中读到的内容;
3) 实例:Read block of memory
这里只介绍要点:
a. abstractauto=1:读取data0寄存器后,触发抽象命令执行;
b. aampostincrement=1:After a memory access has completed, if this bit is 1, increment arg1 (which contains the address used) by the number of bytes encoded in aamsize. 即每次读取内存之后,都把目标内存地址加4,即data1寄存器的值加4;
Rocket - debug - Example: Read Memory的更多相关文章
- Rocket - debug - Example: Write Memory
https://mp.weixin.qq.com/s/on1LugO9fTFJstMes3T2Xg 介绍riscv-debug的使用实例:使用三种方法写内存. 1. Using System Bus ...
- Xcode6 运行程序后,右侧Debug区域的Memory显示空白解决方法
http://chenyh-blog.com/%E8%9B%8B%E7%96%BC%E7%9A%84%E5%86%85%E5%AD%98-%E7%AC%AC%E4%B8%89%E7%AF%87-sdw ...
- Rocket - debug - TLDebugModuleInner - Hart Bus Access
https://mp.weixin.qq.com/s/deNMEyJ1idJDVoZwwo0A1A 简单介绍TLDebugModuleInner中核心总线访问(Hart Bus Access). 参考 ...
- Rocket - debug - Example: Triggers
https://mp.weixin.qq.com/s/zPNyrBOhsytkRrZTDTEvpw 介绍riscv-debug的使用实例:配置Triggers功能. 1. Trigger Trigge ...
- Rocket - debug - Periphery
https://mp.weixin.qq.com/s/uGxn-Xec0LkwdaSsCtQBvw 简单介绍Periphery的实现. 1. ExportDebugDMI/ExportDebugJTA ...
- Rocket - debug - DebugTransport
https://mp.weixin.qq.com/s/EcsuTjb4hFF9Ncig9Gfhew 简单介绍DebugTransport的实现. 1. JtagDTMConfig 1) JtagDTM ...
- Rocket - debug - TLDebugModule
https://mp.weixin.qq.com/s/EhUb1z5oiIw6dJ-90ifDJA 简单介绍TLDebugModule中的实现. 1. device device是一个设备描述符,包含 ...
- Rocket - debug - TLDebugModuleInner - ROM Generation
https://mp.weixin.qq.com/s/j_CgHU4PnY82NMwJzOqHYg 简单介绍Variable ROM Generation. 1. jalAbstract jalAbs ...
- Rocket - debug - Example: DMI
https://mp.weixin.qq.com/s/7suuJ7m2BKCpsHk1K2FzJQ 介绍riscv-debug的使用实例:如何使用DMI. 1. dm Debug Module实现了调 ...
随机推荐
- Shell简单实现多线程
一.目的 解决Shell脚本单线程下效率低下的问题 二.适用场景 需要在Linux系统执行同一项命令,但是针对不同的对象,例如PING检测主机,当然可以延展,只要是命令之间不会产生冲突就可以了 ...
- 解决php获取不到Authorization问题
我用的是thinkphp3.2.3, 在使用jwt的时候通过Authorization传递token,但是每次都接收不到,通过修改..htaccess文件,问题成功解决了,下面是的.htaccess文 ...
- Java 四种权限修饰符
Java 四种权限修饰符访问权限 public protected (default) private 同一个类(我自己) yes yes yes yes 同一包(我邻居) yes yes yes n ...
- 【FreeRTOS学习03】小白都能懂的Task Management 任务管理基本概念介绍
在FreeRTOS中,线程的术语又可以被称之为任务,或许这样更加合适,本文将介绍任务的创建/删除,任务参数的使用,以及任务优先级: 1 软实时和硬实时 硬实时系统的任务运行正确性与响应时限是紧密相关的 ...
- aui移动端UI库
aui 简介 aui 是一套基于原生javascript开发的移动端UI库,包含常用js方法.字符校验.dialog提示弹窗.侧滑菜单.时间选择器.多级联动.聊天UI.项目常用模板...... 特点 ...
- 移动端纯css超出盒子出现横向滚动条
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...
- spark机器学习从0到1介绍入门之(一)
一.什么是机器学习 机器学习(Machine Learning, ML)是一门多领域交叉学科,涉及概率论.统计学.逼近论.凸分析.算法复杂度理论等多门学科.专门研究计算机怎样模拟或实现人类的学习行 ...
- 在由N个元素构成的集合S中,找出最小元素C,满足C=A-B,其中A,B是都集合S中的元素,没找到则返回-1
package bianchengti; /* * 在由N个元素构成的集合S中,找出最小元素C,满足C=A-B, * 其中A,B是都集合S中的元素,没找到则返回-1 */ public class f ...
- 最香远程开发解决方案!手把手教你配置VS Code远程开发工具,工作效率提升N倍
文章每周持续更新,原创不易,「三连」让更多人看到是对我最大的肯定.可以微信搜索公众号「 后端技术学堂 」第一时间阅读(一般比博客早更新一到两篇) 今天和大家分享远程开发工具,分享一下我平常是如何用 V ...
- 如何在没有core文件的情况下用dmesg+addr2line定位段错误
前言 在现网环境下,程序奔溃后不一定会留下core文件,原因有很多,比如存储空间不足就是其中一个常见的原因.此时我们只能依据linux记录的错误日志来定位问题. 涉及linux命令 本文涉及以下几条命 ...