FWord Pointer
   HOME

TheInfoList



OR:

In a segmented architecture computer, a far pointer is a pointer to memory in a specific context, such as a
segment selector x86 memory segmentation is a term for the kind of memory segmentation characteristic of the Intel x86 computer instruction set architecture. The x86 architecture has supported memory segmentation since the original Intel 8086 (1978), but ''x86 m ...
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 computing, a physical address (also real address, or binary address), is a memory address that is represented in the form of a binary number on the address bus circuitry in order to enable the data bus to access a ''particular'' storage cell o ...
.


In 16-bit x86

For example, in an
Intel 8086 The 8086 (also called iAPX 86) is a 16-bit computing, 16-bit microprocessor chip designed by Intel between early 1976 and June 8, 1978, when it was released. The Intel 8088, released July 1, 1979, is a slightly modified chip with an external 8-b ...
, as well as in later processors running
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two ...
code, a far pointer has two parts: a 16-bit segment value, and a 16-bit
offset Offset or Off-Set may refer to: Arts, entertainment, and media * "Off-Set", a song by T.I. and Young Thug from the '' Furious 7: Original Motion Picture Soundtrack'' * ''Offset'' (EP), a 2018 EP by singer Kim Chung-ha * ''Offset'' (film), a 200 ...
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 normalized to a form with only one representation address. Such a normalized form may be one that minimizes the segment (maximizing the offset), minimizes the offset (maximizing the segment), or converts the 2-part segmented address to a (20-bit) linear representation. One commonly used normalized form minimizes the offset part of the address to a value less than 16 (10 hex): such a normalization can be computed simply by taking the low-order 4 bits of the unnormalized offset as the new offset, and adding to the unnormalized segment the unnormalized offset shifted right by 4 bits. On C
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
s targeting the 8086 processor family, far pointers were declared using a non-standard qualifier; e.g., defined a far pointer to a char. The difficulty of normalizing far pointers could be avoided with the non-standard qualifier. On other compilers it was done using an equally non-standard qualifier. Example of far pointer: #include int main() :Output of the following program: 81; Because both addresses point to same location. :Physical Address = (value of segment register) * 0x10 + (value of offset). :Location pointed to by pointer is : 0x5555 * 0x10 + 0x0005 = 0x55555 :Location pointed to by pointer is : 0x5333 * 0x10 + 0x2225 = 0x55555 :So, and both point to the same location 0x55555.


Notes


References

{{DEFAULTSORT:Far Pointer Computer memory Pointers (computer programming)