Doing a indirect far jump/call in protected mode

梦想的初衷 提交于 2019-12-06 01:14:59

A frequently used trick is to emulate the jump using a far ret, such as:

push 0x10
push eax
retf

The x86 processors use little-endian mode. In keeping with that, the offset of a target precedes the segment in memory. For your example you should use:

dd 0x8010 ;offset of far jump

dd 0x10 ;segment of far jump, expanded to double-word for alignment reasons

;------------------

db 0x10, 0x80, 0, 0, 0x10, 0, 0, 0 ;will also work.

You might still get a privilege exception. For the code to work the target code segment must have the same privilege level as the source segment.

Primary source: The Processor and Coprocessor by Robert L. Hummel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!