|
[原创]不要再问自己汇编是不是足够底层——JMP NEAR PTR
刚才又注意看了一下汇编书里面对MASM对JMP类指令的处理介绍,大致支持了之前考虑的方向。 但是介绍MASM编译过程中的具体行为之处,特别是对于 JMP NEAR PTR 对除正常IP位移量之外的数据的处理模式,却没有看到一个明显支持“-32768~32767”的说法。 所以对于为什么一定要强调“-32768~32767”的问题进一步保留。。。而且由此可以引发联想的一件事情就是:假如我以后有足够的反编译知识和能力,一定考虑把MASM给逆向了,到时候好好看看它的代码,看看这家伙本身的编译流程对 JMP NEAR PTR 的处理到底是个什么样子?为什么书上会反复强调“-32768~32767”? 强烈预感:“-32768~32767”并不是MASM对于 JMP NEAR PTR 指令处理过程中的必须表达,“-32768~32767”只是因为契合补码运算原理所展示出来的虽然真实但是比较容易误导我这样的读者对MASM运行机理理解的一个JOKE。“-32768~32767”作为描述实际数据处理的CASE肯定是没有错的,但是“-32768~32767”一定可以换一种面目以一种更接近真实运算架构的面目展示出来。。。 感慨:为什么好多技术领域都强调采集第一手资料?也许是因为经过转述的信息可能会帮助我们更快地理解,但也有可能会成为牵制我们理解的障碍。。。 |
|
[原创]不要再问自己汇编是不是足够底层——JMP NEAR PTR
躺在床上,反反复复还是想着自己在主贴对 JMP NEAR PTR 指令第2点体会上的文字表达上的不达意以及第3点体会上对‘-32768~32767’理解的不到位。。。 对于第2点,也就是 JMP NEAR PTR 的跳转范围问题,结合上在4楼的回帖就应该算是完全表达了自己对这个问题的理解了。。。 但是对于第3点,我想来想去的结果是还有一种可能:也许为什么位移是‘-32768~32767’而不是‘0~65535’的问题有点想偏了。。。把‘-32768~32767’和 JMP NEAR PTR 联想得那么“紧密”以致于非要求证出‘-32768~32767’对 JMP NEAR PTR 这条指令究竟有什么更深层次的联系根本就是一个原则性的错误。。。‘-32768~32767’的说法应该是内含了两层不同意义上的含义: 1、为什么非要把位移看成有符号数?强调编译程序在处理位移单元参与IP地址修改时的灵活性。编译程序对于最后决定IP地址转移的位移起到了判别类型和最终确定的重要作用,所以能够“向上”转移(即位移可以为负)的说法实际上暗示了在对程序的编译处理层面上编译器因为要最优处理位移值所起到的重要判别作用。是编译器先选择确定好的IP位移值,然后程序运行执行到转移指令时,IP位移值才进入CPU数据处理环节,此时所进行的运算并没有区别于其他运算的更深层次的含义。所以对“IP位移值为什么是有符号数”问题探究的关键不应放在‘-32768~32767’与 JMP NEAR PTR 这条具体指令有什么特殊联系的问题上。关键应该在于汇编编译器是怎么样判别、处理IP位移值,又是根据什么最优化的依据来确定IP位移值的问题。。。 2、为什么要在有符号数的角度说明转移位移的范围?仅仅是因为在上面1的理由后,继续站在在有符号数角度说明了 JMP NEAR PTR 对IP位移修改的范围。。。重点在于强调出这个范围的大小,而不是范围的起点和终点。。。 总之一句话吧,我认为对于为什么是‘-32768~32767’而不是‘0~65535’的问题的讨论更多地不是放在CPU或者CPU指令的架构层面上,而是应该在放在汇编编译器对程序的处理层面上。。。 总算说完了。。。只是自己的一点想法。。。^_^。。。 |
|
[原创]不要再问自己汇编是不是足够底层——JMP NEAR PTR
^_^。。。是呀。。。 |
|
[原创]不要再问自己汇编是不是足够底层——JMP NEAR PTR
对技术追求的极致真是不知道会是个什么样子。。。世界太大了。。。可惜每个人的时间都是有限的。。。 对了,还有为技术而技术的心态也不是经常有的,甚至很少有或者没有,社会是功利的,人是有私心的,技术很多情况下都不是被当作目标而是被当作达成目标的工具而被对待着。。。不过能在百忙功利之中抽出一点时间来纯粹技术陶醉一下一定也是一种享受吧。。。 |
|
[原创]不要再问自己汇编是不是足够底层——JMP NEAR PTR
其实JMP NEAR PTR还是在“假定”最大代码段 CS:0~CS:0FFFFH(也就是CS:0~CS:65535)的范围内跳来跳去找程序里标号处的地址。。。但因为标号又必须是明文写在代码部分里的,所以段其实就是代码段,段内其实就是指代码段内。。。不要误解以IP位移以“-32768~32767”为范围就有可能跳到CS:0上面或CS:0FFFFH下面的内存空间。。。IP累加位移后还是赋值于IP本身的,而IP本身应该是作为无符号数处理,所以没可能在以 CS:IP 所指向指令JMP NEAR PTR的上下内存空间随便跳的。。。段还是代码段,段内还是指代码段内,我写的第2点只是希望能深究一下这个代码段的由来,要是在‘段’的问题上误导了别人,可就罪过了。。。 另外,我非常赞同技术没极限的说法,我觉得,技术没有最底层,也没有最边际,有的只是不断地超越现有的。。。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值