本文介绍了如何判断跳跃是绝对的还是相对的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究汇编测试,并且在位置无关代码"主题下,我发现相对跳跃和绝对跳跃之间的区别令人困惑.我怎么知道这是一种跳跃?

I'm studying for a test in assembly and in the subject of "Position-Independent-Code" I find the difference between a relative jump and an absolute jump confusing.How can I tell what kind of jump it is?

我知道什么是相对跳跃(与当前行的偏移量).但是绝对跳跃是什么样子?什么时候发生?

I understand what a relative jump is (the offset from current line).But what does an absolute jump look like? When does it happen?

推荐答案

任何看起来像普通jmp label的东西都是相对的.

Anything that looks like just plain jmp label is relative.

绝对跳跃

  • jmp register
  • jmp [address]
  • jmp segment:absoluteaddr
  • jmp far [address]
  • jmp register
  • jmp [address]
  • jmp segment:absoluteaddr
  • jmp far [address]

任何远跳都是绝对的,任何间接跳转都是绝对的,因此组合(远,间接)也是绝对的.远跳仅在必要时发生(您必须更改cs而不是call).间接跳转用于函数指针,分支表(在某些情况下用于switch语句),动态分派(虚拟方法)以及可能用于导入的函数(通常调用它们,但这也许是一个尾部调用).

Any far jump is absolute, any indirect jump is absolute, the combination (far, indirect) is therefore also absolute. Far jump only happen when necessary (you have to change cs and it's not a call). Indirect jumps are used for function pointers, branch tables (used in some cases for switch statements), dynamic dispatch (virtual methods) and maybe for imported functions (usually you call them, but maybe it's a tail call).

这篇关于如何判断跳跃是绝对的还是相对的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 14:29