6.59.12 IA-16 Built-in Functions

For each built-in function for IA-16, there is an equally named, uppercase built-in macro defined—for example, __BUILTIN_IA16_FP_OFF. That way users can easily query if or if not a specific built-in is implemented or not.

__segment __builtin_ia16_selector (unsigned sel)

With -mprotected-mode (see IA-16 Options), internally flag sel as a segment selector value which can be loaded into a segment register, and return the flagged value. Without -mprotected-mode, simply return sel.

unsigned __builtin_ia16_FP_OFF (const void __far *fp)

Extract the offset portion of the far pointer fp. This function can be used within a static initializer, under certain conditions4.

void __far *__builtin_ia16_static_far_cast (type *p)

Convert p to a far pointer. If p is already a far pointer, just return it.

This function can be used within a static initializer, under certain conditions5.

__segment __builtin_ia16_near_data_segment (void)

Return the segment value for the generic (near) data address space.

__segment __builtin_ia16_ss (void)

Return the value of the stack segment register ss.

This should return the same value as __builtin_ia16_near_data_segment (), unless the calling function is marked __attribute__ ((__no_assume_ss_data__)) (see IA-16 Function Attributes).


Footnotes

(4)

Currently, this is allowed if fp is a pointer to a locally defined variable or function, or if fp points to an external variable or function and LTO is not in effect.

(5)

Currently, this is allowed if p is a far pointer, or if p is a pointer to a locally defined near variable, or if p points to an external near variable and LTO is not in effect.