logoalt Hacker News

sparkieyesterday at 9:56 PM1 replyview on HN

Far pointers are for accessing memory in different segments. They're basically obsolete now. They were necessary in older machines with limited sized pointers or address spaces.

GCC still supports `__seg_fs` and `__seg_gs`, which behave similar to `far` in the example on the wiki page, as the FS and GS segment registers are still valid in x86-64 and used for TLS. Clang uses attributes `address_space(257)` and `address_space(256)` for the same thing.

The `__based` pointer in MSVC exploits the addressing modes by pinning the base in eg: `[base+index*scale+displacement]`. It's unrelated to segmentation.


Replies

Joker_vDyesterday at 11:06 PM

> Far pointers are for accessing memory in different segments. They're basically obsolete now.

Project CHERI would like to disagree.

show 1 reply