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 another segment. From what I understand there are no segments in linux virtual memory? Also how do we know if my program's code is laid out in multiple segments?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With