Menu

#180 segment registers - fs,gs on 286

open
nobody
None
1
2004-06-14
2004-06-13
No

Hello,

NASM (nasmw 0.98.38) incorrectly compiles code

CPU 286

mov fs,ax
mov ax,[fs:0]
mov fs,[0]

fs

;push fs
;pop fs

The problem is, it should at least write some warning
that fs is not available at 286. Instructions push,pop
fs causes critical error, but fs prefix or mov fs,reg
doesnot.

The same for gs.

Thanks
Zdenek Sojka

Discussion

  • Zdenek Sojka

    Zdenek Sojka - 2004-06-13
    • priority: 5 --> 7
     
  • nasm64developer

    nasm64developer - 2004-06-14
    • priority: 7 --> 1
     
  • nasm64developer

    nasm64developer - 2004-06-14

    Logged In: YES
    user_id=804543

    Yes, for MOV from/to FS/GS the assembler should warn.
    Yes, for FS/GS prefixes the assembler should also warn.

    The former can be achieved by splitting the existing
    insns.dat entries, so that they use reg_cs, reg_dess,
    reg_fsgs, and reg_seg67 instead of reg_sreg.

    The latter can be achieved by checking the current CPU
    flags in assemble.c's assemble() function; the proper
    spot is in the case statements for R_FS and R_GS.

    I have been using the above in my local forked version
    of NASM for quite some time now.

     

Log in to post a comment.