The difference between long and short jump (x86)

I read that short jumps should be used when the relative jump is less than 124 in the address , and long jumps should be used differently.

What is the difference in CPU / performance operations between the two types of x86 transitions?

+5
source share
1 answer

There are actually three types of JMP instructions; short, near and far (long).

Short JMP is the relative JMP you are accessing. It is encoded as two bytes; actual JMP and the number of bytes +/- relative to the current IP.

The closest jump allows you to jump in the current "segment" (using the conditions of the real mode) or within the current selected memory area in the CS selector.

A Long or Far JMP additionally includes a selector (or segment in real mode)

You can watch the timings for yourself. The biggest time-related difference is due to the different number of bytes that must be read in order to run JMP .

+7
source

Source: https://habr.com/ru/post/1216341/


All Articles