打印
[STM8]

STVD严重漏洞!!

[复制链接]
2408|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
本帖最后由 qq824314222 于 2012-6-2 09:15 编辑

在下在写LCD1602的显示程序时,老是不成功,后来看了DEBUG文件下的LST文件,发现在asm文件中使用跳转指令(有时CALL指令和CALLF指令也是这样),会导致跳转的地址小了256字节!地址在256字节内就正常。如果原本跳到0081A6,结果跳到0080A6。 接着我单独开了个asm文件,全部填充NOP指令,再从开头跳转到结尾,又没有出错。。。。望高手看看我写的程序,到底哪里出错了,还是我本身就没错,是软件的漏洞,本人严重怀疑是软件问题!!附上完整源程序。和图片

图片.jpg (104.3 KB )

图片.jpg

1602测试.rar

78.57 KB

沙发
lost1421| | 2012-6-2 00:39 | 只看该作者
包里是空的,只有一个readme.txt。

使用特权

评论回复
板凳
qq824314222|  楼主 | 2012-6-2 09:16 | 只看该作者
2# lost1421 不好意思哦,我刚刚更新为rar格式,你看看能不能打开。。应该是压缩软件的问题。

使用特权

评论回复
地板
qq824314222|  楼主 | 2012-6-8 13:33 | 只看该作者
都发表了这么多天了,怎么就没有人回复呢?

使用特权

评论回复
5
rush1988| | 2012-7-12 21:56 | 只看该作者
现在用汇编的不多,所以大虾们懒得给你看,根据我的经验,应该是页跳转问题,如果跨页跳转,用汇编就必须要考虑这些。你先看看DS上这几条指令的注意事项,如有问题在M我。

使用特权

评论回复
6
rush1988| | 2012-7-12 21:59 | 只看该作者
参考一下这个。
CALL/CALLR and RET must be used only in the same section. The effective address for the
CALL/RET is used as an offset to the current PCE register value. For the JP, the effective
address 16 or 17-bit (for indexed addressing) long, is added to the current PCE value. In
order to reach any address in the program space, the JPF jump and CALLF call instructions
are provided with a three byte extended addressing mode while the RETF pops also three
bytes from the stack.
As the memory space is linear, sections can be crossed by two CPU actions: next
instruction byte fetch (PC+1), relative jumps and, in some cases, by JP (for indexed
addressing mode).
Note: For safe memory usage, a function which crosses sections MUST:
- be called by a CALLF
- include only far instructions for code operation (CALLF & JPF)
All label pointers are located in section 0 (JP [ptr.w] example: ptr.w is located in section 0
and the jump address in current section)
Any illegal op-code read from the program space

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

13

帖子

0

粉丝