title: Why is this line of assembly an 'invalid use of register'?
body: <p>I am going through some OS development tutorials and I constantly see the following section of code:</p>
  
  <pre><code>.intel_syntax noprefix
  
  do_e820:
      xor ebx, ebx        # ebx must be 0 to start
      xor bp, bp      # keep an entry count in bp
      mov edx, 0x0534D4150    # Place "SMAP" into edx
      mov eax, 0xe820
      mov [es:di + 20], dword 1   # &lt;&lt;&lt;this is the line I don't get
      mov ecx, 24     # ask for 24 bytes
      int 0x15
      jc short .failed    # carry set on first call means "unsupported function"
      mov edx, 0x0534D4150    # Some BIOSes apparently trash this register?
      cmp eax, edx        # on success, eax must have been reset to "SMAP"
      jne short .failed
      test ebx, ebx       # ebx = 0 implies list is only 1 entry long (worthless)
      je short .failed
      jmp short .jmpin
  </code></pre>
  
  <p>When I try to assemble this for my home-rolled kernel, the assembler complains <code>Error: invalid use of register</code> at the line I have marked. If it helps understand the situation, I am using an gcc i686-elf cross assembler. </p>