Skip to content
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

BL 和 BLx 指令在判断的时候减去的长度好像存在问题 #58

Open
lemonking77 opened this issue May 5, 2022 · 5 comments
Open

Comments

@lemonking77
Copy link

disassembly_ins_is_bl_blx(pc - sizeof(size_t)) && (depth < size)) 这里的减4 应该只适用于BL 指令,在指向BL或者BLX 之前会把当前地址加上一个指令大小,BLx 指令应该是减去2吧?这里仅仅是我个人的看法,还没去验证,如果有错误,还请指导一下

@armink
Copy link
Owner

armink commented May 5, 2022

你好,可否有时间验证一下呢

@lemonking77
Copy link
Author

你好,可否有时间验证一下呢
BLx 相关的汇编代码:
0x1'61d2: 0x47b0 BLX R6
0x1'61d4: 0xf04f 0x0900 MOV.W R9, #0

BL 相关的汇编代码:
0x1'6202: 0xf018 0xfd5a BL tuya_queue_output ; 0x2'ecba
0x1'6206: 0x2800 CMP R0, #0

从这里地址偏差上看BL 是4字节的,BLX register 是2字节的,(对于 BLX label 又是4字节的,这个我还没有遇到)

@armink
Copy link
Owner

armink commented May 7, 2022

可以触发一下断言或 Hardfault 正好测试一下有没有效果哈

@lemonking77
Copy link
Author

对于HardFault_Handler 以汇编的形式给出,这个不太好移植,怎么在C语言环境下的 HardFault_Handler 中获取 LR 的值 用来进行硬件状态判断,请指导一下

@armink
Copy link
Owner

armink commented May 7, 2022

参考一下 demo 文件下的示例吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants