RDFSBASE, RDGSBASE

Read FS/GS Segment Base

stableVMJITAOTinstruction

Encodings

OpcodeInstructionOp/En64-bitCompat/LegacyDescription
F3 0F AE /0RDFSBASE r32MValidInvalidLoad the 32-bit destination register with the FS base address.
F3 REX.W 0F AE /0RDFSBASE r64MValidInvalidLoad the 64-bit destination register with the FS base address.
F3 0F AE /1RDGSBASE r32MValidInvalidLoad the 32-bit destination register with the GS base address.
F3 REX.W 0F AE /1RDGSBASE r64MValidInvalidLoad the 64-bit destination register with the GS base address.

Operand encoding

Each mode is a value of the Op/En column above. It says which field of the encoded instruction carries each operand, in the order they are written, and whether the instruction reads it, writes it or both.

M

  1. modrm.rm escrituraModRM byte, r/m field (bits 2-0); with the SIB byte and the displacement when the mod field asks for them

Measured cost

Loading measurements from arch-data...

Description

Loads the general-purpose register indicated by the ModR/M:r/m field with the FS or GS segment base address.

The destination operand may be either a 32-bit or a 64-bit general-purpose register. The REX.W prefix indicates the operand size is 64 bits. If no REX.W prefix is used, the operand size is 32 bits; the upper 32 bits of the source base address (for FS or GS) are ignored and upper 32 bits of the destination register are cleared. This instruction is supported only in 64-bit mode.

Operation

DEST := FS/GS segment base address;

Flags affected

None.

C/C++ Compiler Intrinsic Equivalent

RDFSBASE unsigned int _readfsbase_u32(void ); RDFSBASE unsigned __int64 _readfsbase_u64(void ); RDGSBASE unsigned int _readgsbase_u32(void ); RDGSBASE unsigned __int64 _readgsbase_u64(void );

Exceptions

Protected mode
#UDThe RDFSBASE and RDGSBASE instructions are not recognized in protected mode.
Real address mode
#UDThe RDFSBASE and RDGSBASE instructions are not recognized in real-address mode.
Virtual-8086 mode
#UDThe RDFSBASE and RDGSBASE instructions are not recognized in virtual-8086 mode.
Compatibility mode
#UDThe RDFSBASE and RDGSBASE instructions are not recognized in compatibility mode.
64-bit mode
#UDIf the LOCK prefix is used. If CR4.FSGSBASE[bit 16] = 0. If CPUID.07H.00H:EBX.FSGSBASE[0] = 0.

Sources