logoalt Hacker News

Someoneyesterday at 8:19 PM2 repliesview on HN

If you squeeze your eyes a bit, C compilers for Windows used to have them, with far pointers (https://en.wikipedia.org/wiki/Far_pointer)

Similarly, CPU architectures that use descriptors can (have to?) have languages with that notion.


Replies

sparkieyesterday at 9:11 PM

The FS and GS segment selectors are still used in x86-64, typically for `thread_local` storage, but they can be repurposed.

`thread_local` is an example of a "relative pointer" though. Instructions to access the thread local are prefixed with `fs:` or `gs:`, and point relative to the address in the respective segment register.

frmdstryryesterday at 9:23 PM

After more searching I found this article https://www.gingerbill.org/article/2020/05/17/relative-point...

A far pointer sounds like the global based pointer described in that article. The far pointer Wikipedia article says they are problematic but doesn't give much reasoning as to why.

show 1 reply