Author Topic: Does UASM not like the register fs?  (Read 1236 times)

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Does UASM not like the register fs?
« 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:
Code: [Select]
    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:
Code: [Select]
    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
Get your facts first, and then you can distort them.

nidud

  • Member
  • *****
  • Posts: 2215
    • https://github.com/nidud/asmc
Re: Does UASM not like the register fs?
« Reply #1 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

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #2 on: March 08, 2021, 11:23:01 PM »
Nidud,

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
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 11551
  • Assembler is fun ;-)
    • MasmBasic
Re: Does UASM not like the register fs?
« Reply #3 on: March 09, 2021, 12:30:29 AM »
if it's not flat, ERROR, nothing, what is the correct name then?

nidud

  • Member
  • *****
  • Posts: 2215
    • https://github.com/nidud/asmc
Re: Does UASM not like the register fs?
« Reply #4 on: March 09, 2021, 12:50:25 AM »
The Jwasm error 2183 correspond to the ML 6.0 error 2108.

  use of register assumed to ERROR

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #5 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 
Get your facts first, and then you can distort them.

nidud

  • Member
  • *****
  • Posts: 2215
    • https://github.com/nidud/asmc
Re: Does UASM not like the register fs?
« Reply #6 on: March 09, 2021, 01:52:17 AM »
Think it's a compatibly issue with Masm that's plays into this. In 64-bit GS is assumed to NOTHING. The intrin macros resets the state of FS (as I suggested) but you only have to do this ones.

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #7 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.

Gunther
Get your facts first, and then you can distort them.

johnsa

  • Member
  • ****
  • Posts: 844
    • Uasm
Re: Does UASM not like the register fs?
« Reply #8 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 ?

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #9 on: March 10, 2021, 05:29:20 AM »
Johnsa,

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

Gunther
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #10 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
Get your facts first, and then you can distort them.

johnsa

  • Member
  • ****
  • Posts: 844
    • Uasm
Re: Does UASM not like the register fs?
« Reply #11 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.

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Does UASM not like the register fs?
« Reply #12 on: March 11, 2021, 05:01:17 AM »
Johnsa,

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
Get your facts first, and then you can distort them.