The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Gunther on March 08, 2021, 05:28:40 PM

Title: Does UASM not like the register fs?
Post by: Gunther on March 08, 2021, 05:28:40 PM
This may not be a smart question, but I'll ask it anyway. I need the following statements in a protected mode program:

    mov      al, ds:[esi]
    mov      byte ptr fs:[edi], al

The first instruction assembles JWASM/UASM without complaint. The second completely correct instruction, which should lead to the machine code 646807h, generates an error 2183 (JWASM) or 2184 (UASM).

The same happens in the reverse case:

    mov      al, fs:[esi]

This should result as machine code 648A06h, but again results in the error message. This occurs in JWASM for DOS version 2.13 and also in the latest version 2.51 of UASM.

Something has obviously not been right for a long time.

Gunther
Title: Re: Does UASM not like the register fs?
Post by: nidud on March 08, 2021, 10:38:40 PM
deleted
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 08, 2021, 11:23:01 PM
Nidud,

Quote from: nidud on March 08, 2021, 10:38:40 PM
FS and GS is assumed to ERROR in flat mode:

    assume cs:flat,ds:flat,ss:flat,es:flat,fs:ERROR,gs:ERROR

Try this:

    assume  fs:nothing
    mov     al,fs:[edi]
    assume  fs:error


fine, but that doesn't help. It is a 32-bit protected mode program. I know exactly what I am doing and what fs and gs contain for descriptors.
Other assemblers translate these instructions correctly and without complaint. Do I need to hack in these commands via db in the future?

Gunther
Title: Re: Does UASM not like the register fs?
Post by: jj2007 on March 09, 2021, 12:30:29 AM
if it's not flat, ERROR, nothing, what is the correct name then?
Title: Re: Does UASM not like the register fs?
Post by: nidud on March 09, 2021, 12:50:25 AM
deleted
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 09, 2021, 01:10:59 AM
Nidud,

the workaround with the assume works well, but it's a bit awkward.

It seems to me as an incapacitation through the assembler maintainers. The DJGPP has fs as the only free segment register. It's not my decision.

Gunther 
Title: Re: Does UASM not like the register fs?
Post by: nidud on March 09, 2021, 01:52:17 AM
deleted
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 09, 2021, 08:16:37 PM
Casually, with the latest version of JWASM for DOS (version 2.13 from July 23, 2015) maintained by Japheth, the error no longer occurs. The corresponding instructions are translated correctly
and without complaint. The described behavior can only be found very exclusively in UASM.

For the further development of JWASM please also note this post (http://masm32.com/board/index.php?topic=9222.msg101398#msg101398).

Gunther
Title: Re: Does UASM not like the register fs?
Post by: johnsa on March 10, 2021, 04:48:47 AM
I think we could safely NOT assume fs/gs to ERROR if the output format is not -coff ?
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 10, 2021, 05:29:20 AM
Johnsa,

be careful, the DJGPP requires coff. It is the 32-bit com model.

Gunther
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 10, 2021, 08:08:39 PM
Johnsa,

what is supposed to happen when fs and gs no longer assume to ERROR? JWASM for DOS from 2015 shows that it works.

When someone in protected mode uses the segment registers with a valid selector, they know exactly what they are doing.
If a novice fiddles with the segment registers in Protected Mode, he will simply get a GPF. This is the worst thing that can happen. So what?

Gunther
Title: Re: Does UASM not like the register fs?
Post by: johnsa on March 11, 2021, 02:19:04 AM
Agreed, you can even use fs: in win32 .. I'm inclined to say just remove the ERROR assume outright.
Title: Re: Does UASM not like the register fs?
Post by: Gunther on March 11, 2021, 05:01:17 AM
Johnsa,

Quote from: johnsa on March 11, 2021, 02:19:04 AM
Agreed, you can even use fs: in win32 .. I'm inclined to say just remove the ERROR assume outright.

I need register fs under DJGPP (32-bit Protected Mode DOS).

Gunther