What's the issue with MASM and the FS register?
mov eax,FS:[0] is not valid?
Posted on 2003-06-11 00:49:19 by Homer
error A2108

An attempt was made to use a register that had been assumed to ERROR with the ASSUME directive.

assume FS:nothing
mov eax,FS:[0]
assume FS:error

assume GS:nothing
mov eax,GS:[0]
assume GS:error
Posted on 2003-06-11 01:02:48 by donkey
Shouldn't it be

mov eax,dword ptr FS:[0]

Posted on 2003-06-11 03:06:42 by roticv
In MASM, "mov eax,FS:[0]" would automaticaly imply the move of a DWORD into a 32-bit register. There is no need to re-specify it for the memory address. Similarly, "mov ax,FS:[0]" would automaticaly imply the move of a WORD into a 16-bit register.
Specifying the size of the memory operand is necessary only when the instruction is unclear about the required size, such as:

movzx eax,byte ptr FS:[0], movzx eax,word ptr FS:[0]
imul word ptr FS:[0], imul dword ptr FS:[0]

The above may be different for other assemblers/compilers.

Posted on 2003-06-11 23:18:17 by Raymond
ASSUME FS:FLAT also works
Posted on 2003-06-11 23:58:25 by bitRAKE
From MASM32 Help:

Flat memory model

The FS and GS segment registers are not needed for flat-model
programs. The .MODEL FLAT statement automatically generates this


Posted on 2003-06-12 12:54:22 by MazeGen