0
.data
     oldcw: .int 
     clear: .long 0xF0FF
     round: .long 0x0D00

    fstcw oldcw
    fwait
    mov oldcw,%ax
    and %ax,clear
    or %ax,round
    pushl %eax
    fldcw [%esp]
    popl %eax

I get an error about the brackets.

invalid char '[' beginning operand 1 `[%esp]'

Anyone can help about whats the problem with the brackets? Im trying to modify control word with fldcw here...

Paul R
  • 208,748
  • 37
  • 389
  • 560
Ali U.
  • 119
  • 1
  • 1
  • 5

1 Answers1

1

In AT&T syntax, which gas uses, parentheses instead of brackets are used to denote memory access. See e.g. here.

In other words, it should be:

    fldcw (%esp)

Also note that the operands are reversed compared to intel syntax, so your code might not be doing what you're expecting if you're used to that.

If you prefer intel syntax you can use the .intel_syntax noprefix directive.

user786653
  • 29,780
  • 4
  • 43
  • 53