Far pointer

1

In a segmented architecture computer, a far pointer is a pointer to memory in a specific context, such as a segment selector making it possible to point to addresses outside of the default segment. Comparison and arithmetic on far pointers is problematic: there can be several different segment-offset address pairs pointing to one physical address.

In 16-bit x86

For example, in an Intel 8086, as well as in later processors running 16-bit code, a far pointer has two parts: a 16-bit segment value, and a 16-bit offset value. A linear address is obtained by shifting the binary segment value four times to the left, and then adding the offset value. Hence the effective address is 21 bits. There can be up to 4096 different segment-offset address pairs pointing to one physical address. To compare two far pointers, they must first be converted (normalized) to their linear representation. On C compilers targeting the 8086 processor family, far pointers were declared using a non-standard far qualifier; e.g., char far *p; defined a far pointer to a char. The difficulty of normalizing far pointers could be avoided with the non-standard huge qualifier. On other compilers it was done using an equally non-standard __far qualifier. Example of far pointer:

This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.

Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
Bliptext is not affiliated with or endorsed by Wikipedia or the Wikimedia Foundation.

View original