Near and Far JMPs

前端 未结 5 1173
梦谈多话
梦谈多话 2021-02-05 23:56

I am doing Linux assembly and I understand that is has a flat memory model. What I am confused about is NEAR and FAR JMPs.

NEAR is in the same segment while FAR is anot

5条回答
  •  庸人自扰
    2021-02-06 00:30

    It hasn't been segments for a long time now. The correct term in protected mode x86 is selector.

    Having said that, the difference between a near jump and a far one is that the former maintains the same code selector cs while the latter (usually) changes it.

    In a flat memory model, the former case is almost always how it's done.

    You could have an operating system where the flat memory model is served by multiple selectors but I can't see a useful use case for it, and it's not the way Linux works, at least on x86.

提交回复
热议问题