Skip to content

Address Space Attributes

widberg edited this page Sep 5, 2023 · 14 revisions

Microsoft-specific modifiers

Pointer Size Address Space Attributes

Requires -fms-extensions

Attributes that define the size of a pointer type.

Attribute X86_32 X86_64
__ptr32 Nop Extended
__ptr64 Truncated Nop

Pointer Sign Extension Attributes

Requires -fms-extensions

Attributes that define the extension behavior of a pointer attributed with __ptr32 when cast to 64 bits.

Attribute Extension
__sptr Sign extended
__uptr Zero extended

Segment Register Relative Pointer Attributes

Memory references to specified segments
Remove address space builtin function
address-space

Segment Register __attribute__((address_space(X))) Attribute Macro Test Macro
GS __attribute__((address_space(256))) __seg_gs __SEG_GS
FS __attribute__((address_space(257))) __seg_fs __SEG_FS
SS __attribute__((address_space(258)))

Pointers with these attributes will be relative to the corresponding segment register. The attribute macros expand to the corresponding __attribute__((address_space(X))) attribute and the test macro indicates support, this is for GCC compatibility.