News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Load Far Pointer, LFS Instruction

Started by baltoro, November 02, 2008, 10:08:47 PM

Previous topic - Next topic

baltoro

I'm just learning assembly language programming, and I ran across this instruction in the Intel Developer's Manuals.
LFS, reads and stores the far pointer specified by the source memory operand into the FS segment register.
Would you ever use this instruction in User Mode? Why?
The documentation doesn't say its usage is restricted to kernel mode (operating system) applications only. 
I'm strictly a Windows programmer, and I'm having a difficult time imagining when it would be useful, except in malicious code.   
And, normally, how is the FS segment register loaded? Doesn't the operating system control this?
Baltoro

hutch--

Generally instructions of this type are for operating system development and have no use in user code. If you were writing a haooby OS you would have a reason to learn it but in win32 user mode, its a waste of your time.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Most modern (32-bit) operating systems reserve the segment registers for their own use, and so there's not much value in changing them from user mode. And, unless you know what you're doing, you're likely to attempt to load an invalid selector and cause an exception in your program.
You can safely ignore these instructions (LDS, LES, LFS, LGS, LSS) for normal use (of course, be aware they exist, but they're not much use to you for general programming.) And when segment registers are required, it's more common to load them directly.
No snowflake in an avalanche feels responsible.

baltoro

Tedd and Hutch,   
Thanks. Good Intel. I couldn't find any useful information by googling, so I figured I'd ask here. 
Baltoro